A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://mail.python.org/pipermail/python-dev/2006-July/067238.html below:

[Python-Dev] Explicit Lexical Scoping (pre-PEP?)

[Python-Dev] Explicit Lexical Scoping (pre-PEP?) [Python-Dev] Explicit Lexical Scoping (pre-PEP?)K.S.Sreeram sreeram at tachyontech.net
Tue Jul 11 10:56:54 CEST 2006
Talin wrote:
>     def x():
>        scope = object()
>        scope.x = 1
>        def y():
>           scope.x = 2

'object' doesn't let you set custom attributes.
Here's what I normally use in my code...

class Data : pass

def x() :
    d = Data()
    d.x = 1
    def y() :
        d.x += 1


Regards
Sreeram


-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 252 bytes
Desc: OpenPGP digital signature
Url : http://mail.python.org/pipermail/python-dev/attachments/20060711/eb5ca5be/attachment.pgp 
More information about the Python-Dev mailing list

RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4