One-liner blocks (was Re: accessing a functions var from a subfunction.)
Aahz
aahz at pythoncraft.com
Wed Apr 16 20:02:25 EDT 2003
In article <gcjna.35728$T34.931514 at news2.tin.it>,
Alex Martelli <aleax at aleax.it> wrote:
>Aahz wrote:
>> In article <iCzma.16405$T34.518484 at news2.tin.it>,
>> Alex Martelli <aleax at aleax.it> wrote:
>>>
>>>def test():
>>> class Bunch: pass
>>> loc = Bunch()
>>> loc.count = 0
>>> def inc_count():
>>> loc.count += 1
>>> inc_count()
>>> inc_count()
>>> print loc.count
>>
>> Note that Guido deeply regrets permitting one-line blocks; this is
>> something he may try fixing for Python 3.0.
>
>Forcing linebreak after each & every colon? Oh well -- he's probably
>getting bribes from large-screen and vertical-aspect-ratio monitor
>manufacturers, is my guess...;-)
The reason I mentioned it is because I did indeed miss your
"class Bunch: pass" the first time I read your code.
--
Aahz (aahz at pythoncraft.com) <*> http://www.pythoncraft.com/
Why is this newsgroup different from all other newsgroups?
More information about the Python-list
mailing list