Modifying func_closure

Ville Vainio ville at spammers.com
Mon Jul 12 17:40:25 CEST 2004


>>>>> "Jacek" == Jacek Generowicz <jacek.generowicz at cern.ch> writes:

    Jacek> Ville Vainio <ville at spammers.com> writes:

    >> Closures are indeed much handier than classes for many
    >> "in-place", lightweight operations. Implementing a local class
    >> is often too heavyweight, esp. if the creator has to implement
    >> __init__ as well as another method that does useful work.

    Jacek> ... which is pretty much guaranteed ... if you didn't have
    Jacek> to implement __init__ then it wouldn't be a closure (unless
    Jacek> I'm missing some subtle variation on the theme).

Sorry, I meant if have_to_implement (__init__ AND other
method). Sometimes just __init__ will do, if the state is manipulated
directly via attributes.

    Jacek> Wow, if I hear any more of these comments, I might just
    Jacek> have to start thinking about considering to entertain the
    Jacek> possibility of maybe writing a PEP. (Do you note any
    Jacek> hesitation or reluctance on my part ?  :-)

PEP won't hurt. At least it would be a document about why the feature
was rejected, should such a thing happen ;-).

-- 
Ville Vainio   http://tinyurl.com/2prnb



More information about the Python-list mailing list