[Python-ideas] About calling syntax

Zaur Shibzoukhov szport at gmail.com
Tue Sep 9 17:16:08 CEST 2008


Suppose I define a class:

class Foo(object):
   #
   children = []
   #
   def __init__(self, *args, **kw):
      if kw:
         self.__dict__.update(kw)
      if args:
         self.chidlren = list(args)

In current syntax I have to write the folowing "initialization" code:

foo = \
   Foo(
      Foo(
         Foo(x=3,y=4),
         Foo(x=5,y=6),
         x=4, y=5
      ),
      x=1, y=2
   )

I can't write this code as follows (it seems more natural for me):

foo = \
   Foo(
      x=1, y=2,
      Foo(
         x=4, y=5,
         Foo(x=3,y=4),
         Foo(x=5,y=6))
      )
   )

Would be desirable to allow two equivalent forms of calling syntax in python:

<caller>(<positional_arguments>, <keyword_arguments>)

and

<caller>(<keyword_arguments>, <positional_arguments>)

?

Best regards,
Zaur



More information about the Python-ideas mailing list