Please explain this python behavior

Posted by StackUnderflow on Stack Overflow See other posts from Stack Overflow or by StackUnderflow
Published on 2010-04-01T03:00:54Z Indexed on 2010/04/01 3:03 UTC
Read the original article Hit count: 346

Filed under:
|
class SomeClass(object):
    def __init__(self, key_text_pairs = None):
        .....
        for key, text in key_text_pairs:
            ......
            ......

x = SomeClass([1, 2, 3])

The value of key_text_pairs inside the init is None even if I pass a list as in the above statement. Why is it so??

I want to write a generic init which can take all iterator objects...

Thanks

© Stack Overflow or respective owner

Related posts about python

Related posts about initialization