Karlsruhe (Germany) Python User Group, November 16th 2012, 7pm

2012-11-09 Thread Jürgen A . Erhard
The Karlsruhe Python User Group (KaPy) meets again. Friday, 2012-11-16 (November 16th) at 19:00 (7pm) in the rooms of Entropia eV (the local affiliate of the CCC). See http://entropia.de/wiki/Anfahrt on how to get there. For your calendars: meetings are held monthly, on the 3rd Friday. There's

ANN: matplotlib 1.2.0

2012-11-09 Thread Michael Droettboom
After months of hard work by a veritable army of contributors, I'm pleased to announce the release of matplotlib 1.2.0. This is the first time we've released without the assistance of John Hunter, who is sorely missed. I hope this is at least a small way to say thanks for all of his great

Re: Writing game-state data...

2012-11-09 Thread Ian Kelly
On Fri, Nov 9, 2012 at 12:20 AM, Graham Fielding frednot...@hotmail.ca wrote: file_object = open('savegame.sav', 'wb') Here you open a file and assign it to file_object. file['map'] = map Here you attempt to write to file instead of file_object. file is the name of a built-in type,

Re: int.__init__ incompatible in Python 3.3

2012-11-09 Thread Ulrich Eckhardt
Am 08.11.2012 21:29, schrieb Terry Reedy: On Thu, Nov 8, 2012 at 8:55 AM, Ulrich Eckhardt ulrich.eckha...@dominolaser.com wrote: On 3.3, it gives me a TypeError: object.__init__() takes no parameters. To some extent, this makes sense to me, because the int subobject is not initialized in

Python3.3 str() bug?

2012-11-09 Thread Helmut Jarausch
Hi, probably I'm missing something. Using str(Arg) works just fine if Arg is a list. But str([],encoding='latin-1') gives the error TypeError: coercing to str: need bytes, bytearray or buffer-like object, list found If this isn't a bug how can I use str(Arg,encoding='latin-1')

Re: Python3.3 str() bug?

2012-11-09 Thread Stefan Behnel
Helmut Jarausch, 09.11.2012 10:18: probably I'm missing something. Using str(Arg) works just fine if Arg is a list. But str([],encoding='latin-1') gives the error TypeError: coercing to str: need bytes, bytearray or buffer-like object, list found If this isn't a bug

Re: Obnoxious postings from Google Groups

2012-11-09 Thread Hans Mulder
On 6/11/12 23:50:59, Steven D'Aprano wrote: On Tue, 06 Nov 2012 17:16:44 +, Prasad, Ramit wrote: To enter the newline, I typed Ctrl-Q to tell bash to treat the next character as a literal, and then typed Ctrl-J to get a newline. That sounds complicated, my version of bash lets me type

Re: Right solution to unicode error?

2012-11-09 Thread wxjmfauth
Le jeudi 8 novembre 2012 21:42:58 UTC+1, Ian a écrit : On Thu, Nov 8, 2012 at 12:54 PM, wxjmfa...@gmail.com wrote: Font has nothing to do here. You are simply wrongly encoding your unicode. '\u2013' '–' '\u2013'.encode('utf-8') b'\xe2\x80\x93'

RE: Writing game-state data...

2012-11-09 Thread Graham Fielding
To: python-list@python.org From: breamore...@yahoo.co.uk Subject: Re: Writing game-state data... Date: Fri, 9 Nov 2012 07:37:56 + On 09/11/2012 07:20, Graham Fielding wrote: Hey, folks, me again! I've been puzzling over this for a while now: I'm trying to write data to a file

RE: duck typing assert

2012-11-09 Thread Andriy Kornatskyy
Thank you for all comments. It makes very good sense to say: duckmatch(IFoo).compare(Foo) Since we do duck match of IFoo... but there is no `duck match`, there is `duck test`. I believe instead of `compare` is more readable with `equals`. Than it is more from mathematics - precise

Relative imports in packages

2012-11-09 Thread Johannes Bauer
Hi list, I've these two minor problems which bothered me for quite some time, maybe you can help me. I'm using Python 3.2. For some project I have a component in its own package. Let's say the structure looks like this: pkg/__init__.py pkg/Foo.py pkg/Bar.py Foo.py and Bar.py contain their

Re: error

2012-11-09 Thread inshu chauhan
http://www.ymlgroup.com/obscurehiddenlocation/downloads site, and imported it using from notzanzibar import DataType. No i haven't downloaded it.. and this site is not opening... Then you'd have instantiated it in some code like data = DataType(filename) and then the type of data

Re: Python3.3 str() bug?

2012-11-09 Thread Helmut Jarausch
On Fri, 09 Nov 2012 10:37:11 +0100, Stefan Behnel wrote: Helmut Jarausch, 09.11.2012 10:18: probably I'm missing something. Using str(Arg) works just fine if Arg is a list. But str([],encoding='latin-1') gives the error TypeError: coercing to str: need bytes, bytearray or

Re: Obnoxious postings from Google Groups

2012-11-09 Thread Thomas Rachel
Am 31.10.2012 06:39 schrieb Robert Miles: For those of you running Linux: You may want to look into whether NoCeM is compatible with your newsreader and your version of Linux. This sounds as if it was intrinsically impossible to evaluate NoCeMs in Windows. If someone writes a software for

Re: Obnoxious postings from Google Groups

2012-11-09 Thread Steven D'Aprano
On Fri, 09 Nov 2012 10:49:41 +0100, Hans Mulder wrote: On 6/11/12 23:50:59, Steven D'Aprano wrote: On Tue, 06 Nov 2012 17:16:44 +, Prasad, Ramit wrote: To enter the newline, I typed Ctrl-Q to tell bash to treat the next character as a literal, and then typed Ctrl-J to get a newline.

Re: Obnoxious postings from Google Groups

2012-11-09 Thread Hans Mulder
On 7/11/12 01:13:47, Steven D'Aprano wrote: On Tue, 06 Nov 2012 23:08:11 +, Prasad, Ramit wrote: Steven D'Aprano wrote: On Tue, 06 Nov 2012 17:16:44 +, Prasad, Ramit wrote: To enter the newline, I typed Ctrl-Q to tell bash to treat the next character as a literal, and then typed

Re: int.__init__ incompatible in Python 3.3

2012-11-09 Thread Steven D'Aprano
On Fri, 09 Nov 2012 08:56:22 +0100, Ulrich Eckhardt wrote: Am 08.11.2012 21:29, schrieb Terry Reedy: On Thu, Nov 8, 2012 at 8:55 AM, Ulrich Eckhardt ulrich.eckha...@dominolaser.com wrote: On 3.3, it gives me a TypeError: object.__init__() takes no parameters. To some extent, this makes sense

Re: error

2012-11-09 Thread inshu chauhan
I attached a wrong file...Right file is attached here On Fri, Nov 9, 2012 at 11:53 AM, inshu chauhan insidesh...@gmail.comwrote: http://www.ymlgroup.com/obscurehiddenlocation/downloads site, and imported it using from notzanzibar import DataType. No i haven't downloaded it.. and this

Re: Python3.3 str() bug?

2012-11-09 Thread Chris Angelico
On Fri, Nov 9, 2012 at 10:08 PM, Helmut Jarausch jarau...@igpm.rwth-aachen.de wrote: For me it's not funny, at all. His description funny was in reference to the fact that you described this as a bug. This is a heavily-used mature language; bugs as fundamental as you imply are unlikely to exist

xml data or other?

2012-11-09 Thread Artie Ziff
Hello, I want to process XML-like data like this: testname=ltpacpi.sh description ACPI (Advanced Control Power Integration) testscript for 2.5 kernels. \description test_location ltp/testcases/kernel/device-drivers/acpi/ltpacpi.sh

Re: Python3.3 str() bug?

2012-11-09 Thread Helmut Jarausch
On Fri, 09 Nov 2012 23:22:04 +1100, Chris Angelico wrote: On Fri, Nov 9, 2012 at 10:08 PM, Helmut Jarausch jarau...@igpm.rwth-aachen.de wrote: For me it's not funny, at all. His description funny was in reference to the fact that you described this as a bug. This is a heavily-used mature

Re: int.__init__ incompatible in Python 3.3

2012-11-09 Thread Ulrich Eckhardt
Am 09.11.2012 12:37, schrieb Steven D'Aprano: On Fri, 09 Nov 2012 08:56:22 +0100, Ulrich Eckhardt wrote: Or, do you suggest I don't call super().__init__()? That would seem unclean to me. On the contrary: calling super().__init__ when the superclass does something you don't want (i.e. raises

Re: duck typing assert

2012-11-09 Thread Steven D'Aprano
On Thu, 08 Nov 2012 18:00:58 -0700, Ian Kelly wrote: On Thu, Nov 8, 2012 at 4:33 PM, Steven D'Aprano steve+comp.lang.pyt...@pearwood.info wrote: On Thu, 08 Nov 2012 20:34:58 +0300, Andriy Kornatskyy wrote: People who come from strongly typed languages that offer interfaces often are

Re: xml data or other?

2012-11-09 Thread rusi
On Nov 9, 5:54 pm, Artie Ziff artie.z...@gmail.com wrote: Hello, I want to process XML-like data like this: snipped Edits were substituting '/' for '\' on the end tags, and adding the following structure: If thats all you want, you can try the following: # obviously this should come from a

Re: error

2012-11-09 Thread inshu chauhan
Please Ignore the above two files attached,,, See this one On Fri, Nov 9, 2012 at 12:47 PM, inshu chauhan insidesh...@gmail.comwrote: I attached a wrong file...Right file is attached here On Fri, Nov 9, 2012 at 11:53 AM, inshu chauhan insidesh...@gmail.comwrote:

RE: duck typing assert

2012-11-09 Thread Andriy Kornatskyy
1. In looks-like we check features of Foo (that may be superset) of what IFoo offers. assert looks(Foo).like(IFoo) 2. We can check if Foo is limited to IFoo only: assert looks(IFoo).like(Foo) So it valid to have both asserts. Thanks. Andriy Kornatskyy

Re: error

2012-11-09 Thread inshu chauhan
Actually this one.. and its the last.. On Fri, Nov 9, 2012 at 2:59 PM, inshu chauhan insidesh...@gmail.com wrote: Please Ignore the above two files attached,,, See this one On Fri, Nov 9, 2012 at 12:47 PM, inshu chauhan insidesh...@gmail.comwrote: I attached a wrong file...Right file is

Re: duck typing assert

2012-11-09 Thread Chris Angelico
On Sat, Nov 10, 2012 at 1:01 AM, Andriy Kornatskyy andriy.kornats...@live.com wrote: 1. In looks-like we check features of Foo (that may be superset) of what IFoo offers. assert looks(Foo).like(IFoo) 2. We can check if Foo is limited to IFoo only: assert looks(IFoo).like(Foo) So it

RE: duck typing assert

2012-11-09 Thread Andriy Kornatskyy
There is sense for #2. Let me explain. There is basic IFoo implementation and improved Foo. While I switched to Foo, I still want to be as close to IFoo as possible, since there might be sense to switch to Foo2 later, which conform to IFoo. Here is the problem: if I will not assert #2

Re: Multi-dimensional list initialization

2012-11-09 Thread rusi
On Nov 9, 11:37 am, Steven D'Aprano steve +comp.lang.pyt...@pearwood.info wrote: On Fri, 09 Nov 2012 17:07:09 +1100, Chris Angelico wrote: On Fri, Nov 9, 2012 at 12:39 PM, Mark Lawrence breamore...@yahoo.co.uk wrote: On 07/11/2012 01:55, Steven D'Aprano wrote: Who knows? Who cares?

Re: Multi-dimensional list initialization

2012-11-09 Thread Chris Angelico
On Sat, Nov 10, 2012 at 2:05 AM, rusi rustompm...@gmail.com wrote: In x86 assembler mov ax, 0 is 4 bytes Three bytes actually, B8 00 00 if my memory hasn't failed me. BA for DX, B9 ought to be BX and BB CX, I think. But yes, the xor or sub is two bytes and one clock. ChrisA --

[newbie] problem with module PyVisa

2012-11-09 Thread Jean Dubois
I'm trying to control a programmable power supply via USB using python. After doing some googling I thought I should use PyVisa for this purpose, so I installed it as follows: tar xvfz PyVISA-1.4.tar.gz cd PyVISA-1.4 python setup.py install Installation seems to finish without errors. When I

Re: int.__init__ incompatible in Python 3.3

2012-11-09 Thread Ian Kelly
On Fri, Nov 9, 2012 at 4:37 AM, Steven D'Aprano steve+comp.lang.pyt...@pearwood.info wrote: In Python 3.3: py class X(int): ... def __init__(self, *args): ... super().__init__(*args) # does nothing, call it anyway ... py x = X(22) Traceback (most recent call last): File

Re: [newbie] problem with module PyVisa

2012-11-09 Thread Rodrick Brown
It seems pretty obvious from the error. Try installing the missing lib packages. OSError: /usr/local/vxipnp/linux/bin/libvisa.so.7: cannot open shared object file: No such file or directory Sent from my iPhone On Nov 9, 2012, at 11:22 AM, Jean Dubois jeandubois...@gmail.com wrote: OSError:

awk like usage in python

2012-11-09 Thread Rudra Banerjee
Friends, I am in process learning python. I basically use shell scripts for text formatting and trying my hand on python. where I am fighting is awk's functionality in python. Say, one of my real tiny code looks like: #!/bin/bash TMP=store for i in $1/MnBi_EOS_* do # echo $i grep -A 15 T(est)

Re: duck typing assert‏

2012-11-09 Thread Terry Reedy
On 11/9/2012 1:30 AM, Steven D'Aprano wrote: On Thu, 08 Nov 2012 23:44:54 -0500, Terry Reedy wrote: On 11/8/2012 6:40 PM, Steven D'Aprano wrote: [...] IFoo.bar # returns a computed property Assuming IFoo is a class and bar is a property attribute of the class, IFoo.bar is the property

Re: Python3.3 str() bug?

2012-11-09 Thread Stefan Behnel
Helmut Jarausch, 09.11.2012 14:13: On Fri, 09 Nov 2012 23:22:04 +1100, Chris Angelico wrote: What you really should be doing is not transforming the whole structure, but explicitly transforming each part inside it. I recommend you stop fighting the language and start thinking about your data

Printing characters outside of the ASCII range

2012-11-09 Thread danielk
I'm converting an application to Python 3. The app works fine on Python 2. Simply put, this simple one-liner: print(chr(254)) errors out with: Traceback (most recent call last): File D:\home\python\tst.py, line 1, in module print(chr(254)) File C:\Python33\lib\encodings\cp437.py, line

RE: Writing game-state data...

2012-11-09 Thread Prasad, Ramit
Graham Fielding wrote: Hey, folks, me again! I've been puzzling over this for a while now: I'm trying to write data to a file to save the state of my game using the following function: def save_game():     #open a new empty shelve (possibly overwriting an old one) to write the

Re: Python3.3 str() bug?

2012-11-09 Thread Ian Kelly
On Fri, Nov 9, 2012 at 2:18 AM, Helmut Jarausch jarau...@igpm.rwth-aachen.de wrote: Hi, probably I'm missing something. Using str(Arg) works just fine if Arg is a list. But str([],encoding='latin-1') gives the error TypeError: coercing to str: need bytes, bytearray or buffer-like

Re: Printing characters outside of the ASCII range

2012-11-09 Thread Ian Kelly
On Fri, Nov 9, 2012 at 10:17 AM, danielk danielklei...@gmail.com wrote: I'm converting an application to Python 3. The app works fine on Python 2. Simply put, this simple one-liner: print(chr(254)) errors out with: Traceback (most recent call last): File D:\home\python\tst.py, line 1,

RE: duck typing assert

2012-11-09 Thread Prasad, Ramit
Andriy Kornatskyy wrote: Thank you for all comments. It makes very good sense to say: duckmatch(IFoo).compare(Foo) Since we do duck match of IFoo... but there is no `duck match`, there is `duck test`. I believe instead of `compare` is more readable with `equals`. Than it is more

Re: Printing characters outside of the ASCII range

2012-11-09 Thread Andrew Berg
On 2012.11.09 11:17, danielk wrote: I'm converting an application to Python 3. The app works fine on Python 2. Simply put, this simple one-liner: print(chr(254)) errors out with: Traceback (most recent call last): File D:\home\python\tst.py, line 1, in module print(chr(254))

Re: Printing characters outside of the ASCII range

2012-11-09 Thread Dave Angel
On 11/09/2012 12:17 PM, danielk wrote: I'm converting an application to Python 3. The app works fine on Python 2. Simply put, this simple one-liner: print(chr(254)) errors out with: Traceback (most recent call last): File D:\home\python\tst.py, line 1, in module print(chr(254))

RE: Python3.3 str() bug?

2012-11-09 Thread Prasad, Ramit
Chris Angelico wrote: What you really should be doing is not transforming the whole structure, but explicitly transforming each part inside it. I recommend you stop fighting the language and start thinking about your data as either *bytes* or *characters* and using the appropriate data

RE: duck typing assert

2012-11-09 Thread Andriy Kornatskyy
duck(Foo).match(IFoo, kwargs) duck(Foo).like(IFoo, kwargs) Hm... function name in most cases is read as verb... this may cause confusion: duck = synonyms = immerse, dip Thanks. Andriy Kornatskyy From: ramit.pra...@jpmorgan.com To:

RE: Multi-dimensional list initialization

2012-11-09 Thread Prasad, Ramit
Dennis Lee Bieber wrote: On Fri, 9 Nov 2012 17:07:09 +1100, Chris Angelico ros...@gmail.com declaimed the following in gmane.comp.python.general: On Fri, Nov 9, 2012 at 12:39 PM, Mark Lawrence breamore...@yahoo.co.uk wrote: On 07/11/2012 01:55, Steven D'Aprano wrote: Who

Re: problem with module PyVisa

2012-11-09 Thread Jean Dubois
On 9 nov, 17:40, Rodrick Brown rodrick.br...@gmail.com wrote: It seems pretty obvious from the error. Try installing the missing lib packages. OSError: /usr/local/vxipnp/linux/bin/libvisa.so.7: cannot open shared object file: No such file or directory Sent from my iPhone On Nov 9, 2012,

Re: How to print python commands automatically?

2012-11-09 Thread Peng Yu
Is this what you want? http://docs.python.org/2/library/trace.html I'm not able to get the mixing of the python command screen output on stdout. Is there a combination of options for this purpose? ~/linux/test/python/man/library/trace$ cat main1.py #!/usr/bin/env python def f(): print Hello

RE: problem with module PyVisa

2012-11-09 Thread Prasad, Ramit
Jean Dubois wrote: On 9 nov, 17:40, Rodrick Brown rodrick.br...@gmail.com wrote: It seems pretty obvious from the error. Try installing the missing lib packages. OSError: /usr/local/vxipnp/linux/bin/libvisa.so.7: cannot open shared object file: No such file or directory Sent from

Re: Printing characters outside of the ASCII range

2012-11-09 Thread danielk
On Friday, November 9, 2012 12:48:05 PM UTC-5, Dave Angel wrote: On 11/09/2012 12:17 PM, danielk wrote: I'm converting an application to Python 3. The app works fine on Python 2. Simply put, this simple one-liner: print(chr(254)) errors out with: Traceback

RE: How to print python commands automatically?

2012-11-09 Thread Prasad, Ramit
Peng Yu wrote: Is this what you want? http://docs.python.org/2/library/trace.html I'm not able to get the mixing of the python command screen output on stdout. Is there a combination of options for this purpose? ~/linux/test/python/man/library/trace$ cat main1.py #!/usr/bin/env

RE: Printing characters outside of the ASCII range

2012-11-09 Thread Prasad, Ramit
danielk wrote: The database I'm using stores information as a 3-dimensional array. The delimiters between elements are chr(252), chr(253) and chr(254). So a record can look like this (example only uses one of the delimiters for simplicity): name + chr(254) + address + chr(254) + city +

Re: Printing characters outside of the ASCII range

2012-11-09 Thread Andrew Berg
On 2012.11.09 15:17, danielk wrote: I guess the question I have is: How do you tell Python to use a specific encoding for 'print' statements when I know there will be characters outside of the ASCII range of 0-127? You don't. It's raising that exception because the terminal cannot display

Re: Printing characters outside of the ASCII range

2012-11-09 Thread danielk
On Friday, November 9, 2012 4:34:19 PM UTC-5, Prasad, Ramit wrote: danielk wrote: The database I'm using stores information as a 3-dimensional array. The delimiters between elements are chr(252), chr(253) and chr(254). So a record can look like this (example only uses one of

Re: Multi-dimensional list initialization

2012-11-09 Thread Ethan Furman
Prasad, Ramit wrote: Dennis Lee Bieber wrote: Of course, if one has a language that, for some reason, evaluates right-to-left (APL, anyone), then x := x - x - x becomes x := x - 0 Is that not the same as x:=-x? No, its the same as 'x = x'. ~Ethan~ --

Re: Printing characters outside of the ASCII range

2012-11-09 Thread Ian Kelly
On Fri, Nov 9, 2012 at 2:46 PM, danielk danielklei...@gmail.com wrote: D:\home\pythonpytest.py Traceback (most recent call last): File D:\home\python\pytest.py, line 1, in module print(chr(253).decode('latin1')) AttributeError: 'str' object has no attribute 'decode' Do I need to

Re: problem with module PyVisa

2012-11-09 Thread wrw
On Nov 9, 2012, at 3:43 PM, Jean Dubois jeandubois...@gmail.com wrote: The error may be obvious but finding this file and how to install it is not unfortunately. It seems I have to install it from the National Instruments site but Debian Linux doesn't seem to be supported... and I doubt

fabric question

2012-11-09 Thread Jabba Laci
Hi, I'm trying to use fabric to run a command on another Linux machine. When I call fab remote_info (using the example from its documentation), this is what I get: local$ fab remote_info [remote] Executing task 'remote_info' [remote] run: uname -a [remote] out: remote@path$ That is, it logs in

Re: How to print python commands automatically?

2012-11-09 Thread Peng Yu
Try with just --trace? C:\ramitpython.exe -m trace test.py C:\ramit\Python27\lib\trace.py: must specify one of --trace, --count, --report, --listfuncs, or --trackcalls C:\ramitpython -m trace --trace test.py --- modulename: test, funcname: module test.py(2): def f(): test.py(5): f()

Re: fabric question

2012-11-09 Thread Miki Tebeka
local$ fab remote_info [remote] Executing task 'remote_info' [remote] run: uname -a [remote] out: remote@path$ What happens when you ssh to the machine and run 'uname -a'? (The out: ... is the output) -- http://mail.python.org/mailman/listinfo/python-list

Re: Python3.3 str() bug?

2012-11-09 Thread Terry Reedy
On 11/9/2012 8:13 AM, Helmut Jarausch wrote: Just for the record. I first discovered a real bug with Python3 when using os.walk on a file system containing non-ascii characters in file names. I encountered a very strange behavior (I still would call it a bug) when trying to put non-ascii

Re: how to get os.py to use an ./ntpath.py instead of Lib/ntpath.py

2012-11-09 Thread Aahz
In article k2p9da$ktu$1...@r03.glglgl.gl, Thomas Rachel nutznetz-0c1b6768-bfa9-48d5-a470-7603bd3aa...@spamschutz.glglgl.de wrote: Am 11.09.2012 05:46 schrieb Steven D'Aprano: Good for you. (Sorry, that comes across as more condescending than it is intended as.) Monkey-patching often gets used

Is there a simpler way to modify all arguments in a function before using the arguments?

2012-11-09 Thread bruceg113355
Is there a simpler way to modify all arguments in a function before using the arguments? For example, can the below code, in the modify arguments section be made into a few statements? def someComputation (aa, bb, cc, dd, ee, ff, gg, hh): # modify arguments #

Re: Want to add dictionary keys to namespace?

2012-11-09 Thread Chris Angelico
On Sat, Nov 10, 2012 at 11:00 AM, Jeff Jeffries jeff.jeffries@gmail.com wrote: Smart people, Is there a way I can add a dictionaries keys to the python namespace? It would just be temporary as I am working with a large dictionary, and it would speed up work using an IDE. I look and find

Re: Is there a simpler way to modify all arguments in a function before using the arguments?

2012-11-09 Thread Roy Smith
In article 18134e77-9b02-4aec-afb0-794ed900d...@googlegroups.com, bruceg113...@gmail.com wrote: Is there a simpler way to modify all arguments in a function before using the arguments? For example, can the below code, in the modify arguments section be made into a few statements?

Re: Is there a simpler way to modify all arguments in a function before using the arguments?

2012-11-09 Thread Steven D'Aprano
On Fri, 09 Nov 2012 20:05:26 -0500, Roy Smith wrote: In article 18134e77-9b02-4aec-afb0-794ed900d...@googlegroups.com, bruceg113...@gmail.com wrote: Is there a simpler way to modify all arguments in a function before using the arguments? For example, can the below code, in the modify

Re: Is there a simpler way to modify all arguments in a function before using the arguments?

2012-11-09 Thread Paul Rubin
bruceg113...@gmail.com writes: Is there a simpler way to modify all arguments in a function before using the arguments? Why do you want to do that? For example, can the below code, in the modify arguments section be made into a few statements? Whenever someone uses that many variables one

Re: Is there a simpler way to modify all arguments in a function before using the arguments?

2012-11-09 Thread Chris Angelico
On Sat, Nov 10, 2012 at 1:52 PM, Paul Rubin no.email@nospam.invalid wrote: bruceg113...@gmail.com writes: Is there a simpler way to modify all arguments in a function before using the arguments? Why do you want to do that? Contrived example: def send_email(from, to, subj, body, whatever,

Re: Is there a simpler way to modify all arguments in a function before using the arguments?

2012-11-09 Thread Paul Rubin
Chris Angelico ros...@gmail.com writes: Contrived example: def send_email(from, to, subj, body, whatever, other, headers, you, like): That should be a dictionary with the header names as indexes. In fact there are already some email handling modules in the stdlib that represent headers that

Re: Is there a simpler way to modify all arguments in a function before using the arguments?

2012-11-09 Thread Miki Tebeka
Is there a simpler way to modify all arguments in a function before using the arguments? You can use a decorator: from functools import wraps def fix_args(fn): @wraps(fn) def wrapper(*args): args = (arg.replace('_', '') for arg in args) return fn(*args) return

Re: Numpy combine channels

2012-11-09 Thread Aahz
In article mailman.465.1347307911.27098.python-l...@python.org, MRAB python-list@python.org wrote: On 10/09/2012 20:39, Wanderer wrote: I have an array generated by audiolab of left and right stereo channels. It looks like [[1,1],[1,2],[2,3]]. I would like to combine the left and right

skip Trackback error for ftp checking

2012-11-09 Thread moonhkt
HI All How to skip Trackback warning/error when input ftp address is not correct or reject ? AIX 5.3 from ftplib import FTP import ftplib import sys from optparse import OptionParser parser = OptionParser() parser.add_option(-a,--remote_host_address, dest=remote_host_address, help=REMOTE

Re: skip Trackback error for ftp checking

2012-11-09 Thread Steven D'Aprano
On Fri, 09 Nov 2012 20:51:47 -0800, moonhkt wrote: HI All How to skip Trackback warning/error when input ftp address is not correct or reject ? The same way you would skip any other error when you do something wrong: catch the exception. -- Steven --

Re: Obnoxious postings from Google Groups

2012-11-09 Thread Steven D'Aprano
On Fri, 09 Nov 2012 12:34:27 +0100, Hans Mulder wrote: On 7/11/12 01:13:47, Steven D'Aprano wrote: Hit the J key, and the event includes character j. Hit Shift-J, and character J is sent. Hit Ctrl-J, and the character sent is the ASCII control character ^J, or newline. (Technically, the name

Re: awk like usage in python

2012-11-09 Thread Tim Roberts
Rudra Banerjee bnrj.ru...@gmail.com wrote: Friends, I am in process learning python. I basically use shell scripts for text formatting and trying my hand on python. where I am fighting is awk's functionality in python. Say, one of my real tiny code looks like: #!/bin/bash TMP=store for i in

[issue9584] Allow curly brace expansion

2012-11-09 Thread Tim Golden
Changes by Tim Golden m...@timgolden.me.uk: Removed file: http://bugs.python.org/file27894/0003-reworked-issue9584.patch ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue9584 ___

[issue9584] Allow curly brace expansion

2012-11-09 Thread Tim Golden
Tim Golden added the comment: Given that this isn't going to go ahead in its current form, and will need wider discussion on python-dev, I'm unassigning myself and I've removed the flawed version of the patch which I'd posted. -- assignee: tim.golden -

[issue11313] Speed up default encode()/decode()

2012-11-09 Thread Ezio Melotti
Ezio Melotti added the comment: Agreed, closing. -- resolution: - fixed stage: commit review - committed/rejected status: open - closed versions: +Python 3.4 ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue11313

[issue13301] the script Tools/i18n/msgfmt.py allows arbitrary code execution via po files

2012-11-09 Thread Roundup Robot
Roundup Robot added the comment: New changeset 058ff991bdcb by Ezio Melotti in branch '2.7': #13301: use ast.literal_eval() instead of eval() in Tools/i18n/msgfmt.py. Patch by Serhiy Storchaka. http://hg.python.org/cpython/rev/058ff991bdcb New changeset 2fa338374719 by Ezio Melotti in branch

[issue13301] the script Tools/i18n/msgfmt.py allows arbitrary code execution via po files

2012-11-09 Thread Ezio Melotti
Ezio Melotti added the comment: Fixed, thanks for the patch! -- assignee: - ezio.melotti resolution: - fixed stage: patch review - committed/rejected status: open - closed ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue13301

[issue16444] Use support.TESTFN_UNDECODABLE on UNIX

2012-11-09 Thread Serhiy Storchaka
Serhiy Storchaka added the comment: Try b'\x81', b'\x98', b'\xae', b'\xd5', b'\xff'. They are undecodable in all 1-byte encodings. b'\x81' : shift_jis_2004 shift_jis shift_jisx0213 cp869 cp874 cp932 cp1250 cp1252 cp1253 cp1254 cp1255 cp1257 cp1258 b'\x98' : shift_jis_2004 shift_jis

[issue16444] Use support.TESTFN_UNDECODABLE on UNIX

2012-11-09 Thread Serhiy Storchaka
Serhiy Storchaka added the comment: Try b'\xed\xb2\x80' and b'\xed\xb4\x80' for UTF-8 (on Unix and Mac OS X). b'\xed\xb2\x80' is b'\x80'.decode('utf-8', 'surrogateescape').encode('utf-8', 'surrogatepass'). b'\xed\xb4\x80' is '\udd00'.encode('utf-8', 'surrogatepass') and '\udd00' can't be

[issue16444] Use support.TESTFN_UNDECODABLE on UNIX

2012-11-09 Thread Serhiy Storchaka
Serhiy Storchaka added the comment: The full test suite pass on: The matter is not only in the fact that tests passed. They should fail if the original bug occurs again. Have you tried to restore the bugs? -- ___ Python tracker

[issue16445] SEGFAULT when deleting Exception.message

2012-11-09 Thread Serhiy Storchaka
Serhiy Storchaka added the comment: The Coccinelle looks as an amazing tool! I propose split a patch on several patches (autogenerated code, attributes clearing, other pointer expressions (as *exceptionObject or unicode_latin1[i]) clearing, and local pointers clearing at the end) and commit

[issue16447] SEGFAULT when setting type.__name__

2012-11-09 Thread Serhiy Storchaka
Changes by Serhiy Storchaka storch...@gmail.com: -- components: +Extension Modules, Interpreter Core stage: - needs patch versions: +Python 2.7, Python 3.2, Python 3.3, Python 3.4 ___ Python tracker rep...@bugs.python.org

[issue16447] SEGFAULT when setting type.__name__

2012-11-09 Thread Serhiy Storchaka
Serhiy Storchaka added the comment: Yes, the macro appropriate here. In Modules/zlibmodule.c this patterns should be fixed by patch for issue16350. -- nosy: +serhiy.storchaka ___ Python tracker rep...@bugs.python.org

[issue16335] Integer overflow in unicode-escape decoder

2012-11-09 Thread Ezio Melotti
Ezio Melotti added the comment: Tests would be good. You could use test.support.bigmemtest. -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue16335 ___

[issue16163] Wrong name in Lib/pkgutil.py:iter_importers

2012-11-09 Thread Ezio Melotti
Ezio Melotti added the comment: Given the lack of proper tests for iter_importers, wouldn't adding a proper test that returns something useful, rather than testing only with a non-existent module be better (this test could be kept, maybe converted to an assertRaises)? --

[issue16447] SEGFAULT when setting type.__name__

2012-11-09 Thread Amaury Forgeot d'Arc
Amaury Forgeot d'Arc added the comment: - For the replacement with NULL, Py_CLEAR() should be used instead. - We should use a macro (Py_REF_ASSIGN?) for the replacement case. - Careful, in Modules/_json.c the code is wrong because tmp is already used:: PyObject *tmp =

[issue16163] Wrong name in Lib/pkgutil.py:iter_importers

2012-11-09 Thread Nick Coghlan
Nick Coghlan added the comment: OK, I thought that iter_importers was at least being tested indirectly by the tests for walk_packages: http://hg.python.org/cpython/file/default/Lib/test/test_runpy.py#l417 However, it turns out that iter_modules() only calls iter_importers() if you don't

[issue4965] Can doc index of html version be separately scrollable?

2012-11-09 Thread Ezio Melotti
Ezio Melotti added the comment: In the root of the clone, with the doc already built in Doc/build (no need to rebuild it), do: hg import --no-c http://bugs.python.org/file27887/issue4965.diff cp Doc/tools/sphinxext/static/basic.css Doc/build/html/_static/basic.css firefox

[issue834840] Unhelpful error message from cgi module

2012-11-09 Thread Ezio Melotti
Changes by Ezio Melotti ezio.melo...@gmail.com: -- nosy: +akuchling, ezio.melotti type: enhancement - behavior ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue834840 ___

[issue3154] Quick search box renders too wide if font size is large

2012-11-09 Thread Ezio Melotti
Ezio Melotti added the comment: I can't reproduce this with both the old (2.x) and new (3.x) themes on Firefox 16, so I'm closing this. If someone can still reproduce it, feel free to reopen it. -- resolution: - out of date stage: needs patch - committed/rejected status: open -

[issue2454] sha and md5 fixer

2012-11-09 Thread Ezio Melotti
Ezio Melotti added the comment: What's the status of this? -- nosy: +ezio.melotti ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue2454 ___ ___

[issue15303] Minor revision to the BaseWidget._setup method in Tkinter

2012-11-09 Thread Ezio Melotti
Ezio Melotti added the comment: Can you provide a patch in diff format? You can find more information about how to do it on the devguide. -- nosy: +ezio.melotti, gpolo stage: - needs patch ___ Python tracker rep...@bugs.python.org

[issue15480] Drop TYPE_INT64 from marshal in Python 3.4

2012-11-09 Thread Ezio Melotti
Changes by Ezio Melotti ezio.melo...@gmail.com: -- nosy: +larry priority: deferred blocker - release blocker stage: - needs patch type: - behavior ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue15480

[issue12907] Update test coverage devguide page

2012-11-09 Thread Ezio Melotti
Changes by Ezio Melotti ezio.melo...@gmail.com: -- versions: -Python 3.3 ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue12907 ___ ___

[issue8843] urllib2 Digest Authorization uri must match request URI

2012-11-09 Thread Ezio Melotti
Changes by Ezio Melotti ezio.melo...@gmail.com: -- versions: +Python 3.3, Python 3.4 -Python 2.6, Python 3.1 ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue8843 ___

[issue2818] pulldom cannot handle xml file with large external entity properly

2012-11-09 Thread Ezio Melotti
Changes by Ezio Melotti ezio.melo...@gmail.com: -- stage: - needs patch versions: +Python 3.3, Python 3.4 -Python 3.1 ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue2818 ___

  1   2   >