[Python-ideas] Specifying constants for functions

Yury Selivanov yselivanov.ml at gmail.com
Tue Oct 27 15:47:02 EDT 2015



On 2015-10-27 3:02 PM, Bruce Leban wrote:
> It's not a micro-optimization in this case:
>
>     def foo(x, SENTINEL=object()):
>         ...
>
>
> I don't like mangling function signatures to do this. What I really 
> want is the equivalent of C's static here:
>
>     def foo(x):
>     static SENTINEL = object()
>         ...
>
>

Why not

SENTINEL=object()
def foo(x):
     ...

?

That's how I do it usually.

Yury


More information about the Python-ideas mailing list