Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #196972

Re: Two aces up Python's sleeve

From Mild Shock <janburse@fastmail.fm>
Newsgroups comp.lang.python
Subject Re: Two aces up Python's sleeve
Date 2024-11-06 17:27 +0100
Message-ID <vgg5dn$ij48$1@solani.org> (permalink)
References <seven-20241106014329@ram.dialup.fu-berlin.de>

Show all headers | View raw


Then please explain why I have to write:

    i += 1

Instead of the shorter:

    i ++

My short-term memory is really stressed.

Stefan Ram schrieb:
> 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
> 
> 

Back to comp.lang.python | Previous | NextNext in thread | Find similar


Thread

Re: Two aces up Python's sleeve Mild Shock <janburse@fastmail.fm> - 2024-11-06 17:27 +0100
  Re: Two aces up Python's sleeve Annada Behera <annada@tilde.green> - 2024-11-07 12:55 +0530
    Re: Two aces up Python's sleeve Mild Shock <janburse@fastmail.fm> - 2024-11-07 15:04 +0100
      Re: Two aces up Python's sleeve Greg Ewing <greg.ewing@canterbury.ac.nz> - 2024-11-08 11:15 +1300
        Re: Two aces up Python's sleeve dn <PythonList@DancesWithMice.info> - 2024-11-08 13:07 +1300
        Re: Two aces up Python's sleeve Mild Shock <janburse@fastmail.fm> - 2024-11-08 01:25 +0100
          Re: Two aces up Python's sleeve Mild Shock <janburse@fastmail.fm> - 2024-11-08 01:29 +0100
            Re: Two aces up Python's sleeve Mild Shock <janburse@fastmail.fm> - 2024-11-08 01:47 +0100
    Re: Two aces up Python's sleeve (Posting On Python-List Prohibited) Lawrence D'Oliveiro <ldo@nz.invalid> - 2024-11-08 01:10 +0000
      Re: Two aces up Python's sleeve (Posting On Python-List Prohibited) Mild Shock <janburse@fastmail.fm> - 2024-11-08 02:40 +0100
        Re: Two aces up Python's sleeve (Posting On Python-List Prohibited) dn <PythonList@DancesWithMice.info> - 2024-11-09 08:09 +1300
          Re: Two aces up Python's sleeve (Posting On Python-List Prohibited) Mild Shock <janburse@fastmail.fm> - 2024-11-08 20:49 +0100
        Re: Two aces up Python's sleeve (Posting On Python-List Prohibited) Thomas Passin <list1@tompassin.net> - 2024-11-08 17:00 -0500

csiph-web