There has been support for evaluating all early-bound defaults before
all late-bound defaults. I have been persuaded that this is a
reasonable option.
How could that be avoided? by definition, early bound is evaluated "earlier" than late-bound :-)
early-bound (i.e. regular) parameters are evaluated at function definition time. But the time we get to the late-bound ones, those are actual values, not expressions.
The interpreter could notice that early bound names are used in late-bound expressions and raise an error, but if not, there'd be no issue with when they were evaluated.
This could cause a bit of confusion with "getting" that it's not a simple left-to-right rule, but that's the same potential confusion with early vs late bound parameters anyway.
-CHB
-- Christopher Barker, PhD (Chris)
Python Language Consulting
- Teaching
- Scientific Software Development
- Desktop GUI and Web Development
- wxPython, numpy, scipy, Cython