Why no "def A.f (...)"?

Skip Montanaro skip at mojam.com
Wed Aug 18 18:43:25 CEST 1999


    Stefan> Are there sensible reasons (performance, anomalies..) why
    Stefan> function definition is restricted to creating new identifiers in
    Stefan> the current namespace?

The only obvious reasons I can see are

    a. it's perhaps poor taste to add functions to another module (granted,
       no worse taste than adding any other kind of object to another module)
    b. it's easily done with a def following by an assignment statement
    c. it hasn't been considered important enough to warrant modifying the
       grammar

Skip Montanaro	| http://www.mojam.com/
skip at mojam.com  | http://www.musi-cal.com/~skip/
847-971-7098




More information about the Python-list mailing list