Re: Overriding a global

2011-12-13 Thread Joshua Landau
On 13/12/2011, Ian Kelly ian.g.ke...@gmail.com wrote: On Mon, Dec 12, 2011 at 4:48 PM, Joshua Landau joshua.landau...@gmail.com wrote: Rebinding logger locally in a function is really no different to a subclass rebinding a variable from its main class using that class' value. The only

Re: Verbose and flexible args and kwargs syntax

2011-12-13 Thread Eelco
On Dec 13, 1:27 am, alex23 wuwe...@gmail.com wrote: On Dec 13, 3:12 am, Eelco hoogendoorn.ee...@gmail.com wrote: But to relate it to the topic of this thread: no, the syntax does not allow one to select the type of the resulting sequence. It always constructs a list. So by this argument,

Re: Verbose and flexible args and kwargs syntax

2011-12-13 Thread Eelco
On Dec 13, 1:34 am, Ian Kelly ian.g.ke...@gmail.com wrote: On Mon, Dec 12, 2011 at 11:51 AM, Eelco hoogendoorn.ee...@gmail.com wrote: Either way, its not hard to add some detail to the semantics to allow all this. Even this function definition: def func(Foo(args), Foo(kwargs)) ...could

Re: Verbose and flexible args and kwargs syntax

2011-12-13 Thread Eelco
On Dec 13, 2:41 am, Ian Kelly ian.g.ke...@gmail.com wrote: On Mon, Dec 12, 2011 at 4:40 PM, Eelco hoogendoorn.ee...@gmail.com wrote: For a linked list, no *target and no copying is needed: head, tail = llist I have no idea what this means. Each node of a linked list consists of a data

Re: Overriding a global

2011-12-13 Thread Antoon Pardon
On 12/10/2011 09:47 PM, Roy Smith wrote: I've got a code pattern I use a lot. In each module, I create a logger for the entire module and log to it all over: logger = logging.getLogger('my.module.name') class Foo: def function(self): logger.debug('stuff') logger.debug('other

Re: Verbose and flexible args and kwargs syntax

2011-12-13 Thread Eelco
On Dec 13, 3:43 am, Steven D'Aprano steve +comp.lang.pyt...@pearwood.info wrote: On Mon, 12 Dec 2011 04:21:15 -0800, Eelco wrote: No more, or less, explicit than the difference between == and is. == may be taken to mean identity comparison; 'equals' can only mean one thing. Nonsense.

Re: Verbose and flexible args and kwargs syntax

2011-12-13 Thread Eelco
Python users generally follow the rule explicit is better than implicit.  Setting a general constraint and letting the language do the right thing is a kind of black magic that feels off because it tends to break that rule.  But that's not to say that black magic never wins -- just look

Re: PyDev and multithreaded application debug

2011-12-13 Thread Fabio Zadrozny
On Mon, Dec 12, 2011 at 2:30 PM, Massi massi_...@msn.com wrote: Hi everyone, I've just started to use pydev to develop my python application and I'm encountering some problems to debug it. The application I'm dealing with is a multithreaded application; when I try to debug it with pydev, it

Re: Overriding a global

2011-12-13 Thread Jean-Michel Pichavant
Steven D'Aprano wrote: On Mon, 12 Dec 2011 12:13:33 +0100, Jean-Michel Pichavant wrote: Using the same name for 2 different objects is a bad idea in general. We have namespaces precisely so you don't need to care about making names globally unique. I don't get your point,

Re: Outputting raw MIDI in realtime on Linux

2011-12-13 Thread Peter Billam
On 2011-12-12, alex23 wuwe...@gmail.com wrote: On Dec 12, 12:14 pm, Nick Irvine nfirv...@nfirvine.com wrote: What do people use to output live MIDI on Linux, assuming it's possible? I've yet to try this myself although it's long been on my to-do list. There are a couple of packages on PyPI

Re: Verbose and flexible args and kwargs syntax

2011-12-13 Thread Eelco
To answer that question: for the same reasons. The conversion is wasteful; allowing python to do the right thing based on a typeconstraint is not. Plus, it is less code, and more readable code; the only rule you have to learn is quite general, which is that :: is a type constraint annotation;

Re: Verbose and flexible args and kwargs syntax

2011-12-13 Thread Arnaud Delobelle
On 13 December 2011 09:50, Eelco hoogendoorn.ee...@gmail.com wrote: To answer that question: for the same reasons. The conversion is wasteful; allowing python to do the right thing based on a typeconstraint is not. Plus, it is less code, and more readable code; the only rule you have to learn

Re: Verbose and flexible args and kwargs syntax

2011-12-13 Thread Eelco
On 13 dec, 11:15, Arnaud Delobelle arno...@gmail.com wrote: On 13 December 2011 09:50, Eelco hoogendoorn.ee...@gmail.com wrote: To answer that question: for the same reasons. The conversion is wasteful; allowing python to do the right thing based on a typeconstraint is not. Plus, it is

Re: Verbose and flexible args and kwargs syntax

2011-12-13 Thread Eelco
With all this being said, I must say that the notion of indtroducing type constraints into Python is quite a radical one*, and one that should not be taken lightly, so I understand the general conservative vibe the notion is getting. It probably has implications beyond just collection types, and

change a file with a context manager

2011-12-13 Thread Andrea Crotti
So I have the following problem, I need something to copy a file to a certain position and restore it after. So I wrote this simple context manager: class WithCorrectEasyInstall(object): def __enter__(self): import pkg_resources from shutil import copyfile

NumPy book review copies

2011-12-13 Thread Jitesh
Hi, As a part of our reviewing program, we are giving away limited number of copies (print electronic) of our recent publication NumPy 1.5 Beginner's Guide to people interested in reviewing the book. Book-link: http://link.packtpub.com/sibctR You need to publish your review/feedback on either

Re: Verbose and flexible args and kwargs syntax

2011-12-13 Thread Steven D'Aprano
On Tue, 13 Dec 2011 01:15:46 -0800, Eelco wrote: On Dec 13, 3:43 am, Steven D'Aprano steve +comp.lang.pyt...@pearwood.info wrote: On Mon, 12 Dec 2011 04:21:15 -0800, Eelco wrote: No more, or less, explicit than the difference between == and is. == may be taken to mean identity

Re: Overriding a global

2011-12-13 Thread Steven D'Aprano
On Tue, 13 Dec 2011 10:54:51 +0100, Jean-Michel Pichavant wrote: Steven D'Aprano wrote: On Mon, 12 Dec 2011 12:13:33 +0100, Jean-Michel Pichavant wrote: Using the same name for 2 different objects is a bad idea in general. We have namespaces precisely so you don't need to care

Re: automate commands to an .exe console program through python

2011-12-13 Thread Juan Perez
Well, if developers have to change something to the code, I'd continue with autoit, since is closer to real enviroment. You are right, autoit work by send parametres to GUI focused, but really I don't think it's something necessary for my purposes as I need only send parameters to a windows cmd

Re: automate commands to an .exe console program through python

2011-12-13 Thread Chris Angelico
On Tue, Dec 13, 2011 at 10:21 PM, Juan Perez corleon...@gmail.com wrote: Well, if developers have to change something to the code, I'd continue with autoit, since is closer to real enviroment. You are right, autoit work by send parametres to GUI focused, but really I don't think it's something

Re: Verbose and flexible args and kwargs syntax

2011-12-13 Thread Steven D'Aprano
On Tue, 13 Dec 2011 02:46:13 -0800, Eelco wrote: With all this being said, I must say that the notion of indtroducing type constraints into Python is quite a radical one*, Not that radical. Here's the creator of Python musing about adding optional type checks to Python:

Re: automate commands to an .exe console program through python

2011-12-13 Thread Tim Golden
On 13/12/2011 11:21, Juan Perez wrote: Well, if developers have to change something to the code, I'd continue with autoit, since is closer to real enviroment. You are right, autoit work by send parametres to GUI focused, but really I don't think it's something necessary for my purposes as I need

Re: Fixing the XML batteries

2011-12-13 Thread Serhiy Storchaka
09.12.11 17:09, Dirkjan Ochtman wrote: On Fri, Dec 9, 2011 at 09:02, Stefan Behnelstefan...@behnel.de wrote: An at least somewhat informed +1 from me. The ElementTree API is a very good way to deal with XML from Python, and it deserves to be promoted over the included alternatives. Let's

Re: Verbose and flexible args and kwargs syntax

2011-12-13 Thread Eelco
On 13 dec, 12:28, Steven D'Aprano steve +comp.lang.pyt...@pearwood.info wrote: On Tue, 13 Dec 2011 02:46:13 -0800, Eelco wrote: With all this being said, I must say that the notion of indtroducing type constraints into Python is quite a radical one*, Not that radical. Here's the creator of

Re: Fixing the XML batteries

2011-12-13 Thread Serhiy Storchaka
09.12.11 17:09, Dirkjan Ochtman wrote: On Fri, Dec 9, 2011 at 09:02, Stefan Behnelstefan...@behnel.de wrote: An at least somewhat informed +1 from me. The ElementTree API is a very good way to deal with XML from Python, and it deserves to be promoted over the included alternatives. Let's

Re: Fixing the XML batteries

2011-12-13 Thread Stefan Behnel
Serhiy Storchaka, 13.12.2011 13:17: 09.12.11 17:09, Dirkjan Ochtman wrote: An at least somewhat informed +1 from me. The ElementTree API is a very good way to deal with XML from Python, and it deserves to be promoted over the included alternatives. Let's deprecate the NiCad batteries and try

Re: automate commands to an .exe console program through python

2011-12-13 Thread Juan Perez
Thank you for your responses, My problem is thinking in windows console somewhat like linux shell, and do same things I did with pipes in C programming. But it seems not to be the case. At a glance I dare say that sendkeys module is useful enough, but if I've understood well, you only can send

Re: automate commands to an .exe console program through python

2011-12-13 Thread Chris Angelico
On Tue, Dec 13, 2011 at 11:35 PM, Juan Perez corleon...@gmail.com wrote: My problem is thinking in windows console somewhat like linux shell, and do same things I did with pipes in C programming. But it seems not to be the case. It is (at least, it supports the basics of pipes and

Re: Verbose and flexible args and kwargs syntax

2011-12-13 Thread Eelco
On 13 dec, 12:13, Steven D'Aprano steve +comp.lang.pyt...@pearwood.info wrote: On Tue, 13 Dec 2011 01:15:46 -0800, Eelco wrote: On Dec 13, 3:43 am, Steven D'Aprano steve +comp.lang.pyt...@pearwood.info wrote: On Mon, 12 Dec 2011 04:21:15 -0800, Eelco wrote: No more, or less, explicit

Re: Verbose and flexible args and kwargs syntax

2011-12-13 Thread Chris Angelico
On Tue, Dec 13, 2011 at 11:47 PM, Eelco hoogendoorn.ee...@gmail.com wrote: def f(*args) *constructs* a tuple, it doesn't perform a type-check. I am talking about type constraints... A type-check is something along the lines of type(args)==list, a runtime thing and something completely

Re: Overriding a global

2011-12-13 Thread Jean-Michel Pichavant
Steven D'Aprano wrote: On Tue, 13 Dec 2011 10:54:51 +0100, Jean-Michel Pichavant wrote: Steven D'Aprano wrote: On Mon, 12 Dec 2011 12:13:33 +0100, Jean-Michel Pichavant wrote: Using the same name for 2 different objects is a bad idea in general. We have

Signature-preserving decorators

2011-12-13 Thread Henrik Faber
Hi group, when decorating a method in Python3, by use of the functools.update_wrapper function, it can be achieved that the docstring and name of the original function is preseverved. However, the prototype is lost: When looking into the Python help, I have lots of entries that look like:

Re: Verbose and flexible args and kwargs syntax

2011-12-13 Thread Eelco
On 13 dec, 14:14, Chris Angelico ros...@gmail.com wrote: On Tue, Dec 13, 2011 at 11:47 PM, Eelco hoogendoorn.ee...@gmail.com wrote: def f(*args) *constructs* a tuple, it doesn't perform a type-check. I am talking about type constraints... A type-check is something along the lines of

Re: change a file with a context manager

2011-12-13 Thread Andrea Crotti
On 12/13/2011 10:59 AM, Andrea Crotti wrote: So I have the following problem, I need something to copy a file to a certain position and restore it after. So I wrote this simple context manager: class WithCorrectEasyInstall(object): def __enter__(self): import pkg_resources

Re: Dynamic variable creation from string

2011-12-13 Thread 88888 Dihedral
On Tuesday, December 13, 2011 9:35:52 AM UTC+8, Steven D#39;Aprano wrote: On Mon, 12 Dec 2011 15:45:06 -0800, alex23 wrote: On Dec 12, 10:49 pm, 8 Dihedral dihedr...@googlemail.com wrote: This is the way to write an assembler or to roll out a script language to be included in an app

Re: Fixing the XML batteries

2011-12-13 Thread Serhiy Storchaka
13.12.11 14:32, Stefan Behnel написав(ла): I stripped my name from the quoted context because I didn't say this. I am glad to hear this. ;) I use xml.dom.minidom for XML canonization and convertion: Do you mean canonicalisation? I.e. C14N? That's not what the code below is doing, not at

Re: Fixing the XML batteries

2011-12-13 Thread Stefan Behnel
Serhiy Storchaka, 13.12.2011 15:27: 13.12.11 14:32, Stefan Behnel написав(ла): I stripped my name from the quoted context because I didn't say this. I am glad to hear this. ;) It matches my opinion though. I use xml.dom.minidom for XML canonization and convertion: Do you mean

logging issues

2011-12-13 Thread Andrea Crotti
I think is simple but I can't get it to work as I wish. Suppose I have a big application, my idea is that the running script sets a global logging level and then all the imported modules would act consequently. In my codebase, however, unless I set the level for each of the loggers I don't get

Using methodcaller in a list sort - any examples anywhere?

2011-12-13 Thread tinnews
I want to sort a list of 'things' (they're fairly complex objects) by the contents of one of the fields I can extract from the 'things' using a Python function. So I have a list L which is a list of objects of some sort. I can output the contents of a field in the list as follows:- for k in

Re: logging issues

2011-12-13 Thread Jean-Michel Pichavant
Andrea Crotti wrote: I think is simple but I can't get it to work as I wish. Suppose I have a big application, my idea is that the running script sets a global logging level and then all the imported modules would act consequently. In my codebase, however, unless I set the level for each of the

Re: Using methodcaller in a list sort - any examples anywhere?

2011-12-13 Thread Peter Otten
tinn...@isbd.co.uk wrote: I want to sort a list of 'things' (they're fairly complex objects) by the contents of one of the fields I can extract from the 'things' using a Python function. So I have a list L which is a list of objects of some sort. I can output the contents of a field in

Re: logging issues

2011-12-13 Thread Andrea Crotti
On 12/13/2011 04:11 PM, Jean-Michel Pichavant wrote: Not really, if you use the classic way, your subloggers should be created an never configured. Their default behavior is to raise any log event to its parent. That way, all event logs end up being handled by the root logger. Ok thanks

boolean from a function

2011-12-13 Thread Andrea Crotti
I'm not sure for how long I had this bug, and I could not understand the problem. I had a function which would return a boolean def func_bool(): if x: return True else: return False Now somewhere else I had if func_bool: # do something I could not quite understand why it

Re: Getting the current directory path and the path where python script is saved

2011-12-13 Thread Neil Cerutti
On 2011-12-13, gialloporpora gialloporp...@gmail.com wrote: Dear all, I would like to create a little script to rename my files, I think to use argparse module to create it. I would like to know how to obtain the path where script is executed and the path where the file script is stored.

Re: Signature-preserving decorators

2011-12-13 Thread Ian Kelly
On Tue, Dec 13, 2011 at 6:36 AM, Henrik Faber hfa...@invalid.net wrote: Hi group, when decorating a method in Python3, by use of the functools.update_wrapper function, it can be achieved that the docstring and name of the original function is preseverved. However, the prototype is lost:

Re: Getting the current directory path and the path where python script is saved

2011-12-13 Thread Thomas Bach
gialloporpora gialloporp...@gmail.com writes: I would like to know how to obtain the path where script is executed and the path where the file script is stored. Does this help: In [16]: import os In [19]: os.getcwd() Out[19]: '/home/vince' In [21]: os.__file__ Out[21]:

icmp and raw sockets in python

2011-12-13 Thread Sagy Drucker
hello i am relatively new to python, so please be considerate... i'm implementing a server and a client via raw_sockets. i have the necessary privileges. now, the server i defined so: host = socket.gethostbyname(socket.gethostname()) address = (host, 4) sockSer =

Re: logging issues

2011-12-13 Thread Andrea Crotti
And by the way suppose I have a script which takes as input the log level and a list of possible filters. In another file I have a couple of functions as below which are called in that order. Is that supposed to work? In theory I'm getting both times the same logger. The set_verbosity seems to

Re: Using methodcaller in a list sort - any examples anywhere?

2011-12-13 Thread tinnews
Peter Otten __pete...@web.de wrote: tinn...@isbd.co.uk wrote: I want to sort a list of 'things' (they're fairly complex objects) by the contents of one of the fields I can extract from the 'things' using a Python function. So I have a list L which is a list of objects of some sort.

Re: Using methodcaller in a list sort - any examples anywhere?

2011-12-13 Thread Tim Chase
On 12/13/11 09:48, tinn...@isbd.co.uk wrote: I want to sort a list of 'things' (they're fairly complex objects) by the contents of one of the fields I can extract from the 'things' using a Python function. So I have a list L which is a list of objects of some sort. I can output the contents of

text to html

2011-12-13 Thread prakash jp
Hi All, Want to publish a log file as a web page, is there a parser to retain the format of the text as is and then convert to html. Please provide the relevant pointers Thanks -- http://mail.python.org/mailman/listinfo/python-list

Re: boolean from a function

2011-12-13 Thread Grant Edwards
On 2011-12-13, Andrea Crotti andrea.crott...@gmail.com wrote: Now somewhere else I had if func_bool: # do something I could not quite understand why it was always true, until I finally noticed that the () were missing. Is there some tool to avoid these stupid mistakes? (pylint

Re: text to html

2011-12-13 Thread Pedro Henrique Guedes Souto
On Tue, Dec 13, 2011 at 3:22 PM, prakash jp prakash.st...@gmail.com wrote: Hi All, Want to publish a log file as a web page, is there a parser to retain the format of the text as is and then convert to html. Please provide the relevant pointers Hey, You can use this: http://txt2tags.org/

Re: boolean from a function

2011-12-13 Thread Duncan Booth
Andrea Crotti andrea.crott...@gmail.com wrote: I'm not sure for how long I had this bug, and I could not understand the problem. I had a function which would return a boolean def func_bool(): if x: return True else: return False Now somewhere else I had if

Re: text to html

2011-12-13 Thread Grant Edwards
On 2011-12-13, Pedro Henrique Guedes Souto pedro.h.so...@gmail.com wrote: On Tue, Dec 13, 2011 at 3:22 PM, prakash jp prakash.st...@gmail.com wrote: Want to publish a log file as a web page, is there a parser to retain the format of the text as is and then convert to html. Please provide the

Re: Verbose and flexible args and kwargs syntax

2011-12-13 Thread Ian Kelly
On Tue, Dec 13, 2011 at 1:44 AM, Eelco hoogendoorn.ee...@gmail.com wrote: 'for i in llist' is not quite going to fly is it? Thats probably the reason noone ever uses that construct; its not a proper sequence type. Not really a problem, because fortunately Python makes it super-easy to create

Re: boolean from a function

2011-12-13 Thread Ethan Furman
Andrea Crotti wrote: I'm not sure for how long I had this bug, and I could not understand the problem. I had a function which would return a boolean def func_bool(): if x: return True else: return False Now somewhere else I had if func_bool: # do something I could not

Re: Fixing the XML batteries

2011-12-13 Thread Serhiy Storchaka
13.12.11 16:59, Stefan Behnel написав(ла): It matches my opinion though. I would be glad to divide your intentions, however ElementTree looks less documented than minidom, and is not full replacement. For example, I haven't found how to get XML encoding. Also, at use of ElementTree instead

Re: Overriding a global

2011-12-13 Thread Joshua Landau
On 13 December 2011 13:30, Jean-Michel Pichavant jeanmic...@sequans.comwrote: writing x = 1 def spam(): x = 2 is in general a bad idea. That was my point. Why? I have a few (probably wrong) guesses. Because you expect it to be the same every time you use it? Well, then this should be

Re: Verbose and flexible args and kwargs syntax

2011-12-13 Thread Cameron Simpson
On 13Dec2011 00:30, Eelco hoogendoorn.ee...@gmail.com wrote: | On Dec 13, 1:27 am, alex23 wuwe...@gmail.com wrote: | On Dec 13, 3:12 am, Eelco hoogendoorn.ee...@gmail.com wrote: | But to relate it to the topic of this thread: no, the syntax does not | allow one to select the type of the

Re: Overriding a global

2011-12-13 Thread Ian Kelly
On Tue, Dec 13, 2011 at 1:34 AM, Joshua Landau joshua.landau...@gmail.com wrote: No, there is another difference, the reason for rebinding the name. In a subclass, you would rebind a class attribute because that particular attribute, which you need to change, is used and expected by external

Re: Fixing the XML batteries

2011-12-13 Thread Stefan Behnel
Serhiy Storchaka, 13.12.2011 19:57: 13.12.11 16:59, Stefan Behnel написав(ла): It matches my opinion though. I would be glad to divide your intentions, however ElementTree looks less documented than minidom It's certainly a lot smaller, which makes its API easier to learn and remember.

Re: Overriding a global

2011-12-13 Thread Joshua Landau
On 13 December 2011 19:34, Ian Kelly ian.g.ke...@gmail.com wrote: On Tue, Dec 13, 2011 at 1:34 AM, Joshua Landau joshua.landau...@gmail.com wrote: No, there is another difference, the reason for rebinding the name. In a subclass, you would rebind a class attribute because that particular

pyside dynamic buttons

2011-12-13 Thread Richard
Hi, We are making a screen with data driven buttons. I can add buttons but can't redraw the buttons for new values. The buttuns are placed in a frame. I draw the buttons on the screen in a for loop: def drawS1Butons(self): n=0 for self.S1 in self.Org.getVpuChilds(self.Focus):

Re: Fixing the XML batteries

2011-12-13 Thread ru...@yahoo.com
On Dec 13, 5:32 am, Stefan Behnel stefan...@behnel.de wrote: ... In Python 2.7/3.2, ElementTree has support for C14N serialisation, just pass the option method=c14n. Where in the Python docs can one find information about this? [previous post disappeared, sorry if I double posted or replied to

Re: Overriding a global

2011-12-13 Thread Ian Kelly
On Tue, Dec 13, 2011 at 12:43 PM, Joshua Landau joshua.landau...@gmail.com wrote: On 13 December 2011 19:34, Ian Kelly ian.g.ke...@gmail.com wrote: On Tue, Dec 13, 2011 at 1:34 AM, Joshua Landau joshua.landau...@gmail.com wrote: No, there is another difference, the reason for rebinding the

Re: Fixing the XML batteries

2011-12-13 Thread ru...@yahoo.com
On Dec 13, 5:32 am, Stefan Behnel stefan...@behnel.de wrote: ... In Python 2.7/3.2, ElementTree has support for C14N serialisation, just pass the option method=c14n. Where does one find information in the Python documentation about this? -- http://mail.python.org/mailman/listinfo/python-list

Re: Fixing the XML batteries

2011-12-13 Thread Stefan Behnel
ru...@yahoo.com, 13.12.2011 20:37: On Dec 13, 5:32 am, Stefan Behnel wrote: In Python 2.7/3.2, ElementTree has support for C14N serialisation, just pass the option method=c14n. Where does one find information in the Python documentation about this? Hmm, interesting. I though it had, but now

Re: Verbose and flexible args and kwargs syntax

2011-12-13 Thread Eelco
On Dec 13, 8:11 pm, Cameron Simpson c...@zip.com.au wrote: On 13Dec2011 00:30, Eelco hoogendoorn.ee...@gmail.com wrote: | On Dec 13, 1:27 am, alex23 wuwe...@gmail.com wrote: | On Dec 13, 3:12 am, Eelco hoogendoorn.ee...@gmail.com wrote: | But to relate it to the topic of this thread: no,

Re: Overriding a global

2011-12-13 Thread Joshua Landau
On 13 December 2011 19:54, Ian Kelly ian.g.ke...@gmail.com wrote: On Tue, Dec 13, 2011 at 12:43 PM, Joshua Landau joshua.landau...@gmail.com wrote: On 13 December 2011 19:34, Ian Kelly ian.g.ke...@gmail.com wrote: On Tue, Dec 13, 2011 at 1:34 AM, Joshua Landau joshua.landau...@gmail.com

Re: Verbose and flexible args and kwargs syntax

2011-12-13 Thread Eelco
On Dec 13, 7:15 pm, Ian Kelly ian.g.ke...@gmail.com wrote: On Tue, Dec 13, 2011 at 1:44 AM, Eelco hoogendoorn.ee...@gmail.com wrote: 'for i in llist' is not quite going to fly is it? Thats probably the reason noone ever uses that construct; its not a proper sequence type. Not really a

Re: Fixing the XML batteries

2011-12-13 Thread ru...@yahoo.com
On Dec 13, 1:21 pm, Stefan Behnel stefan...@behnel.de wrote: ru...@yahoo.com, 13.12.2011 20:37: On Dec 13, 5:32 am, Stefan Behnel wrote: In Python 2.7/3.2, ElementTree has support for C14N serialisation, just pass the option method=c14n. Where does one find information in the Python

Re: change a file with a context manager

2011-12-13 Thread Terry Reedy
On 12/13/2011 9:21 AM, Andrea Crotti wrote: Another possible option is to just add to the path everything contained in that correct easy_install.pth file. Or is there a way to reload the path settings? If you are talking about sys.path, you can certainly copy, mutate or replace, and restore

Re: icmp and raw sockets in python

2011-12-13 Thread Martin P. Hellwig
On 13/12/2011 16:50, Sagy Drucker wrote: hello Hi i am relatively new to python, so please be considerate... As I am only responding to one of your questions, perhaps it would be best if you don't get any other more helpful replies to split your questions up and post them separately. i'm

xml, minidom, ElementTree

2011-12-13 Thread Ethan Furman
In the near future I will need to parse and rewrite parts of a xml files created by a third-party program (PrintShopMail, for the curious). It contains both binary and textual data. There has been some strong debate about the merits of minidom vs ElementTree. Recommendations? ~Ethan~ --

Re: boolean from a function

2011-12-13 Thread Steven D'Aprano
On Tue, 13 Dec 2011 16:24:05 +, Andrea Crotti wrote: I'm not sure for how long I had this bug, and I could not understand the problem. I had a function which would return a boolean def func_bool(): if x: return True else: return False x is a global? Poor design.

Re: pyside dynamic buttons

2011-12-13 Thread Vincent Vande Vyvre
Le 13/12/11 20:46, Richard a crit: Hi, We are making a screen with data driven buttons. I can add buttons but can't redraw the buttons for new values. The buttuns are placed in a frame. I draw the buttons on the screen in a for loop: def drawS1Butons(self): n=0

% is not an operator [was Re: Verbose and flexible args and kwargs syntax]

2011-12-13 Thread Steven D'Aprano
On Mon, 12 Dec 2011 09:29:11 -0800, Eelco wrote: [quoting Jussi Piitulainen jpiit...@ling.helsinki.fi] They recognize modular arithmetic but for some reason insist that there is no such _binary operation_. But as I said, I don't understand their concern. (Except the related concern about some

Re: xml, minidom, ElementTree

2011-12-13 Thread Terry Reedy
On 12/13/2011 6:21 PM, Ethan Furman wrote: In the near future I will need to parse and rewrite parts of a xml files created by a third-party program (PrintShopMail, for the curious). It contains both binary and textual data. There has been some strong debate about the merits of minidom vs

AttributeError in with statement (3.2.2)

2011-12-13 Thread Steve Howell
I'm using Python 3.2.2, and the following program gives me an error that I don't understand: class Foo: pass foo = Foo() foo.name = Steve def add_goodbye_function(obj): def goodbye(): print(goodbye + obj.name) obj.goodbye = goodbye add_goodbye_function(foo) foo.goodbye() # outputs

Re: AttributeError in with statement (3.2.2)

2011-12-13 Thread Eric Snow
On Tue, Dec 13, 2011 at 10:42 PM, Steve Howell showel...@yahoo.com wrote: I'm using Python 3.2.2, and the following program gives me an error that I don't understand: class Foo:  pass foo = Foo() foo.name = Steve def add_goodbye_function(obj):  def goodbye():    print(goodbye +

Re: AttributeError in with statement (3.2.2)

2011-12-13 Thread Terry Reedy
On 12/14/2011 1:05 AM, Eric Snow wrote: On Tue, Dec 13, 2011 at 10:42 PM, Steve Howellshowel...@yahoo.com wrote: I'm using Python 3.2.2, and the following program gives me an error that I don't understand: class Foo: pass foo = Foo() foo.name = Steve def add_goodbye_function(obj): def

Re: xml, minidom, ElementTree

2011-12-13 Thread Stefan Behnel
Terry Reedy, 14.12.2011 06:01: On 12/13/2011 6:21 PM, Ethan Furman wrote: In the near future I will need to parse and rewrite parts of a xml files created by a third-party program (PrintShopMail, for the curious). It contains both binary and textual data. There has been some strong debate

[issue13585] Add contextlib.CleanupManager

2011-12-13 Thread Raymond Hettinger
Raymond Hettinger raymond.hettin...@gmail.com added the comment: Thanks Nick. You're awesome. -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue13585 ___

[issue13516] Gzip old log files in rotating handlers

2011-12-13 Thread Vinay Sajip
Vinay Sajip vinay_sa...@yahoo.co.uk added the comment: See this for the proposed resolution: http://plumberjack.blogspot.com/2011/12/improved-flexibility-for-log-file.html -- ___ Python tracker rep...@bugs.python.org

[issue13592] repr(regex) doesn't include actual regex

2011-12-13 Thread Martin Häcker
New submission from Martin Häcker spamfaen...@gmx.de: When calling repr() on a compiled regex pattern like this: import re repr(re.compile('foo')) you don't get the pattern of the regex out of the compiled form. Also all my research has shown no getter to allow this. I noticed this in my

[issue13592] repr(regex) doesn't include actual regex

2011-12-13 Thread Ezio Melotti
Ezio Melotti ezio.melo...@gmail.com added the comment: I'm not sure having the pattern in the repr will make it more readable, since the regex might even be very long. You can use the .pattern attribute if you want to see the pattern. -- nosy: +ezio.melotti status: open - pending

[issue13585] Add contextlib.CleanupManager

2011-12-13 Thread Nick Coghlan
Nick Coghlan ncogh...@gmail.com added the comment: And the backport: http://contextlib2.readthedocs.org/ I haven't tested on anything other than 2.7 as yet - I have an account request in train with the Shining Panda folks, so I'll set up multi-version CI for this project (along with a couple

[issue13577] __qualname__ is not present on builtin methods and functions

2011-12-13 Thread sbt
sbt shibt...@gmail.com added the comment: sbt, have you been running the test suite before submitting patches? If not, then please do. I ran it after I submitted. Sorry. Here is another patch. It also makes sure that __self__ is reported as None when METH_STATIC. -- Added file:

[issue13549] Incorrect nested list comprehension documentation

2011-12-13 Thread Roundup Robot
Roundup Robot devn...@psf.upfronthosting.co.za added the comment: New changeset 132158b287d7 by Ezio Melotti in branch '2.7': #13549: improve tutorial section about listcomps. http://hg.python.org/cpython/rev/132158b287d7 New changeset ad5c70296c7b by Ezio Melotti in branch '3.2': #13549:

[issue13549] Incorrect nested list comprehension documentation

2011-12-13 Thread Ezio Melotti
Ezio Melotti ezio.melo...@gmail.com added the comment: Fixed. On a side note, using: [x, x**2 for x in range(6)] File stdin, line 1 [x, x**2 for x in range(6)] ^ SyntaxError: invalid syntax In the 3.x docs seems to break the hightlight. With 'File stdin, line 1, in ?' the

[issue6570] Tutorial clarity: section 4.7.2, parameters and arguments

2011-12-13 Thread Roundup Robot
Roundup Robot devn...@psf.upfronthosting.co.za added the comment: New changeset d60856651139 by Ezio Melotti in branch '2.7': #6570: clarify tutorial section about keyword arguments. http://hg.python.org/cpython/rev/d60856651139 New changeset 44ca4264dc88 by Ezio Melotti in branch '3.2': #6570:

[issue6570] Tutorial clarity: section 4.7.2, parameters and arguments

2011-12-13 Thread Ezio Melotti
Changes by Ezio Melotti ezio.melo...@gmail.com: -- resolution: - fixed stage: commit review - committed/rejected status: open - closed ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue6570 ___

[issue13593] importlib needs to be updated for __qualname__

2011-12-13 Thread Meador Inge
New submission from Meador Inge mead...@gmail.com: I was recently reading the 'importlib' code and noticed that the utility decorators have not been updated for '__qualname__': def f(): pass ... importlib.util.set_loader(f) function set_loader.locals.wrapper at 0x7f4b323f1f60

[issue13394] Patch to increase aifc lib test coverage

2011-12-13 Thread Ezio Melotti
Ezio Melotti ezio.melo...@gmail.com added the comment: Thanks for splitting the patch. I tried to apply the patch to 3.2 and I have 3 comments: 1) you changed a commented-out assertEqual with an assertNotEqual, because ULAW is lossy compression, so frames *may* not match. Does it mean that

[issue13593] importlib needs to be updated for __qualname__

2011-12-13 Thread Ezio Melotti
Changes by Ezio Melotti ezio.melo...@gmail.com: -- nosy: +pitrou stage: patch review - commit review ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue13593 ___

[issue13540] Document the Action API in argparse

2011-12-13 Thread Jason R. Coombs
Jason R. Coombs jar...@jaraco.com added the comment: You're right. The documentation isn't incorrect, if you're splitting hairs. But it's not super friendly either. Questions that the documentation should answer: 1) Does the action always need to be a subclass of an Action, or is that

[issue13591] import_module potentially imports a module twice

2011-12-13 Thread Meador Inge
Meador Inge mead...@gmail.com added the comment: I can reproduce this on tip. What happens is that 'importlib.import_module(my_lib.bar)' is effectively computed as: import my_lib import bar by '_bootstrap._gcd_import'. When '_gcd_import' goes to do the import of 'bar' it does *not*

[issue13585] Add contextlib.CleanupManager

2011-12-13 Thread Sven Marnach
Sven Marnach s...@marnach.net added the comment: I think that the fact that Nick got the code to close multiple files wrong underlines that it is difficult to get right currently. Nick's code try: files = [open(fname) for fname in names] # ... finally: for f in

[issue13593] importlib needs to be updated for __qualname__

2011-12-13 Thread Antoine Pitrou
Antoine Pitrou pit...@free.fr added the comment: Looks ok to me. -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue13593 ___ ___ Python-bugs-list

  1   2   >