__init__ question

Aahz Maruch aahz at panix.com
Mon Dec 25 14:04:51 EST 2000


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