What could 'f(this:that=other):' mean?

Jonathan Fine jfine at pytex.org
Tue Jan 11 13:40:12 EST 2005


Nick Coghlan wrote:
> If the caller is meant to supply a namespace, get them to supply a 
> namespace.
> 
> def f(ns1, ns2):
>   print ns1['a'], ns1['b'], ns2['a'], ns2['b']
> 
> f(ns1 = dict(a=1, b=2), ns2 = dict(a=3, b=4))
> 
> Hey, where's Steve? Maybe his generic objects should be called 
> namespaces instead of bunches. . .
> 
> def f(ns1, ns2):
>   print ns1.a, ns1.b, ns2.a, ns2.b
> 
> f(ns1 = namespace(a=1, b=2), ns2 = namespace(a=3, b=4))


Basically, there are three main possibilities.

   f_1(ns1=dict(a=1, b=2), ns2=dict(a=3, b=4))
   f_2(ns1_a=1m, ns1_b=2, ns2_a=3, ns2_b=4)
   f_3(ns1:a=1m, ns1:b=2, ns2:a=3, ns2:b=4)

f_3 is the suggested extension to Python.
f_3 is similar to f_2 for the caller of f_3.
f_3 is similar to f_1 for the implementor of f_3.

Nick points out that a key issue is this:  Is the user meant
to supply arguments belonging to a namespace?

I'm not, at this time, wishing to promote my suggestion.
If I were, I would be well advised to find usage cases.

Rather, I simply wish to point out that the
   f(this:that=other)
syntax may have uses, other than optional static typing.

And this I've done.  So for me the thread is closed.


Jonathan







More information about the Python-list mailing list