[ python-Bugs-1157576 ] pickle errors
Bugs item #1157576, was opened at 2005-03-05 23:31 Message generated for change (Comment added) made by tim_one You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=105470&aid=1157576&group_id=5470 Category: Python Library >Group: Not a Bug >Status: Closed >Resolution: Invalid Priority: 5 Submitted By: Laxori666 (laxori666) Assigned to: Nobody/Anonymous (nobody) Summary: pickle errors Initial Comment: pickle is giving me an error while I'm trying to serialize a dictionary. Here is the dictionary: >>> a {' ': (0, 2), '(': (858, 10), ',': (480, 9), '0': (327, 9), '4': (1393, 11), '8': (1396, 11), '@': (3496, 13), 'D': (212, 8), 'H': (1749, 12), 'L': (328, 9), 'P': (344, 9), 'T': (215, 8), 'X': (4041, 12), '\': (859, 10), 'd': (16, 5), 'h': (61, 6), 'l': (17, 5), 'p': (19, 6), 't': (5, 4), 'x': (83, 7), '#': (2632, 12), "'": (330, 9), '+': (2633, 12), '/': (160, 8), '3': (697, 10), '7': (2796, 12), '?': (2634, 12), 'C': (175, 8), 'G': (659, 10), 'K': (5571, 13), 'O': (173, 8), 'S': (241, 8), 'W': (662, 10), '[': (144, 9), 'c': (8, 5), 'g': (127, 7), 'k': (161, 8), 'o': (9, 4), 's': (22, 5), 'w': (104, 7), '\n': (14, 5), '"': (162, 8), '.': (26, 6), '2': (219, 9), '6': (1399, 11), ':': (253, 8), 'B': (108, 8), 'F': (426, 9), 'J': (3497, 13), 'N': (146, 9), 'R': (326, 9), 'V': (875, 11), 'Z': (8080, 13), 'b': (105, 7), 'f': (42, 6), '\xe9': (5570, 13), 'j': (8081, 13), 'n': (27, 5), 'r': (23, 5), 'v': (37, 7), 'z': (663, 10), '~': (2635, 12), '\t': (2021, 11), '!': (1397, 11), '%': (2784, 12), ')': (1008, 10), '-': (55, 7), '1': (1009, 10), '5': (4046, 12), '9': (2797, 12), '=': (15, 5), 'A': (428, 9), 'E': (147, 9), 'I': (481, 9), 'M': (427, 9), 'Q': (436, 10), 'U': (345, 9), 'Y': (2022, 11), ']': (145, 9), 'a': (29, 5), 'e': (12, 4), 'i': (28, 5), 'm': (62, 6), 'q': (4047, 12), 'u': (12, 5), 'y': (121, 7)} Here is the series of commands I issue, resulting in an error: >>> afile = open("afile", "wb") >>> p=pickle.Pickler(afile) >>> p.save(a) >>> afile.close() >>> afile = open("afile", "rb") >>> p=pickle.Unpickler(afile) >>> a2 = p.load() Traceback (most recent call last): File "", line 1, in ? a2 = p.load() File "H:\Python24\lib\pickle.py", line 872, in load dispatch[key](self) File "H:\Python24\lib\pickle.py", line 894, in load_eof raise EOFError EOFError Am I doing something wrong or is this pickle's fault? -- >Comment By: Tim Peters (tim_one) Date: 2005-03-06 01:41 Message: Logged In: YES user_id=31435 No problem -- thanks for the followup! I'll close this now. If you ever want to subclass Pickler, then studying the source for save() may be helpful. Otherwise it's best avoided. -- Comment By: Laxori666 (laxori666) Date: 2005-03-06 00:57 Message: Logged In: YES user_id=1209371 Oh, silly me. I should've noticed something was strange when cPickle didn't have a save method. I don't know, I must've stumbled into it and thought it was the right one. Thanks for your help. -- Comment By: Tim Peters (tim_one) Date: 2005-03-06 00:04 Message: Logged In: YES user_id=31435 I'm confused by why you're using the Pickler.save() method. That's an internal method, not even documented. If you use the documented Pickler.dump() method instead, this should work fine with pickle.py. There's no guarantee about the size or content of pickle strings, BTW, and cPickle does play tricks not available to pickle.py. -- Comment By: Laxori666 (laxori666) Date: 2005-03-05 23:34 Message: Logged In: YES user_id=1209371 NOTE: doing this using cPickle works without a problem. Also note that the file is 2KB smaller under cPickle. If they are supposed to be using the same stream, I think that is a problem (the same protocol argument was used for both) -- You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=105470&aid=1157576&group_id=5470 ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[ python-Bugs-1157576 ] pickle errors
Bugs item #1157576, was opened at 2005-03-05 23:31 Message generated for change (Comment added) made by laxori666 You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=105470&aid=1157576&group_id=5470 Category: Python Library Group: Python 2.4 Status: Open Resolution: None Priority: 5 Submitted By: Laxori666 (laxori666) Assigned to: Nobody/Anonymous (nobody) Summary: pickle errors Initial Comment: pickle is giving me an error while I'm trying to serialize a dictionary. Here is the dictionary: >>> a {' ': (0, 2), '(': (858, 10), ',': (480, 9), '0': (327, 9), '4': (1393, 11), '8': (1396, 11), '@': (3496, 13), 'D': (212, 8), 'H': (1749, 12), 'L': (328, 9), 'P': (344, 9), 'T': (215, 8), 'X': (4041, 12), '\': (859, 10), 'd': (16, 5), 'h': (61, 6), 'l': (17, 5), 'p': (19, 6), 't': (5, 4), 'x': (83, 7), '#': (2632, 12), "'": (330, 9), '+': (2633, 12), '/': (160, 8), '3': (697, 10), '7': (2796, 12), '?': (2634, 12), 'C': (175, 8), 'G': (659, 10), 'K': (5571, 13), 'O': (173, 8), 'S': (241, 8), 'W': (662, 10), '[': (144, 9), 'c': (8, 5), 'g': (127, 7), 'k': (161, 8), 'o': (9, 4), 's': (22, 5), 'w': (104, 7), '\n': (14, 5), '"': (162, 8), '.': (26, 6), '2': (219, 9), '6': (1399, 11), ':': (253, 8), 'B': (108, 8), 'F': (426, 9), 'J': (3497, 13), 'N': (146, 9), 'R': (326, 9), 'V': (875, 11), 'Z': (8080, 13), 'b': (105, 7), 'f': (42, 6), '\xe9': (5570, 13), 'j': (8081, 13), 'n': (27, 5), 'r': (23, 5), 'v': (37, 7), 'z': (663, 10), '~': (2635, 12), '\t': (2021, 11), '!': (1397, 11), '%': (2784, 12), ')': (1008, 10), '-': (55, 7), '1': (1009, 10), '5': (4046, 12), '9': (2797, 12), '=': (15, 5), 'A': (428, 9), 'E': (147, 9), 'I': (481, 9), 'M': (427, 9), 'Q': (436, 10), 'U': (345, 9), 'Y': (2022, 11), ']': (145, 9), 'a': (29, 5), 'e': (12, 4), 'i': (28, 5), 'm': (62, 6), 'q': (4047, 12), 'u': (12, 5), 'y': (121, 7)} Here is the series of commands I issue, resulting in an error: >>> afile = open("afile", "wb") >>> p=pickle.Pickler(afile) >>> p.save(a) >>> afile.close() >>> afile = open("afile", "rb") >>> p=pickle.Unpickler(afile) >>> a2 = p.load() Traceback (most recent call last): File "", line 1, in ? a2 = p.load() File "H:\Python24\lib\pickle.py", line 872, in load dispatch[key](self) File "H:\Python24\lib\pickle.py", line 894, in load_eof raise EOFError EOFError Am I doing something wrong or is this pickle's fault? -- >Comment By: Laxori666 (laxori666) Date: 2005-03-06 00:57 Message: Logged In: YES user_id=1209371 Oh, silly me. I should've noticed something was strange when cPickle didn't have a save method. I don't know, I must've stumbled into it and thought it was the right one. Thanks for your help. -- Comment By: Tim Peters (tim_one) Date: 2005-03-06 00:04 Message: Logged In: YES user_id=31435 I'm confused by why you're using the Pickler.save() method. That's an internal method, not even documented. If you use the documented Pickler.dump() method instead, this should work fine with pickle.py. There's no guarantee about the size or content of pickle strings, BTW, and cPickle does play tricks not available to pickle.py. -- Comment By: Laxori666 (laxori666) Date: 2005-03-05 23:34 Message: Logged In: YES user_id=1209371 NOTE: doing this using cPickle works without a problem. Also note that the file is 2KB smaller under cPickle. If they are supposed to be using the same stream, I think that is a problem (the same protocol argument was used for both) -- You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=105470&aid=1157576&group_id=5470 ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[ python-Bugs-1157576 ] pickle errors
Bugs item #1157576, was opened at 2005-03-05 23:31 Message generated for change (Comment added) made by tim_one You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=105470&aid=1157576&group_id=5470 Category: Python Library Group: Python 2.4 Status: Open Resolution: None Priority: 5 Submitted By: Laxori666 (laxori666) Assigned to: Nobody/Anonymous (nobody) Summary: pickle errors Initial Comment: pickle is giving me an error while I'm trying to serialize a dictionary. Here is the dictionary: >>> a {' ': (0, 2), '(': (858, 10), ',': (480, 9), '0': (327, 9), '4': (1393, 11), '8': (1396, 11), '@': (3496, 13), 'D': (212, 8), 'H': (1749, 12), 'L': (328, 9), 'P': (344, 9), 'T': (215, 8), 'X': (4041, 12), '\': (859, 10), 'd': (16, 5), 'h': (61, 6), 'l': (17, 5), 'p': (19, 6), 't': (5, 4), 'x': (83, 7), '#': (2632, 12), "'": (330, 9), '+': (2633, 12), '/': (160, 8), '3': (697, 10), '7': (2796, 12), '?': (2634, 12), 'C': (175, 8), 'G': (659, 10), 'K': (5571, 13), 'O': (173, 8), 'S': (241, 8), 'W': (662, 10), '[': (144, 9), 'c': (8, 5), 'g': (127, 7), 'k': (161, 8), 'o': (9, 4), 's': (22, 5), 'w': (104, 7), '\n': (14, 5), '"': (162, 8), '.': (26, 6), '2': (219, 9), '6': (1399, 11), ':': (253, 8), 'B': (108, 8), 'F': (426, 9), 'J': (3497, 13), 'N': (146, 9), 'R': (326, 9), 'V': (875, 11), 'Z': (8080, 13), 'b': (105, 7), 'f': (42, 6), '\xe9': (5570, 13), 'j': (8081, 13), 'n': (27, 5), 'r': (23, 5), 'v': (37, 7), 'z': (663, 10), '~': (2635, 12), '\t': (2021, 11), '!': (1397, 11), '%': (2784, 12), ')': (1008, 10), '-': (55, 7), '1': (1009, 10), '5': (4046, 12), '9': (2797, 12), '=': (15, 5), 'A': (428, 9), 'E': (147, 9), 'I': (481, 9), 'M': (427, 9), 'Q': (436, 10), 'U': (345, 9), 'Y': (2022, 11), ']': (145, 9), 'a': (29, 5), 'e': (12, 4), 'i': (28, 5), 'm': (62, 6), 'q': (4047, 12), 'u': (12, 5), 'y': (121, 7)} Here is the series of commands I issue, resulting in an error: >>> afile = open("afile", "wb") >>> p=pickle.Pickler(afile) >>> p.save(a) >>> afile.close() >>> afile = open("afile", "rb") >>> p=pickle.Unpickler(afile) >>> a2 = p.load() Traceback (most recent call last): File "", line 1, in ? a2 = p.load() File "H:\Python24\lib\pickle.py", line 872, in load dispatch[key](self) File "H:\Python24\lib\pickle.py", line 894, in load_eof raise EOFError EOFError Am I doing something wrong or is this pickle's fault? -- >Comment By: Tim Peters (tim_one) Date: 2005-03-06 00:04 Message: Logged In: YES user_id=31435 I'm confused by why you're using the Pickler.save() method. That's an internal method, not even documented. If you use the documented Pickler.dump() method instead, this should work fine with pickle.py. There's no guarantee about the size or content of pickle strings, BTW, and cPickle does play tricks not available to pickle.py. -- Comment By: Laxori666 (laxori666) Date: 2005-03-05 23:34 Message: Logged In: YES user_id=1209371 NOTE: doing this using cPickle works without a problem. Also note that the file is 2KB smaller under cPickle. If they are supposed to be using the same stream, I think that is a problem (the same protocol argument was used for both) -- You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=105470&aid=1157576&group_id=5470 ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[ python-Bugs-1157576 ] pickle errors
Bugs item #1157576, was opened at 2005-03-05 23:31 Message generated for change (Comment added) made by laxori666 You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=105470&aid=1157576&group_id=5470 Category: Python Library Group: Python 2.4 Status: Open Resolution: None Priority: 5 Submitted By: Laxori666 (laxori666) Assigned to: Nobody/Anonymous (nobody) Summary: pickle errors Initial Comment: pickle is giving me an error while I'm trying to serialize a dictionary. Here is the dictionary: >>> a {' ': (0, 2), '(': (858, 10), ',': (480, 9), '0': (327, 9), '4': (1393, 11), '8': (1396, 11), '@': (3496, 13), 'D': (212, 8), 'H': (1749, 12), 'L': (328, 9), 'P': (344, 9), 'T': (215, 8), 'X': (4041, 12), '\': (859, 10), 'd': (16, 5), 'h': (61, 6), 'l': (17, 5), 'p': (19, 6), 't': (5, 4), 'x': (83, 7), '#': (2632, 12), "'": (330, 9), '+': (2633, 12), '/': (160, 8), '3': (697, 10), '7': (2796, 12), '?': (2634, 12), 'C': (175, 8), 'G': (659, 10), 'K': (5571, 13), 'O': (173, 8), 'S': (241, 8), 'W': (662, 10), '[': (144, 9), 'c': (8, 5), 'g': (127, 7), 'k': (161, 8), 'o': (9, 4), 's': (22, 5), 'w': (104, 7), '\n': (14, 5), '"': (162, 8), '.': (26, 6), '2': (219, 9), '6': (1399, 11), ':': (253, 8), 'B': (108, 8), 'F': (426, 9), 'J': (3497, 13), 'N': (146, 9), 'R': (326, 9), 'V': (875, 11), 'Z': (8080, 13), 'b': (105, 7), 'f': (42, 6), '\xe9': (5570, 13), 'j': (8081, 13), 'n': (27, 5), 'r': (23, 5), 'v': (37, 7), 'z': (663, 10), '~': (2635, 12), '\t': (2021, 11), '!': (1397, 11), '%': (2784, 12), ')': (1008, 10), '-': (55, 7), '1': (1009, 10), '5': (4046, 12), '9': (2797, 12), '=': (15, 5), 'A': (428, 9), 'E': (147, 9), 'I': (481, 9), 'M': (427, 9), 'Q': (436, 10), 'U': (345, 9), 'Y': (2022, 11), ']': (145, 9), 'a': (29, 5), 'e': (12, 4), 'i': (28, 5), 'm': (62, 6), 'q': (4047, 12), 'u': (12, 5), 'y': (121, 7)} Here is the series of commands I issue, resulting in an error: >>> afile = open("afile", "wb") >>> p=pickle.Pickler(afile) >>> p.save(a) >>> afile.close() >>> afile = open("afile", "rb") >>> p=pickle.Unpickler(afile) >>> a2 = p.load() Traceback (most recent call last): File "", line 1, in ? a2 = p.load() File "H:\Python24\lib\pickle.py", line 872, in load dispatch[key](self) File "H:\Python24\lib\pickle.py", line 894, in load_eof raise EOFError EOFError Am I doing something wrong or is this pickle's fault? -- >Comment By: Laxori666 (laxori666) Date: 2005-03-05 23:34 Message: Logged In: YES user_id=1209371 NOTE: doing this using cPickle works without a problem. Also note that the file is 2KB smaller under cPickle. If they are supposed to be using the same stream, I think that is a problem (the same protocol argument was used for both) -- You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=105470&aid=1157576&group_id=5470 ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[ python-Bugs-1157576 ] pickle errors
Bugs item #1157576, was opened at 2005-03-05 23:31 Message generated for change (Tracker Item Submitted) made by Item Submitter You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=105470&aid=1157576&group_id=5470 Category: Python Library Group: Python 2.4 Status: Open Resolution: None Priority: 5 Submitted By: Laxori666 (laxori666) Assigned to: Nobody/Anonymous (nobody) Summary: pickle errors Initial Comment: pickle is giving me an error while I'm trying to serialize a dictionary. Here is the dictionary: >>> a {' ': (0, 2), '(': (858, 10), ',': (480, 9), '0': (327, 9), '4': (1393, 11), '8': (1396, 11), '@': (3496, 13), 'D': (212, 8), 'H': (1749, 12), 'L': (328, 9), 'P': (344, 9), 'T': (215, 8), 'X': (4041, 12), '\': (859, 10), 'd': (16, 5), 'h': (61, 6), 'l': (17, 5), 'p': (19, 6), 't': (5, 4), 'x': (83, 7), '#': (2632, 12), "'": (330, 9), '+': (2633, 12), '/': (160, 8), '3': (697, 10), '7': (2796, 12), '?': (2634, 12), 'C': (175, 8), 'G': (659, 10), 'K': (5571, 13), 'O': (173, 8), 'S': (241, 8), 'W': (662, 10), '[': (144, 9), 'c': (8, 5), 'g': (127, 7), 'k': (161, 8), 'o': (9, 4), 's': (22, 5), 'w': (104, 7), '\n': (14, 5), '"': (162, 8), '.': (26, 6), '2': (219, 9), '6': (1399, 11), ':': (253, 8), 'B': (108, 8), 'F': (426, 9), 'J': (3497, 13), 'N': (146, 9), 'R': (326, 9), 'V': (875, 11), 'Z': (8080, 13), 'b': (105, 7), 'f': (42, 6), '\xe9': (5570, 13), 'j': (8081, 13), 'n': (27, 5), 'r': (23, 5), 'v': (37, 7), 'z': (663, 10), '~': (2635, 12), '\t': (2021, 11), '!': (1397, 11), '%': (2784, 12), ')': (1008, 10), '-': (55, 7), '1': (1009, 10), '5': (4046, 12), '9': (2797, 12), '=': (15, 5), 'A': (428, 9), 'E': (147, 9), 'I': (481, 9), 'M': (427, 9), 'Q': (436, 10), 'U': (345, 9), 'Y': (2022, 11), ']': (145, 9), 'a': (29, 5), 'e': (12, 4), 'i': (28, 5), 'm': (62, 6), 'q': (4047, 12), 'u': (12, 5), 'y': (121, 7)} Here is the series of commands I issue, resulting in an error: >>> afile = open("afile", "wb") >>> p=pickle.Pickler(afile) >>> p.save(a) >>> afile.close() >>> afile = open("afile", "rb") >>> p=pickle.Unpickler(afile) >>> a2 = p.load() Traceback (most recent call last): File "", line 1, in ? a2 = p.load() File "H:\Python24\lib\pickle.py", line 872, in load dispatch[key](self) File "H:\Python24\lib\pickle.py", line 894, in load_eof raise EOFError EOFError Am I doing something wrong or is this pickle's fault? -- You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=105470&aid=1157576&group_id=5470 ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[ python-Bugs-818006 ] ossaudiodev FileObject does not support closed const
Bugs item #818006, was opened at 2003-10-05 02:30 Message generated for change (Comment added) made by tjreedy You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=105470&aid=818006&group_id=5470 Category: Extension Modules Group: Python 2.4 Status: Open Resolution: None Priority: 5 Submitted By: Dave Cinege (dcinege) Assigned to: Greg Ward (gward) Summary: ossaudiodev FileObject does not support closed const Initial Comment: fin = ossaudiodev.open(dspfile, 'r') if fin.closed == True: AttributeError: closed -- Comment By: Terry J. Reedy (tjreedy) Date: 2005-03-05 15:48 Message: Logged In: YES user_id=593130 I am not sure who your last comment is aimed at. As near as I can tell, Greg merely updated the group to Py2.4, implying that this issue is still relevant. In Pythonese, should is advisory; only must is mandatory. So I see this as a request for a pre-approved enhancement. Since ossaudiodevice directly wraps an OS open file descripter, rather than a Python file object, the patch is more than a triviality. -- Comment By: Dave Cinege (dcinege) Date: 2005-03-05 13:08 Message: Logged In: YES user_id=314434 That was the point of the bug report. It has no closed or other file-like attributes. According the python docs then and current: 'File objects also offer a number of other interesting attributes. These are not required for file-like objects, but should be implemented if they make sense for the particular object. ' I take that to mean these attributes are mandatory, unless it does not make sense to implement them. In the case of file-like Audio Device Objects, they make sense, and thus should be there. Either this statement of file-like object policy is a bug, or the lack of such attributes in Audio Device Objects is a bug. -- Comment By: Dave Cinege (dcinege) Date: 2003-10-05 16:32 Message: Logged In: YES user_id=314434 Please see: http://python.org/doc/current/lib/bltin-file-objects.html """ File objects also offer a number of other interesting attributes. These are not required for file-like objects, but should be implemented if they make sense for the particular object. "" "Should be" when they "make sense" is my rational for reporting this as a bug. I found this by trying to convert existing code from a normal open of /dev/dsp to ossaudiodev.open(), that IMO "should" have worked. : P Other attributes that "should be" implemented (mode and name) because they "make sense" may also be missing...I haven't checked. -- Comment By: Terry J. Reedy (tjreedy) Date: 2003-10-05 16:16 Message: Logged In: YES user_id=593130 >From Lib Ref 14.11 ossaudiodev "open( [device, ]mode) Open an audio device and return an OSS audio device object. " Checking http://python.org/doc/current/lib/ossaudio-device- objects.html 14.11.1 Audio Device Objects I can find no mention of closed attribute or indeed of any attributes other than methods. Why were you expecting such? If report is a mistake, please close. -- You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=105470&aid=818006&group_id=5470 ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[ python-Bugs-1156412 ] add documentation for __new__
Bugs item #1156412, was opened at 2005-03-03 20:00 Message generated for change (Comment added) made by bediviere You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=105470&aid=1156412&group_id=5470 Category: Documentation Group: Python 2.5 Status: Open Resolution: None Priority: 5 Submitted By: Steven Bethard (bediviere) Assigned to: Nobody/Anonymous (nobody) Summary: add documentation for __new__ Initial Comment: 3.3.1 Basic customization does not document __new__. Proposed addition: __new__(cls[, ...]) Called to create a new instance of the class. __new__ is a staticmethod (special-cased so you need not declare it as such) that takes the class to be created as the first argument. The remaining arguments are those passed to the class constructor expression. The return value of __new__ should be the new object instance. Typical usage is to create a new instance of the class by invoking the superclass's __new__ method using "super(BaseClass, cls).__new__([...])" with appropriate arguments, modifying the returned instance if necessary, and then returning it. If the returned value is an instance of "cls" (the first argument to __new__), its __init__ will be invoked. Note that you need not return an instance of "cls", but if you don't, the new instance's __init__ method will not be invoked. The __new__ staticmethod is intended mainly to allow modification of immutable types like int, long, float, str and tuple. -- >Comment By: Steven Bethard (bediviere) Date: 2005-03-05 13:30 Message: Logged In: YES user_id=945502 Looks pretty good to me. Only one change: "super(currentclass, cls).__new__([...])" should look like: "super(currentclass, cls).__new__(cls[, ...])" Sorry I didn't catch this earlier. But, since it's a staticmethod, of course you need to pass 'cls' manually. -- Comment By: Greg Ward (gward) Date: 2005-03-05 09:34 Message: Logged In: YES user_id=14422 Here's an alternative text -- a bit tighter, hopefully a tad more accurate and clearer: __new__(cls[, ...]) Called to create a new instance of class 'cls'. __new__() is a static method (special-cased so you need not declare it as such) that takes the class to create an instance of as the first argument. The remaining arguments are those passed to the object constructor expression. The return value of __new__() should be the new object instance. Typical usage is to create a new instance of the class by invoking the superclass's __new__() method using "super(currentclass, cls).__new__([...])" with appropriate arguments, modifying the returned instance if necessary, and then returning it. If the returned value is an instance of 'cls', its __init__() will be invoked like "__init__(self[, ...])", where the extra arguments are the same as were passed to __new__(). You do need not to return an instance of 'cls', but if you do not, the new instance's __init__() method will not be invoked. __new__() is intended mainly to allow subclasses of immutable types (like int, str, or tuple) to customize instance creation. -- Comment By: Greg Ward (gward) Date: 2005-03-05 09:11 Message: Logged In: YES user_id=14422 I think that last paragraph can be written even more concisely: "The __new__ staticmethod is intended mainly to allow subclasses of immutable types (like int, str, or tuple) to customize instance creation." Also, the usual convention when talking about methods and functions is to write "__new__()", not "__new__". At least that's how the 2.3.3 language ref which I have on my PC looks. Finally, this bug is in the "Python 2.5" group -- surely there's no harm in checking this in to the 2.4 docs and merging forward? -- Comment By: Nick Coghlan (ncoghlan) Date: 2005-03-04 21:02 Message: Logged In: YES user_id=1038590 Close, but the phrasing's a bit awkward. Getting rid of the commas seems to fix that: "The __new__ staticmethod is intended mainly to allow you to customize instance creation in a subclass of an immutable type (like int, long, float, complex, str, unicode, or tuple)." -- Comment By: Steven Bethard (bediviere) Date: 2005-03-04 13:19 Message: Logged In: YES user_id=945502 Good point. How about: "The __new__ staticmethod is intended mainly to allow you, in a subclass of an immutable type (like int, long, float, complex, str, unicode, or tuple), to customize instance creation." -- Comment By: Oren Tirosh (orenti) Date: 2005-03-04 11:05 Message: Logged In: YES user_id=562624 "The __new__ staticmethod is intended mainly to allow modification of immutable types like
[ python-Bugs-818006 ] ossaudiodev FileObject does not support closed const
Bugs item #818006, was opened at 2003-10-05 02:30 Message generated for change (Comment added) made by dcinege You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=105470&aid=818006&group_id=5470 Category: Extension Modules Group: Python 2.4 Status: Open Resolution: None Priority: 5 Submitted By: Dave Cinege (dcinege) Assigned to: Greg Ward (gward) Summary: ossaudiodev FileObject does not support closed const Initial Comment: fin = ossaudiodev.open(dspfile, 'r') if fin.closed == True: AttributeError: closed -- >Comment By: Dave Cinege (dcinege) Date: 2005-03-05 13:08 Message: Logged In: YES user_id=314434 That was the point of the bug report. It has no closed or other file-like attributes. According the python docs then and current: 'File objects also offer a number of other interesting attributes. These are not required for file-like objects, but should be implemented if they make sense for the particular object. ' I take that to mean these attributes are mandatory, unless it does not make sense to implement them. In the case of file-like Audio Device Objects, they make sense, and thus should be there. Either this statement of file-like object policy is a bug, or the lack of such attributes in Audio Device Objects is a bug. -- Comment By: Dave Cinege (dcinege) Date: 2003-10-05 16:32 Message: Logged In: YES user_id=314434 Please see: http://python.org/doc/current/lib/bltin-file-objects.html """ File objects also offer a number of other interesting attributes. These are not required for file-like objects, but should be implemented if they make sense for the particular object. "" "Should be" when they "make sense" is my rational for reporting this as a bug. I found this by trying to convert existing code from a normal open of /dev/dsp to ossaudiodev.open(), that IMO "should" have worked. : P Other attributes that "should be" implemented (mode and name) because they "make sense" may also be missing...I haven't checked. -- Comment By: Terry J. Reedy (tjreedy) Date: 2003-10-05 16:16 Message: Logged In: YES user_id=593130 >From Lib Ref 14.11 ossaudiodev "open( [device, ]mode) Open an audio device and return an OSS audio device object. " Checking http://python.org/doc/current/lib/ossaudio-device- objects.html 14.11.1 Audio Device Objects I can find no mention of closed attribute or indeed of any attributes other than methods. Why were you expecting such? If report is a mistake, please close. -- You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=105470&aid=818006&group_id=5470 ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[ python-Bugs-1156412 ] add documentation for __new__
Bugs item #1156412, was opened at 2005-03-03 22:00 Message generated for change (Comment added) made by gward You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=105470&aid=1156412&group_id=5470 Category: Documentation Group: Python 2.5 Status: Open Resolution: None Priority: 5 Submitted By: Steven Bethard (bediviere) Assigned to: Nobody/Anonymous (nobody) Summary: add documentation for __new__ Initial Comment: 3.3.1 Basic customization does not document __new__. Proposed addition: __new__(cls[, ...]) Called to create a new instance of the class. __new__ is a staticmethod (special-cased so you need not declare it as such) that takes the class to be created as the first argument. The remaining arguments are those passed to the class constructor expression. The return value of __new__ should be the new object instance. Typical usage is to create a new instance of the class by invoking the superclass's __new__ method using "super(BaseClass, cls).__new__([...])" with appropriate arguments, modifying the returned instance if necessary, and then returning it. If the returned value is an instance of "cls" (the first argument to __new__), its __init__ will be invoked. Note that you need not return an instance of "cls", but if you don't, the new instance's __init__ method will not be invoked. The __new__ staticmethod is intended mainly to allow modification of immutable types like int, long, float, str and tuple. -- >Comment By: Greg Ward (gward) Date: 2005-03-05 11:34 Message: Logged In: YES user_id=14422 Here's an alternative text -- a bit tighter, hopefully a tad more accurate and clearer: __new__(cls[, ...]) Called to create a new instance of class 'cls'. __new__() is a static method (special-cased so you need not declare it as such) that takes the class to create an instance of as the first argument. The remaining arguments are those passed to the object constructor expression. The return value of __new__() should be the new object instance. Typical usage is to create a new instance of the class by invoking the superclass's __new__() method using "super(currentclass, cls).__new__([...])" with appropriate arguments, modifying the returned instance if necessary, and then returning it. If the returned value is an instance of 'cls', its __init__() will be invoked like "__init__(self[, ...])", where the extra arguments are the same as were passed to __new__(). You do need not to return an instance of 'cls', but if you do not, the new instance's __init__() method will not be invoked. __new__() is intended mainly to allow subclasses of immutable types (like int, str, or tuple) to customize instance creation. -- Comment By: Greg Ward (gward) Date: 2005-03-05 11:11 Message: Logged In: YES user_id=14422 I think that last paragraph can be written even more concisely: "The __new__ staticmethod is intended mainly to allow subclasses of immutable types (like int, str, or tuple) to customize instance creation." Also, the usual convention when talking about methods and functions is to write "__new__()", not "__new__". At least that's how the 2.3.3 language ref which I have on my PC looks. Finally, this bug is in the "Python 2.5" group -- surely there's no harm in checking this in to the 2.4 docs and merging forward? -- Comment By: Nick Coghlan (ncoghlan) Date: 2005-03-04 23:02 Message: Logged In: YES user_id=1038590 Close, but the phrasing's a bit awkward. Getting rid of the commas seems to fix that: "The __new__ staticmethod is intended mainly to allow you to customize instance creation in a subclass of an immutable type (like int, long, float, complex, str, unicode, or tuple)." -- Comment By: Steven Bethard (bediviere) Date: 2005-03-04 15:19 Message: Logged In: YES user_id=945502 Good point. How about: "The __new__ staticmethod is intended mainly to allow you, in a subclass of an immutable type (like int, long, float, complex, str, unicode, or tuple), to customize instance creation." -- Comment By: Oren Tirosh (orenti) Date: 2005-03-04 13:05 Message: Logged In: YES user_id=562624 "The __new__ staticmethod is intended mainly to allow modification of immutable types like int, long, float, str and tuple." You might like to rephrase that. It gives the impression that __new__ somehow makes it possible to modify the value of an immutable object. In fact, it only allows customized creation of new instances. -- Comment By: Steven Bethard (bediviere) Date: 2005-03-04 11:11 Message: Logged In: YES user_id=945502 Yup, type_call in typeobject.c spec
[ python-Bugs-818006 ] ossaudiodev FileObject does not support closed const
Bugs item #818006, was opened at 2003-10-05 02:30 Message generated for change (Settings changed) made by gward You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=105470&aid=818006&group_id=5470 Category: Extension Modules >Group: Python 2.4 Status: Open Resolution: None Priority: 5 Submitted By: Dave Cinege (dcinege) Assigned to: Greg Ward (gward) Summary: ossaudiodev FileObject does not support closed const Initial Comment: fin = ossaudiodev.open(dspfile, 'r') if fin.closed == True: AttributeError: closed -- Comment By: Dave Cinege (dcinege) Date: 2003-10-05 16:32 Message: Logged In: YES user_id=314434 Please see: http://python.org/doc/current/lib/bltin-file-objects.html """ File objects also offer a number of other interesting attributes. These are not required for file-like objects, but should be implemented if they make sense for the particular object. "" "Should be" when they "make sense" is my rational for reporting this as a bug. I found this by trying to convert existing code from a normal open of /dev/dsp to ossaudiodev.open(), that IMO "should" have worked. : P Other attributes that "should be" implemented (mode and name) because they "make sense" may also be missing...I haven't checked. -- Comment By: Terry J. Reedy (tjreedy) Date: 2003-10-05 16:16 Message: Logged In: YES user_id=593130 >From Lib Ref 14.11 ossaudiodev "open( [device, ]mode) Open an audio device and return an OSS audio device object. " Checking http://python.org/doc/current/lib/ossaudio-device- objects.html 14.11.1 Audio Device Objects I can find no mention of closed attribute or indeed of any attributes other than methods. Why were you expecting such? If report is a mistake, please close. -- You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=105470&aid=818006&group_id=5470 ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[ python-Bugs-1156412 ] add documentation for __new__
Bugs item #1156412, was opened at 2005-03-03 22:00 Message generated for change (Comment added) made by gward You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=105470&aid=1156412&group_id=5470 Category: Documentation Group: Python 2.5 Status: Open Resolution: None Priority: 5 Submitted By: Steven Bethard (bediviere) Assigned to: Nobody/Anonymous (nobody) Summary: add documentation for __new__ Initial Comment: 3.3.1 Basic customization does not document __new__. Proposed addition: __new__(cls[, ...]) Called to create a new instance of the class. __new__ is a staticmethod (special-cased so you need not declare it as such) that takes the class to be created as the first argument. The remaining arguments are those passed to the class constructor expression. The return value of __new__ should be the new object instance. Typical usage is to create a new instance of the class by invoking the superclass's __new__ method using "super(BaseClass, cls).__new__([...])" with appropriate arguments, modifying the returned instance if necessary, and then returning it. If the returned value is an instance of "cls" (the first argument to __new__), its __init__ will be invoked. Note that you need not return an instance of "cls", but if you don't, the new instance's __init__ method will not be invoked. The __new__ staticmethod is intended mainly to allow modification of immutable types like int, long, float, str and tuple. -- >Comment By: Greg Ward (gward) Date: 2005-03-05 11:11 Message: Logged In: YES user_id=14422 I think that last paragraph can be written even more concisely: "The __new__ staticmethod is intended mainly to allow subclasses of immutable types (like int, str, or tuple) to customize instance creation." Also, the usual convention when talking about methods and functions is to write "__new__()", not "__new__". At least that's how the 2.3.3 language ref which I have on my PC looks. Finally, this bug is in the "Python 2.5" group -- surely there's no harm in checking this in to the 2.4 docs and merging forward? -- Comment By: Nick Coghlan (ncoghlan) Date: 2005-03-04 23:02 Message: Logged In: YES user_id=1038590 Close, but the phrasing's a bit awkward. Getting rid of the commas seems to fix that: "The __new__ staticmethod is intended mainly to allow you to customize instance creation in a subclass of an immutable type (like int, long, float, complex, str, unicode, or tuple)." -- Comment By: Steven Bethard (bediviere) Date: 2005-03-04 15:19 Message: Logged In: YES user_id=945502 Good point. How about: "The __new__ staticmethod is intended mainly to allow you, in a subclass of an immutable type (like int, long, float, complex, str, unicode, or tuple), to customize instance creation." -- Comment By: Oren Tirosh (orenti) Date: 2005-03-04 13:05 Message: Logged In: YES user_id=562624 "The __new__ staticmethod is intended mainly to allow modification of immutable types like int, long, float, str and tuple." You might like to rephrase that. It gives the impression that __new__ somehow makes it possible to modify the value of an immutable object. In fact, it only allows customized creation of new instances. -- Comment By: Steven Bethard (bediviere) Date: 2005-03-04 11:11 Message: Logged In: YES user_id=945502 Yup, type_call in typeobject.c special-cases this behavior. See also http://sourceforge.net/tracker/?func=detail&aid=1123716&group_id=5470&atid=105470 -- Comment By: Nick Coghlan (ncoghlan) Date: 2005-03-04 10:53 Message: Logged In: YES user_id=1038590 Looks reasonable to me - but does CPython actually currently follow those rules regarding when __init__ is and isn't invoked? -- You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=105470&aid=1156412&group_id=5470 ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[ python-Bugs-1157255 ] PEP 328 and Python 2.4 error
Bugs item #1157255, was opened at 2005-03-05 13:23 Message generated for change (Tracker Item Submitted) made by Item Submitter You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=105470&aid=1157255&group_id=5470 Category: None Group: None Status: Open Resolution: None Priority: 5 Submitted By: Kent Johnson (kjohnson) Assigned to: Nobody/Anonymous (nobody) Summary: PEP 328 and Python 2.4 error Initial Comment: PEP 328 says that from __future__ import absolute_import will be part of Python 2.4, but it is not: D:\Projects\CB>python Python 2.4 (#60, Nov 30 2004, 11:49:19) [MSC v.1310 32 bit (Intel)] on win32 Type "help", "copyright", "credits" or "license" for more information. >>> from __future__ import absolute_import File "", line 1 SyntaxError: future feature absolute_import is not defined The PEP should be updated to reflect this. -- You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=105470&aid=1157255&group_id=5470 ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[ python-Bugs-1157169 ] csv Sniffer returns bad dialect?
Bugs item #1157169, was opened at 2005-03-05 08:14 Message generated for change (Tracker Item Submitted) made by Item Submitter You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=105470&aid=1157169&group_id=5470 Category: Python Library Group: None Status: Open Resolution: None Priority: 5 Submitted By: Neil Schemenauer (nascheme) Assigned to: Nobody/Anonymous (nobody) Summary: csv Sniffer returns bad dialect? Initial Comment: >>> d = csv.Sniffer().sniff('abc', ['\t', ',']) >>> csv.reader(['abc'], d) Traceback (most recent call last): File "", line 1, in ? TypeError: bad argument type for built-in operation If the 'delimiters' argument to sniff() is left out then the TypeError is not raised. Not sure what's going on here. A few other nits: sniff() seems to be misdocumented. It cannot return None. What's the point of the Sniff class? Why isn't sniff() a module level function? The library manual does not state what the iterator returned by reader() returns. It should state that generates lists of strings. -- You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=105470&aid=1157169&group_id=5470 ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com