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

Stefan Franke spamfranke at bigfoot.de
Wed Aug 18 19:24:23 CEST 1999


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

An extended syntax 

  def A.B.f (self, x):
    <body>

with semantics like

  setattr (A.B, "f", lambda self, x: <body>)

would be the most straight forward solution for my current problem,
creating classes at runtime. -- OK, of course there are *lots* of 
other ways to do this, but it would also make the language a 
little bit more homogenous IMHO.

Does anyone else see a use for this?

Stefan





More information about the Python-list mailing list