I am happy to see that others agree we need something better
than self.x=x; self.y=y; self.z=z.
Phillip J. Eby wrote:
> class grouping:
> def __init__(self, x, y, z):
> initialize(self, locals())
Been there (older code):
I don't like it because
- I do have to remember how to import adopt_init_args/initialize.
- I also have to remember the locals() part (unpythonic
- I get both self.x and x. This lead to subtle bugs a few times when
I accidentally assigned to x instead of self.x or vice versa in the
- It is sure to be less efficient than the .x support I propose.
I'd be happy if
- adopt_init_args/initialize became a (efficiently implemented)
- and the locals() part is not needed.
However, IMO the .x solution is still far better because I often
want to do something like this:
def __init__(self, .keep_this, .and_this, but_not_this, .but_this_again):
With the adopt_init_args/initialize solution you'd have to write:
def __init__(self, keep_this, and_this, but_not_this, but_this_again):
initialize(self, locals(), exclude=["but_not_this"])
Unpythonic boilerplate again (the but_not_this duplication).
I'm preparing the pre-PEP of a Money module, and I don't want to
explain the rounding methods there again.
So my idea was to point to Decimal documentation regarding them. And I
couldn't find them.
Could it be we missed the explanation of each rounding mode in the
Decimal docs? Or the sprints burned my head?
If somebody confirm me that they're not explained, I'll open a bug to
myself to do it...
I'm sorry, I don't seem to have done a very good job at explaining
the situation. I'll try again:
'getch()' is a low-level function provided on Windows to capture a
single character of input from a user, /without echoing it to the
screen/. As far as I can tell there's no other way of doing this with
Python on Windows. The Python interface to this function is in the C
code in msvcrtmodule.c, which has a (very thin) wrapper around the raw
OS system call. Microsoft provide a way of accepting both normal ASCII
codes, and extended characters via this system call. Currently, the
Python wrapper in msvcrtmodule.c only supports the semantics of getting
the bare ASCII codes, and not the extended characters. I would strongly
suggest that it should support both.
So, I guess in answer to the questions raised below;
1) I can't do it in Python code without getch() (hence the original
2) I would argue that in fact getch() is 'broken' in its current Python
implementation, as it doesn't support what the OS implies /should/ be
supported (and, indeed, if I input an extended character in response to
a 'getch()' call, all I get back currently is an empty string).
Finally, I've dug a little deeper, and it looks as though if (ch >
UCHAR_MAX) then it would have to call PyUnicode_FromUnicode(s, 1)
Is it worth sending in a patch to the sourceforge patch-tracker
implementing this? Is it OK for msvcrt_getch to return Unicode when
Hope this helps,
>Darryl Dixon wrote:
>> Microsoft support capturing extended characters via _getch, but it
requires making a
>> second call to getch() if one of the 'magic' returns is encountered
in the first call (0x00
>> or 0xE0).
>so why not do that in your python code?
>> The relevant chunk of code in Python that would probably need to be
>> changed to support this appears to be in msvcrtmodule.c:
>if you change msvcrt, you'll break all the programs that uses getch()
>the prescribed way...
Darryl Dixon <esrever_otua(a)pythonhacker.is-a-geek.net>
> When I used py2exe to create executable file, "cephes" module missing
> error occurred.
> I have installed python 2.3 and scientific and numeric python.
> Can anybody suggest me how to resolve the problem?
python-dev is for development *of* python, not *with* python. Please
direct your questions to <python-list(a)python.org> (or via the newsgroup
When I used py2exe to create executable file, "cephes" module missing error occurred.
I have installed python 2.3 and scientific and numeric python.
Can anybody suggest me how to resolve the problem?
Rekindle the Rivalries. Sign up for Fantasy Football
I have a bundle of python script files (developed based on 2.*) in one application. Is there a way to create a single Dos executable file?
Yahoo! Mail Mobile
Take Yahoo! Mail with you! Check email on your mobile phone.