Re: I'm faint why this can't work

2007-02-16 Thread JStoneGT
> Hello, > I got this similar sample script from books: > $ cat sampdict.py > #!/usr/bin/python > class SampDict(dict): > def __init__(self, filename=None): > self["name"] = filename > Are you sure you copied it exactly as it appears? Where did you find it? Thank you for the help,Gabri

I'm faint why this can't work

2007-02-15 Thread JStoneGT
Hello, I got this similar sample script from books: $ cat sampdict.py #!/usr/bin/python class SampDict(dict): def __init__(self, filename=None): self["name"] = filename But when I run it I got the errors: >>> from sampdict import SampDict >>> SampDict("/etc/passwd") Traceback (mo

Please help about an instance var

2007-02-13 Thread JStoneGT
>>> from UserDict import UserDict >>> d = {1:2,3:4,5:6} >>> d1 = UserDict(d) >>> d1 {1: 2, 3: 4, 5: 6} >>> d1.data {1: 2, 3: 4, 5: 6} Here why both d1 and d1.data have the same values?As shown below,they're different types. >>> type(d1) >>> type(d1.data) Please help.Thanks! -- http

Re: Newbie question about Class

2007-02-13 Thread JStoneGT
Thanks a lot.I've got it. En Tue, 13 Feb 2007 13:01:59 -0300, <[EMAIL PROTECTED]> escribió: > But I'm still confused that what's the "real dictionary"?I can't know > this > point.Please help and thanks again. I'm talking about a Python dictionary (a "real" one, as opposed to UserDic

Re: Newbie question about Class

2007-02-13 Thread JStoneGT
[quote]The idea behind that class is to act "as-if" it were a real dictionary. Dicts have an update method, and UserDict should too. But it's not listed in the book (should appear a few lines below that code); this is a possible implementation: def update(self, other): for key in ot

Newbie question about Class

2007-02-12 Thread JStoneGT
I'm reading the book of "Dive into Python" and got these code pieces: class UserDict: def __init__(self, dict=None): self.data = {} if dict is not None: self.update(dict) My question is,for the statement of: if dict is not None: self.update(dic

sort sort sort

2007-02-12 Thread JStoneGT
I do need sorting a dict via its values. Please help give some reference or code samples. Thanks. -- http://mail.python.org/mailman/listinfo/python-list

Socket and array

2007-02-07 Thread JStoneGT
Hello, How to send an array via socket to the other end?Thanks. -- http://mail.python.org/mailman/listinfo/python-list

Re: python for web programming

2007-02-07 Thread JStoneGT
Thanks a lot. -- http://mail.python.org/mailman/listinfo/python-list

python for web programming

2007-02-05 Thread JStoneGT
hello, Can you show me some reference datas for python web programming?Thanks. -- http://mail.python.org/mailman/listinfo/python-list