Language question

Tim Peters tim_one at email.msn.com
Tue Oct 19 21:11:27 EDT 1999


[Brian Kelley]
> This question actually comes up due to accident (bug?)  Here is
> the scenario
>
> class foo:
>       """insert foo here"""
>
> def bar(foo):
>       """this should really be class bar(foo):  Insert bar
>       here"""
>
> As far as python is concerned, this is prefectly legal except
> that the user of bar will probably get None for their troubles.
> That is foobar = bar() is the same thing as foobar = None.
>
> My question is, is there any real reason to allow this? ...

[Gordon McMillan]
> What's to disallow? ...

After several readings, I believe Brian objects to Python allowing him to
reuse the name of a class as a formal argument name, in a context where
"class" in place of "def" would have been legal.  That is, he would like
Python to ignore what he typed and infer his intent <wink>.

wouldn't-we-all-ly y'rs  - tim






More information about the Python-list mailing list