functions, list, default parameters
Mark Wooding
mdw at distorted.org.uk
Thu Nov 4 18:42:00 EDT 2010
Lawrence D'Oliveiro <ldo at geek-central.gen.new_zealand> writes:
> Mediocre programmers with a hankering towards cleverness latch onto it
> as an ingenious way of maintaing persistent context in-between calls
> to a function, completely overlooking the fact that Python offers much
> more straightforward, comprehensible, flexible, and above all
> maintainable ways of doing that sort of thing.
It does nowadays. Once upon a time, Python didn't have proper closures,
and argument defaults, evaluated at function-definition time, were the
only way of capturing data from the surrounding environment. You may be
confusing `mediocre' with `old-fashioned', and `a hankering towards
cleverness' with `wanting to run code on old Python interpreters'. This
last may be because the relevant code was written back when those `old'
interpreters were shiny and new.
-- [mdw]
More information about the Python-list
mailing list