Language question

Aahz Maruch aahz at netcom.com
Tue Oct 19 20:03:08 EDT 1999


In article <380CE825.7676C6F3 at bioreason.com>,
Brian Kelley  <kelley at bioreason.com> wrote:
>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.

In addition to Gordon's comments, note very carefully that you have two
different "foo" here.  This would be perfectly legal, for example:

class foo:
  pass
def bar(foo):
  return foo*2
print bar(2)
--
                      --- Aahz (@netcom.com)

Androgynous poly kinky vanilla queer het    <*>      http://www.rahul.net/aahz/
Hugs and backrubs -- I break Rule 6  (if you want to know, do some research)




More information about the Python-list mailing list