| Deutsch English Français Italiano |
|
<seven-20241106014329@ram.dialup.fu-berlin.de> View for Bookmarking (what is this?) Look up another Usenet article |
Path: ...!news.roellig-ltd.de!open-news-network.org!weretis.net!feeder8.news.weretis.net!fu-berlin.de!uni-berlin.de!not-for-mail
From: ram@zedat.fu-berlin.de (Stefan Ram)
Newsgroups: comp.lang.python
Subject: Two aces up Python's sleeve
Date: 6 Nov 2024 00:49:15 GMT
Organization: Stefan Ram
Lines: 21
Expires: 1 Jul 2025 11:59:58 GMT
Message-ID: <seven-20241106014329@ram.dialup.fu-berlin.de>
Mime-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
X-Trace: news.uni-berlin.de POyAEnTvoH5G4N7zBc/ejAZ8fwaOd6P2EVGaIiZeCL9h6e
Cancel-Lock: sha1:MatEFTf9yJ4tJ1Z0oFsEGwHh0Sc= sha256:osf+WcvO2VT2y5zd9kVxmK2+SQ9BIXiezl9scfKYfv8=
X-Copyright: (C) Copyright 2024 Stefan Ram. All rights reserved.
Distribution through any means other than regular usenet
channels is forbidden. It is forbidden to publish this
article in the Web, to change URIs of this article into links,
and to transfer the body without this notice, but quotations
of parts in other Usenet posts are allowed.
X-No-Archive: Yes
Archive: no
X-No-Archive-Readme: "X-No-Archive" is set, because this prevents some
services to mirror the article in the web. But the article may
be kept on a Usenet archive server with only NNTP access.
X-No-Html: yes
Content-Language: en-US
Bytes: 2201
ram@zedat.fu-berlin.de (Stefan Ram) wrote or quoted:
>last_item = my_list[ -1 ]
>Way cleaner than my_list[ len( my_list )- 1 ], don't you think?
In "The Mental Game of Python," Raymond Hettinger spills the
beans about our noggins only being able to juggle 7 +/- 2
things in our short-term memory.
So, "last_item = my_list[ -1 ]" might still make the cut,
while "my_list[ len( my_list)- 1 ]" could be biting off
more than we can chew.
|The problem is, the number of brain registers this uses is
|10. This is no longer a decryption effort. This is a puzzle.
|At the moment you put it together, you fully understand it.
|But if this is embedded in bigger code, every time you hit
|this line, you're going to have to pick apart "what does this
|thing do?".
Raymond Hettinger