__init__ question

Daniel Klein DanielK at aracnet.com
Mon Dec 25 16:37:20 EST 2000


Is this part of the syntax or is this a regular expression? I can't find
this anywhere in the online documentation or in any of the four Python books
I have purchased. :^(

Dan:


"Aahz Maruch" <aahz at panix.com> wrote in message
news:9285oj$6rh$1 at panix2.panix.com...
> In article <EvM16.270$LU6.118037 at typhoon.aracnet.com>,
> Daniel Klein <DanielK at aracnet.com> wrote:
> >
> >    def __init__(self, *args):
> >
> >What is the meaning of the '*args' expression?
>
> It means "accept any number of parameters here"; "args" is a tuple.  For
> example, I could create a print function instead of the blecherous
> redirected print statement as follows:
>
> def print (file=None, *args):
>     if not file:
>         file = sys.stdout
>     for arg in args:
>         file.write("%s " % arg)
>     file.write("\n")
> --
>                       --- Aahz (Copyright 2000 by aahz at pobox.com)
>
> Androgynous poly kinky vanilla queer het    <*>
http://www.rahul.net/aahz/
> Hugs and backrubs -- I break Rule 6
>
> '"Crisp" is a good quality for crackers; less so for pot roast.'  --pnh





More information about the Python-list mailing list