On Fri, Jun 11, 2021 at 10:01:06AM +1000, Cameron Simpson wrote:
> Another thing to keep in mind with any syntax suggestion (not that it
> applies well here, because really, what else can your suggestion mean?)
> it that every addition syntax is a detour into the unused space of
> possible token paths.
I'm not arguing for or against it, but parenthesis-free definitions
"could" mean something rather different, such as (let's say) a function
that uses dynamic scoping instead of lexical, and always gets its
arguments from the calling scope.
def func:
return min(a, 10)
# first caller
a = 5
print(func()) # --> 5
# second caller
def my_function():
a = 20
print(func())
my_function() # --> 10
If I wanted dynamic scopes, I wouldn't design the API that way. But we
could.
Another possibility would be computed values (sort of like properties):
def now:
return strftime('%H:%M:%S')
print(now) # --> 21:23:20
time.sleep(15)
print(now) # --> 21:23:35
The point here is to agree with Cameron that every time we choose to use
syntax for one thing, that precludes us from using that same syntax for
a different thing.
--
Steve
_______________________________________________
Python-ideas mailing list -- [email protected]
To unsubscribe send an email to [email protected]
https://mail.python.org/mailman3/lists/python-ideas.python.org/
Message archived at
https://mail.python.org/archives/list/[email protected]/message/HJAFAC4XCHNMH3KFQLPPWX5AVQXHYCCI/
Code of Conduct: http://python.org/psf/codeofconduct/