Re: how to dynamically generate __name__ for an object?

2011-08-07 Thread Eric Snow
On Sat, Aug 6, 2011 at 10:47 PM, Steven D'Aprano steve+comp.lang.pyt...@pearwood.info wrote: Eric Snow wrote: Thought I knew how to provide a dynamic __name__ on instances of a class.  My first try was to use a non-data descriptor: Perhaps you should explain what you are trying to do. If you

Re: PEP 372 -- Adding an ordered directory to collections

2011-08-07 Thread Lucio Santi
Hi all, I'm a first-time writer here, so excuse me if I say something inappropriate or such. Last week, I was reviewing some Python 2.7 modules when I came across the OrderedDict data structure. After seeing its official implementation and also after reading through the corresponding PEP, I

Restricted attribute writing

2011-08-07 Thread John O'Hagan
I'm looking for good ways to ensure that attributes are only writable such that they retain the characteristics the class requires. My particular case is a class attribute which is initialised as a list of lists of two integers, the first of which is a modulo remainder. I need to be able to

Re: Restricted attribute writing

2011-08-07 Thread Roy Smith
In article mailman.2010.1312731312.1164.python-l...@python.org, John O'Hagan resea...@johnohagan.com wrote: I'm looking for good ways to ensure that attributes are only writable such that they retain the characteristics the class requires. Sounds like you're trying to do

Re: Restricted attribute writing

2011-08-07 Thread Steven D'Aprano
Roy Smith wrote: In article mailman.2010.1312731312.1164.python-l...@python.org, John O'Hagan resea...@johnohagan.com wrote: I'm looking for good ways to ensure that attributes are only writable such that they retain the characteristics the class requires. Sounds like you're trying to

Re: Restricted attribute writing

2011-08-07 Thread Rafael Durán Castañeda
I think you might use a tuple instead of a list for OrderElement, that would make much easier your code: class OrderElement(tuple): def __new__(cls, x, y): if not isinstance(x, int) or not isinstance(y, int): raise TypeError(Order element must receives two integers)

Re: Restricted attribute writing

2011-08-07 Thread Rafael Durán Castañeda
The assert on Order should be an if ... raise, like OrderElement, sorry for the mistake and repost El 7 de agosto de 2011 18:53, Rafael Durán Castañeda rafadurancastan...@gmail.com escribió: I think you might use a tuple instead of a list for OrderElement, that would make much easier your

PyPI Situation?

2011-08-07 Thread Redmumba
I've been running into a lot of issues with the PyPI architecture, and I'm aware that there's some work going on behind the scenes, especially with making PyPI accessible from the a cloud-like architecture. However, I setup a Python mirror (using the pep381client) for our company, and the issue

Re: Restricted attribute writing

2011-08-07 Thread Steven D'Aprano
John O'Hagan wrote: I'm looking for good ways to ensure that attributes are only writable such that they retain the characteristics the class requires. That's what properties are for. My particular case is a class attribute which is initialised as a list of lists of two integers, the first

Re: how to separate a list into two lists?

2011-08-07 Thread Gelonida N
On 08/07/2011 02:07 AM, Steven D'Aprano wrote: Gelonida N wrote: Asuming you [Bud] are not an alias of Jack Smith and assuming you did not see Jack's thread asking the same question: That's a strange thing to say when Bud *answered* Jack's question. x,y = unzip(*L) What's unzip?

import hooks (PEP 302) broken in Python =2.5?

2011-08-07 Thread Josh Haberman
When reading about import hooks, I came across a blog entry comment that says: One additional thing to note about ihooks is that it's somewhat seriously broken on Python 2.5 and newer and there seems to be little or no interest in fixing it. It's probably worth *always* avoiding when

Re: Restricted attribute writing

2011-08-07 Thread Chris Angelico
On Sun, Aug 7, 2011 at 6:07 PM, Steven D'Aprano steve+comp.lang.pyt...@pearwood.info wrote: class ThingWithTwoIntegers(object): I'm not a lisp expert, but this might well be called a cons cell. Or a pair. ChrisA -- http://mail.python.org/mailman/listinfo/python-list

Re: import hooks (PEP 302) broken in Python =2.5?

2011-08-07 Thread Steven D'Aprano
Josh Haberman wrote: When reading about import hooks, I came across a blog entry comment that says: One additional thing to note about ihooks is that it's somewhat seriously broken on Python 2.5 and newer and there seems to be little or no interest in fixing it. It's probably

help with DLL or path issue trying to use cx_Freeze

2011-08-07 Thread Bart Manchester
I suspect this may have gone out before I was a member, and thus potentially not be received - apologies if this did go out please ignore this second attempt if it did. --- Im trying to use the most basic of cx_Freeze in a dos window and I receive the following error (see below).

Re: __set__ method is not called for class attribute access

2011-08-07 Thread Duncan Booth
Peter Otten __pete...@web.de wrote: Duncan Booth wrote: The descriptor protocol only works when a value is being accessed or set on an instance and there is no instance attribute of that name so the value is fetched from the underlying class. Unlike normal class attributes a descriptor

Re: PyPI Situation?

2011-08-07 Thread Ned Deily
In article CAPwXK7-qGS-N6d_cNKwXH=oHEyV6=zidmwh1fdst7ekvp-e...@mail.gmail.com, Redmumba redmu...@gmail.com wrote: I've been running into a lot of issues with the PyPI architecture, and I'm aware that there's some work going on behind the scenes, especially with making PyPI accessible from the

Re: import hooks (PEP 302) broken in Python =2.5?

2011-08-07 Thread Ryan Kelly
On Sun, 2011-08-07 at 11:11 -0700, Josh Haberman wrote: When reading about import hooks, I came across a blog entry comment that says: One additional thing to note about ihooks is that it's somewhat seriously broken on Python 2.5 and newer and there seems to be little or no interest

Wait for a keypress before continuing?

2011-08-07 Thread John Doe
My program does not need a prompt, it just needs to wait for any key to be pressed before it continues. This is in Windows. char=0 while not char: char=msvcrt.getch() That doesn't delay anything here. while 1: char=msvcrt.getch() break That appears to put my program into

Re: Wait for a keypress before continuing?

2011-08-07 Thread Steven D'Aprano
John Doe wrote: My program does not need a prompt, it just needs to wait for any key to be pressed before it continues. This is in Windows. char=0 while not char: char=msvcrt.getch() That doesn't delay anything here. Works perfectly for me. You don't need the while loop, since

module import error, what's wrong?

2011-08-07 Thread smith jack
from common.URLTool import URLTool tool = URLTool() Traceback (most recent call last): File E:\workspace\url\test.py, line 7, in ? from common.URLTool import URLTool ImportError: No module named common.URLTool URLTools is a class write by myself, it works well ,but cannot be imported in

WxPython and TK

2011-08-07 Thread azrael
Today I found a quote from Guido. wxPython is the best and most mature cross-platform GUI toolkit, given a number of constraints. The only reason wxPython isn't the standard Python GUI toolkit is that Tkinter was there first. -- Guido van Rossum OK, now. Isn't it maybe time to throw out TK

Re: module import error, what's wrong?

2011-08-07 Thread Gelonida N
On 08/08/2011 02:45 AM, smith jack wrote: from common.URLTool import URLTool could it be that you meant from common import URLTool As I don't know the module 'common' I am just guessing tool = URLTool() Traceback (most recent call last): File E:\workspace\url\test.py, line 7, in ?

Re: Wait for a keypress before continuing?

2011-08-07 Thread John Doe
Steven D'Aprano steve+comp.lang.python pearwood.info wrote: Also, are you using an IDE? If so, it could very well be interfering with the keyboard buffer I really don't know how to answer your question. I am using Windows XP SP3. Komodo Edit 6 for editing the *.py file. Dragon Naturally

Re: WxPython and TK

2011-08-07 Thread Ian Kelly
On Sun, Aug 7, 2011 at 6:26 PM, azrael jura.gro...@gmail.com wrote: Today I found a quote from Guido. wxPython is the best and most mature cross-platform GUI toolkit, given a number of constraints. The only reason wxPython isn't the standard Python GUI toolkit is that Tkinter was there

Re: Restricted attribute writing

2011-08-07 Thread John O'Hagan
On Mon, 08 Aug 2011 03:07:30 +1000 Steven D'Aprano steve+comp.lang.pyt...@pearwood.info wrote: John O'Hagan wrote: I'm looking for good ways to ensure that attributes are only writable such that they retain the characteristics the class requires. That's what properties are for. My

[issue10087] HTML calendar is broken

2011-08-07 Thread Senthil Kumaran
Senthil Kumaran sent...@uthcode.com added the comment: Chris, as you already suggested in msg124410, I would prefer the removal of encoding specification from command line. Providing the encoding argument via API with deprecating warning is a good idea. The output should be string and it

[issue12398] Sending binary data with a POST request in httplib can cause Unicode exceptions

2011-08-07 Thread Senthil Kumaran
Changes by Senthil Kumaran sent...@uthcode.com: -- assignee: - orsenthil nosy: +orsenthil ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue12398 ___

[issue12541] Accepting Badly formed headers in urllib HTTPBasicAuth

2011-08-07 Thread Senthil Kumaran
Senthil Kumaran sent...@uthcode.com added the comment: Here is a patch with the test for accepting the badly formed headers. I would like to ensure that change in the regex is fool-proof in order to accomodate this bad behavior, so that we don't break the existing stuff. It is problem at the

[issue12706] timeout sentinel in ftplib and poplib

2011-08-07 Thread Senthil Kumaran
New submission from Senthil Kumaran sent...@uthcode.com: - ftplib and poplib, has them as timeout=None, while they default to socket._GLOBAL_DEFAULT_TIMEOUT object.

[issue12706] timeout sentinel in ftplib and poplib documentation

2011-08-07 Thread Senthil Kumaran
Changes by Senthil Kumaran sent...@uthcode.com: -- title: timeout sentinel in ftplib and poplib - timeout sentinel in ftplib and poplib documentation ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue12706

[issue12589] test_long.test_nan_inf() failed on OpenBSD (powerpc)

2011-08-07 Thread Landry Breuil
Landry Breuil lan...@openbsd.org added the comment: floatobject.c is compiled with cc -pthread -c -fno-strict-aliasing -O2 -pipe -Wall -DTHREAD_STACK_SIZE=0x2 -fPIC -O2 -pipe -Wall -I. -IInclude -I./Include -fPIC -DPy_BUILD_CORE -o Objects/floatobject.o Objects/floatobject.c

[issue12589] test_long.test_nan_inf() failed on OpenBSD (powerpc)

2011-08-07 Thread Landry Breuil
Changes by Landry Breuil lan...@openbsd.org: Added file: http://bugs.python.org/file22854/pyconfig.h ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue12589 ___

[issue12589] test_long.test_nan_inf() failed on OpenBSD (powerpc)

2011-08-07 Thread Landry Breuil
Changes by Landry Breuil lan...@openbsd.org: Added file: http://bugs.python.org/file22855/math.h ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue12589 ___

[issue12589] test_long.test_nan_inf() failed on OpenBSD (powerpc)

2011-08-07 Thread Landry Breuil
Landry Breuil lan...@openbsd.org added the comment: Interestingly, after an update of the system i can't build python 3.2.1 anymore : /usr/include/util.h:102: error: conflicting types for 'openpty' Include/pyport.h:634: error: previous declaration of 'openpty' was here /usr/include/util.h:105:

[issue12589] test_long.test_nan_inf() failed on OpenBSD (powerpc)

2011-08-07 Thread Landry Breuil
Changes by Landry Breuil lan...@openbsd.org: Added file: http://bugs.python.org/file22857/build-macppc.log ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue12589 ___

[issue12191] Add shutil.chown to allow to use user and group name (and not only uid/gid)

2011-08-07 Thread Sandro Tosi
Sandro Tosi sandro.t...@gmail.com added the comment: grepping over the stdlib, LookupError is only used in codecs exception; also the documentation of LE is The base class for the exceptions that are raised when a key or index used on a mapping or sequence is invalid: IndexError, KeyError.

[issue10087] HTML calendar is broken

2011-08-07 Thread Chris Lambacher
Chris Lambacher ch...@kateandchris.net added the comment: Senthil: I wasn't advocating the removal of the ability to specify encoding, only stating that avoiding the use of sys.stdout.buffer.write could only sensibly be done if we also removed the ability to specify an encoding (I can see how

[issue12677] Turtle, fix right/left rotation orientation

2011-08-07 Thread Roundup Robot
Roundup Robot devn...@psf.upfronthosting.co.za added the comment: New changeset a30e6c4bf486 by Sandro Tosi in branch '2.7': #12677: correct turtle orientation in doc http://hg.python.org/cpython/rev/a30e6c4bf486 New changeset bf4f65043d7d by Sandro Tosi in branch '3.2': #12677: correct turtle

[issue12677] Turtle, fix right/left rotation orientation

2011-08-07 Thread Sandro Tosi
Changes by Sandro Tosi sandro.t...@gmail.com: -- resolution: - fixed stage: patch review - committed/rejected status: open - closed ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue12677 ___

[issue10087] HTML calendar is broken

2011-08-07 Thread Antoine Pitrou
Antoine Pitrou pit...@free.fr added the comment: I don't think WARNING: this may corrupt your terminal is warranted. Also, I think we can safely remove the --encoding option. Calling a module from the command-line is intended as a demonstration of the module's functionality, it's not an

[issue5149] syntactic sugar: type coercion on pointer assignment

2011-08-07 Thread Vlad Riscutia
Vlad Riscutia riscutiav...@gmail.com added the comment: The main reason for this issue is that internally ctypes doesn't consider c_char_p as a pointer type. This is a bit counter-intuitive, but c_char_p is treated as a simple type and has some other sugar built-in, like easier integration

[issue10741] PyGILState_GetThisThreadState() lacks a doc entry

2011-08-07 Thread Sandro Tosi
Sandro Tosi sandro.t...@gmail.com added the comment: Here attached a very simple patch, made by slightly re-editing the comment in pystate.h. -- keywords: +patch nosy: +ezio.melotti, sandro.tosi stage: - patch review versions: +Python 3.3 -Python 3.1 Added file:

[issue12191] Add shutil.chown to allow to use user and group name (and not only uid/gid)

2011-08-07 Thread R. David Murray
R. David Murray rdmur...@bitdance.com added the comment: Well, you could consider codecs an example in the stdlib of using it, and the doc could be changed to something like stdlib modules that look up information in specialized data sources may raise this error directly. Whether this is a

[issue12541] Accepting Badly formed headers in urllib HTTPBasicAuth

2011-08-07 Thread R. David Murray
R. David Murray rdmur...@bitdance.com added the comment: Perhaps we should issue a warning, then, too? -- nosy: +r.david.murray ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue12541 ___

[issue10741] PyGILState_GetThisThreadState() lacks a doc entry

2011-08-07 Thread Roundup Robot
Roundup Robot devn...@psf.upfronthosting.co.za added the comment: New changeset 8852e4a9aa1e by Sandro Tosi in branch '2.7': #10741: add documentation for PyGILState_GetThisThreadState() http://hg.python.org/cpython/rev/8852e4a9aa1e New changeset 53b8260b9ea7 by Sandro Tosi in branch '3.2':

[issue10741] PyGILState_GetThisThreadState() lacks a doc entry

2011-08-07 Thread Sandro Tosi
Sandro Tosi sandro.t...@gmail.com added the comment: I just committed an improved version of the proposed patch (thanks Ezio for the review and help!). -- resolution: - fixed stage: patch review - committed/rejected status: open - closed ___ Python

[issue12191] Add shutil.chown to allow to use user and group name (and not only uid/gid)

2011-08-07 Thread Sandro Tosi
Sandro Tosi sandro.t...@gmail.com added the comment: On Mon, Aug 8, 2011 at 00:12, R. David Murray rep...@bugs.python.org wrote: R. David Murray rdmur...@bitdance.com added the comment: Well, you could consider codecs an example in the stdlib of using it, and the doc could be changed to

[issue12437] _ctypes.dlopen does not include errno in OSError

2011-08-07 Thread Vlad Riscutia
Vlad Riscutia riscutiav...@gmail.com added the comment: Not sure how this can be fixed actually. I don't think PyErr_SetFromErrno instead of PyErr_SetString would work because as far as I can tell, standard does not mention dlopen making use of errno. Unlike Windows, where LoadLibrary will

[issue12682] Meaning of 'accepted' resolution as documented in devguide

2011-08-07 Thread R. David Murray
R. David Murray rdmur...@bitdance.com added the comment: Well, as long as 'accepted' is under 'resolution', I'm likely to keep using it for feature requests, I suppose because I'm too much of a precisonist. If someone wants to re-engineer the interface, that would be fine with me :) I

[issue12707] Deprecate addinfourl getters

2011-08-07 Thread Ezio Melotti
New submission from Ezio Melotti ezio.melo...@gmail.com: The documentation for urllib.request.urlopen [0] says that: This function returns a file-like object [addinfourl] with two additional methods from the urllib.response module geturl() — return the URL of the resource retrieved, [...]

[issue10050] urllib.request still has old 2.x urllib primitives

2011-08-07 Thread Ezio Melotti
Changes by Ezio Melotti ezio.melo...@gmail.com: -- nosy: +ezio.melotti ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue10050 ___ ___

[issue12707] Deprecate addinfourl getters

2011-08-07 Thread Ezio Melotti
Ezio Melotti ezio.melo...@gmail.com added the comment: Another possible improvement that can be done is providing a proper Response object instead of addbase, addinfo, addinfourl (yes, those are oddly-named classes, not functions [0]). The Response object could be like 'addbase', but with this

[issue1205239] Let shift operators take any integer value

2011-08-07 Thread Craig McQueen
Craig McQueen pyt...@craig.mcqueen.id.au added the comment: So this has been rejected I see. Too bad, since I stub my metaphorical toe on this issue from time to time. Just for the record, here is an example: http://stackoverflow.com/questions/4130936/perfect-hash-function/6976723#6976723