[Python-Dev] PEP 457: Syntax For Positional-Only Parameters
Greg Ewing
greg.ewing at canterbury.ac.nz
Thu Oct 10 04:33:16 CEST 2013
On 10/10/13 09:51, Larry Hastings wrote:
> Perhaps we could add (egad, no, I can't believe I'm saying this) a new
> built-in function that tells you whether or not a local variable has been
> assigned to yet?
>
> def range([start,] stop, [step], /):
> if not bound(start):
> start = 0
> if not bound(step):
> step = 1
> ...
It couldn't be a function in the usual sense, because attempting to
evaluate the unbound parameter would raise an exception before the
function was called.
It would have to be something magical, probably a new piece of
syntax understood by the compiler.
--
Greg
More information about the Python-Dev
mailing list