syntax question
Richard Brodie
R.Brodie at rl.ac.uk
Thu Nov 22 11:20:26 EST 2001
More information about the Python-list mailing list
Thu Nov 22 11:20:26 EST 2001
- Previous message (by thread): rlcompleter and emacs
- Next message (by thread): syntax question
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
"Rajarshi Guha" <rxg218 at psu.edu> wrote in message news:9tj7et$oi2 at r02n01.cac.psu.edu... > def V(*vals): > return array(vals) > > I can see that the *vals takes in a tuple - is this orrect or are there any > other significances of this sytnax? *vals swallows the end of an argument list and produces a tuple - so can be used for printf/stdarg like functions: saves some extra brackets. >>> def a(*vals): ... print vals ... >>> def b(vals): ... print vals ... >>> a(1,2,3) (1, 2, 3) >>> b(1,2,3) Traceback (most recent call last): File "<interactive input>", line 1, in ? TypeError: b() takes exactly 1 argument (3 given) >>> b((1,2,3)) (1, 2, 3)
- Previous message (by thread): rlcompleter and emacs
- Next message (by thread): syntax question
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
More information about the Python-list mailing list