[Python-Dev] Scoping [Patience, please]

lingwitt at gmail.com lingwitt at gmail.com
Wed Jan 31 15:52:48 CET 2007


lingwitt at gmail.com wrote:
> #### Tangent (Utter Tomfoolery) ####
>
> More interestingly, one sees (if one squints) the distinction  
> between modules,
> classes, and functions blur:
>
> >>> def new_b():
> ...     print "tee hee"
> >>> a.b = new_b()
> >>>a()
> tee hee
> 3
> >>> print x
> 5
>


After falling into bed, I realized that everything after this point  
contradictions
with my earlier usage of qualified names.

Upon further investigation, it seems what I have suggested above
conflicts with the use of func_dict.


> or perhaps:
>
> >>> # Interestingly, the following code is valid already
> ...
> >>> def Person(name, age, location):
> ...     def print_record():
> ...         print('The last person created had the name ' +  
> Person.name_last)
> ...         print("However, I don't know any of the details")
> ...


More information about the Python-Dev mailing list