Re: AttributeError in with statement (3.2.2)

2011-12-14 Thread Steven D'Aprano
On Wed, 14 Dec 2011 01:29:13 -0500, Terry Reedy wrote: To complement what Eric says below: The with statement is looking for an instance *method*, which by definition, is a function attribute of a *class* (the class of the context manager) that takes an instance of the class as its first

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

2011-12-14 Thread Eelco
On Dec 14, 4:18 am, Steven D'Aprano steve +comp.lang.pyt...@pearwood.info wrote: They might not be willing to define it, but as soon as we programmers do, well, we did. Having studied the contemporary philosophy of mathematics, their concern is probably that in their minds, mathematics is

Property Abuse

2011-12-14 Thread Felipe O
Hi All, I was wondering what everyone's thought process was regarding properties. Lately I find I've been binging on them and have classes with 10 properties. While pylint doesn't complain (yet), it tends to be picky about keeping instance attribute counts low, so I figure there's something

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

2011-12-14 Thread Jussi Piitulainen
Steven D'Aprano writes: 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

Re: Verbose and flexible args and kwargs syntax

2011-12-14 Thread Jussi Piitulainen
Nick Dokos writes: Jussi Piitulainen wrote: 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 programming languages, not Python, where the remainder

Re: boolean from a function

2011-12-14 Thread Andrea Crotti
On 12/13/2011 11:37 PM, Steven D'Aprano wrote: x is a global? Poor design. But in any case, instead of an explicit if...else block, the canonical way to convert an arbitrary object to True/ False is with bool: def func_bool(): return bool(x) But you don't need it. See below. No no it

Re: % is not an operator

2011-12-14 Thread Paul Rudin
Steven D'Aprano steve+comp.lang.pyt...@pearwood.info writes: The existence of two potential answers for the remainder is certainly correct, but the conclusion that remainder is not a binary operation doesn't follow. It is a binary relation. This depends on your definition of operation.

Re: xml, minidom, ElementTree

2011-12-14 Thread Paul Rudin
Ethan Furman et...@stoneleaf.us writes: 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

Re: AttributeError in with statement (3.2.2)

2011-12-14 Thread Peter Otten
Steve Howell 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 + obj.name) obj.goodbye = goodbye

Re: Overriding a global

2011-12-14 Thread Jean-Michel Pichavant
Joshua Landau wrote: On 13 December 2011 13:30, Jean-Michel Pichavant jeanmic...@sequans.com mailto:jeanmic...@sequans.com wrote: 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

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

2011-12-14 Thread Eelco
On 14 dec, 09:56, Jussi Piitulainen jpiit...@ling.helsinki.fi wrote: Steven D'Aprano writes: 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

Re: Overriding a global

2011-12-14 Thread Chris Angelico
On Wed, Dec 14, 2011 at 9:14 PM, Jean-Michel Pichavant jeanmic...@sequans.com wrote: The problem makes little sense when using names like x or func1. Besides namespace issues, naming 2 *different objects* with the same meaningful name is usually a bad idea and points the fact that your names

Regexp : repeated group identification

2011-12-14 Thread candide
Consider the following code # import re z=re.match('(Spam\d)+', 'Spam4Spam2Spam7Spam8') print z.group(0) print z.group(1) # outputting : Spam4Spam2Spam7Spam8 Spam8 The

Question (PDE solvers in Python)

2011-12-14 Thread narges javaheri
Hello there, Based on your experiences, what's the best (the most reliable) package for solving a system of nonlinear coupled PDEs (partial differential equations) in 3D using Python, preferably by FEM (finite element method)? Regards, Narges --

Re: Regexp : repeated group identification

2011-12-14 Thread Vlastimil Brom
2011/12/14 candide candide@free.invalid: Consider the following code # import re z=re.match('(Spam\d)+', 'Spam4Spam2Spam7Spam8') print z.group(0) print z.group(1) # outputting :

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

2011-12-14 Thread rusi
On Dec 14, 1:56 pm, Jussi Piitulainen jpiit...@ling.helsinki.fi wrote: Is someone saying that _division_ is not defined because -42 div -5 is somehow both 9 and 8? Hm, yes, I see that someone might. The two operations, div and rem, need to be defined together. -

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

2011-12-14 Thread Chris Angelico
On Wed, Dec 14, 2011 at 10:47 PM, rusi rustompm...@gmail.com wrote: `quot` is integer division truncated toward zero, while the result of `div` is truncated toward negative infinity. All these problems just because of negative numbers. They ought never to have been invented. At least nobody

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

2011-12-14 Thread Arnaud Delobelle
On 14 December 2011 07:49, Eelco hoogendoorn.ee...@gmail.com wrote: On Dec 14, 4:18 am, Steven D'Aprano steve +comp.lang.pyt...@pearwood.info wrote: They might not be willing to define it, but as soon as we programmers do, well, we did. Having studied the contemporary philosophy of

Re: Overriding a global

2011-12-14 Thread Jean-Michel Pichavant
Chris Angelico wrote: On Wed, Dec 14, 2011 at 9:14 PM, Jean-Michel Pichavant jeanmic...@sequans.com wrote: The problem makes little sense when using names like x or func1. Besides namespace issues, naming 2 *different objects* with the same meaningful name is usually a bad idea and points

Re: Overriding a global

2011-12-14 Thread Chris Angelico
On Wed, Dec 14, 2011 at 11:05 PM, Jean-Michel Pichavant jeanmic...@sequans.com wrote: Chris Angelico wrote: So... it's a bad idea for me to use 'i' many times in my code, with the same name having different meanings in different places? In languages with infinitely-nesting scopes... Bad

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

2011-12-14 Thread Jussi Piitulainen
Eelco writes: On 14 dec, 09:56, Jussi Piitulainen wrote: But I think the argument there are several such functions, therefore, _in mathematics_, there is no such function is its own caricature. Indeed. Obtaining a well defined function is just a matter of picking a convention and

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

2011-12-14 Thread Juan Perez
Hi, Well if I can remmeber since last time I did something similar in C, it was close stdin channel in the open devices table (I don't know if it is the correct name in english, I learnt it in spanish) and put a pipe on it and then create a fork, parent it comunicates to the child through the

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

2011-12-14 Thread Steven D'Aprano
On Wed, 14 Dec 2011 10:56:02 +0200, Jussi Piitulainen wrote: Steven D'Aprano writes: 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

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

2011-12-14 Thread Eelco
On 14 dec, 12:55, Arnaud Delobelle arno...@gmail.com wrote: On 14 December 2011 07:49, Eelco hoogendoorn.ee...@gmail.com wrote: On Dec 14, 4:18 am, Steven D'Aprano steve +comp.lang.pyt...@pearwood.info wrote: They might not be willing to define it, but as soon as we programmers do,

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

2011-12-14 Thread Steven D'Aprano
On Wed, 14 Dec 2011 02:09:32 -0800, Eelco wrote: Arguably, the most elegant thing to do is to define integer division and remainder as a single operation; which is not only the logical thing to do mathematically, but might work really well programmatically too. The semantics of python dont

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

2011-12-14 Thread Eelco
On 14 dec, 13:22, Jussi Piitulainen jpiit...@ling.helsinki.fi wrote: Is someone saying that _division_ is not defined because -42 div -5 is somehow both 9 and 8? Hm, yes, I see that someone might. The two operations, div and rem, need to be defined together. (There is no way to make

Re: [GENERAL] Philosophical question

2011-12-14 Thread Chris Angelico
On Wed, Dec 14, 2011 at 11:32 PM, Andreas maps...@gmx.net wrote: Hi, I asked elsewhere about the best way to store db credentials within a user-session of a web-app. It appeared that it was for everybody but me evident that instead of heaving a db-role+passwd for every user of an

Re: Overriding a global

2011-12-14 Thread Steven D'Aprano
On Wed, 14 Dec 2011 13:05:19 +0100, Jean-Michel Pichavant wrote: Bad ideas : i = 5 def spam(): for i,v in enumerate([1,2,3,4]): for i,v in enumerate(['a','b', 'c']): print i, v print i,v # bad surprise The bad surprise happens because you are using the same name twice

Re: Regexp : repeated group identification

2011-12-14 Thread candide
Le 14/12/2011 12:34, Vlastimil Brom a écrit : If a group is contained in a part of the pattern that matched multiple times, the last match is returned. I missed this point, your answer matches my question ;) thanks. If you need to work with the content captured in the repeated group, you

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

2011-12-14 Thread Jussi Piitulainen
rusi writes: On Dec 14, 1:56 pm, Jussi Piitulainen jpiit...@ling.helsinki.fi wrote: Is someone saying that _division_ is not defined because -42 div -5 is somehow both 9 and 8? Hm, yes, I see that someone might. The two operations, div and rem, need to be defined together.

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

2011-12-14 Thread Jussi Piitulainen
Steven D'Aprano writes: On Wed, 14 Dec 2011 10:56:02 +0200, Jussi Piitulainen wrote: I'm not misunderstanding any argument. There was no argument. There was a blanket pronouncement that _in mathematics_ mod is not a binary operator. I should learn to challenge such pronouncements and ask

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

2011-12-14 Thread Eelco
On Dec 14, 1:38 pm, Steven D'Aprano steve +comp.lang.pyt...@pearwood.info wrote: On Wed, 14 Dec 2011 02:09:32 -0800, Eelco wrote: Arguably, the most elegant thing to do is to define integer division and remainder as a single operation; which is not only the logical thing to do

Re: Overriding a global

2011-12-14 Thread Jean-Michel Pichavant
Steven D'Aprano wrote: On Wed, 14 Dec 2011 13:05:19 +0100, Jean-Michel Pichavant wrote: Bad ideas : i = 5 def spam(): for i,v in enumerate([1,2,3,4]): for i,v in enumerate(['a','b', 'c']): print i, v print i,v # bad surprise The bad surprise happens because you are

Re: Regexp : repeated group identification

2011-12-14 Thread Vlastimil Brom
2011/12/14 candide candide@free.invalid: ... Thanks for the reference and the example. I didn't know of this reimplementation, hoping it offers the Aho-Corasick algorithm allowing multiple keys search. -- http://mail.python.org/mailman/listinfo/python-list Hi, I am not sure about the

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

2011-12-14 Thread Chris Angelico
On Thu, Dec 15, 2011 at 12:29 AM, Eelco hoogendoorn.ee...@gmail.com wrote: On Dec 14, 1:38 pm, Steven D'Aprano steve +comp.lang.pyt...@pearwood.info wrote: That would be: divmod(17, 5) (3, 2) Cool; if only it were in the math module id be totally happy. That's easily solved. import

Re: text to html

2011-12-14 Thread James Mills
On Dec 14, 3:30 am, 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

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

2011-12-14 Thread Ian Kelly
On Wed, Dec 14, 2011 at 6:29 AM, Eelco hoogendoorn.ee...@gmail.com wrote: On Dec 14, 1:38 pm, Steven D'Aprano steve +comp.lang.pyt...@pearwood.info wrote: On Wed, 14 Dec 2011 02:09:32 -0800, Eelco wrote: Arguably, the most elegant thing to do is to define integer division and remainder as a

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

2011-12-14 Thread Arnaud Delobelle
On 14 December 2011 12:33, Eelco hoogendoorn.ee...@gmail.com wrote: On 14 dec, 12:55, Arnaud Delobelle arno...@gmail.com wrote: On 14 December 2011 07:49, Eelco hoogendoorn.ee...@gmail.com wrote: On Dec 14, 4:18 am, Steven D'Aprano steve +comp.lang.pyt...@pearwood.info wrote: They might

Re: AttributeError in with statement (3.2.2)

2011-12-14 Thread 88888 Dihedral
On Wednesday, December 14, 2011 4:01:24 PM UTC+8, Steven D#39;Aprano wrote: On Wed, 14 Dec 2011 01:29:13 -0500, Terry Reedy wrote: To complement what Eric says below: The with statement is looking for an instance *method*, which by definition, is a function attribute of a *class* (the

Re: Property Abuse

2011-12-14 Thread Ian Kelly
On Wed, Dec 14, 2011 at 1:28 AM, Felipe O pip@gmail.com wrote: Hi All, I was wondering what everyone's thought process was regarding properties. Lately I find I've been binging on them and have classes with 10 properties. While pylint doesn't complain (yet), it tends to be picky about

Re: AttributeError in with statement (3.2.2)

2011-12-14 Thread 88888 Dihedral
On Thursday, December 15, 2011 12:08:32 AM UTC+8, 8 Dihedral wrote: On Wednesday, December 14, 2011 4:01:24 PM UTC+8, Steven D#39;Aprano wrote: On Wed, 14 Dec 2011 01:29:13 -0500, Terry Reedy wrote: To complement what Eric says below: The with statement is looking for an instance

Re: Property Abuse

2011-12-14 Thread Jean-Michel Pichavant
Ian Kelly wrote: On Wed, Dec 14, 2011 at 1:28 AM, Felipe O pip@gmail.com wrote: Hi All, I was wondering what everyone's thought process was regarding properties. Lately I find I've been binging on them and have classes with 10 properties. While pylint doesn't complain (yet), it tends to

Re: Overriding a global

2011-12-14 Thread Joshua Landau
On 14 December 2011 10:14, Jean-Michel Pichavant jeanmic...@sequans.comwrote: Joshua Landau wrote: On 13 December 2011 13:30, Jean-Michel Pichavant jeanmic...@sequans.commailto: jeanmic...@sequans.com** wrote: writing x = 1 def spam(): x = 2 is in general a bad

Re: AttributeError in with statement (3.2.2)

2011-12-14 Thread Eric Snow
On Tue, Dec 13, 2011 at 11:05 PM, Eric Snow ericsnowcurren...@gmail.com wrote: 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 =

Re: Overriding a global

2011-12-14 Thread Jean-Michel Pichavant
Joshua Landau wrote: [snip] Using currentLogger is just padding, in my opinion. *Every *value is currentvalue. Not always. I try to keep names on the same object because that object is supposed to be named that way. I can change one of the object attribute, but the object named that way keep

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

2011-12-14 Thread Eelco
'Kindof' off-topic, but what the hell :). On Dec 14, 5:13 pm, Arnaud Delobelle arno...@gmail.com wrote: On 14 December 2011 12:33, Eelco hoogendoorn.ee...@gmail.com wrote: On 14 dec, 12:55, Arnaud Delobelle arno...@gmail.com wrote: On 14 December 2011 07:49, Eelco hoogendoorn.ee...@gmail.com

Re: AttributeError in with statement (3.2.2)

2011-12-14 Thread Steve Howell
On Dec 14, 12:01 am, Steven D'Aprano steve +comp.lang.pyt...@pearwood.info wrote: [...] So the normal lookup rules that apply to data attributes, namely instance, then class, then superclasses, also applies to methods in Python. In languages that don't allow that sort of thing, like Java, you

Re: How to install Python on Debian GNU/Linux (Python-2.7.2.tar.bz2)

2011-12-14 Thread Anssi Saari
Christian Heimes li...@cheimes.de writes: Mea culpa, forgot that. Yes, use altinstall. Although it's probably not a problem to replace 2.6.6 with 2.7.2 - I doubt that'll break many things. Except that all 3rd party extensions and packages are missing if you install Python manually. True,

Re: AttributeError in with statement (3.2.2)

2011-12-14 Thread Lie Ryan
On 12/15/2011 03:56 AM, Eric Snow wrote: On Tue, Dec 13, 2011 at 11:05 PM, Eric Snowericsnowcurren...@gmail.com wrote: If you want to be more dynamic about it you can do it, but it involves black magic. Chances are really good that being explicit through your class definition is the right

What is this widget?

2011-12-14 Thread Muddy Coder
Hi Folks, I am trying to write letters on a photo that is opened in a canvas. So I think I must need a widget to contain the letters I will type in. I tried to use a Label, it worked. But, a Label covered part of the photo underneath, so I can't use it. I saw some software did such a thing

Re: AttributeError in with statement (3.2.2)

2011-12-14 Thread Eric Snow
On Wed, Dec 14, 2011 at 12:14 PM, Lie Ryan lie.1...@gmail.com wrote: On 12/15/2011 03:56 AM, Eric Snow wrote: On Tue, Dec 13, 2011 at 11:05 PM, Eric Snowericsnowcurren...@gmail.com  wrote: If you want to be more dynamic about it you can do it, but it involves black magic.  Chances are

Re: What is this widget?

2011-12-14 Thread Dave Angel
On 12/14/2011 01:47 PM, Muddy Coder wrote: Hi Folks, I am trying to write letters on a photo that is opened in a canvas. So I think I must need a widget to contain the letters I will type in. I tried to use a Label, it worked. But, a Label covered part of the photo underneath, so I can't use

replacing timestamps in file [newbie]

2011-12-14 Thread nukeymusic
I have a file which has the data in the following format: Dec-13-09:46:45 21.4 +4.76442190E-01 8.135530E-06 1.553691E+00 Dec-13-09:47:12 21.4 +4.76439120E-01 8.135839E-06 1.553726E+00 Dec-13-09:47:39 21.4 +4.76427260E-01 8.136261E-06 1.553853E+00 . . the first field is a timestamp, I'd like to

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

2011-12-14 Thread Terry Reedy
On 12/14/2011 5:09 AM, Eelco wrote: Arguably, the most elegant thing to do is to define integer division and remainder as a single operation; It actually is, as quotient and remainder are calculated together. The microprocessors I know of expose this (as does Python). 'a divmod b' puts the

Re: replacing timestamps in file [newbie]

2011-12-14 Thread Miki Tebeka
You can either work with datetime module (see datetime.datetime.strptime) or with the time module (see time.strptime and time.mktime) -- http://mail.python.org/mailman/listinfo/python-list

Re: replacing timestamps in file [newbie]

2011-12-14 Thread Chris Angelico
On Thu, Dec 15, 2011 at 7:32 AM, nukeymusic nukeymu...@gmail.com wrote: I have a file which has the data in the following format: Dec-13-09:46:45 21.4 +4.76442190E-01 8.135530E-06 1.553691E+00 the first field is a timestamp, I'd like to replace it with the time in seconds starting from the

file data = array(s)

2011-12-14 Thread Eric
I'm trying to read some file data into a set of arrays. The file data is just four columns of numbers, like so: 1.22.2 3.3 0.5 0.1 0.21.0 10.1 ... and so on I'd like to read this into four arrays, one array for each column. Alternatively, I guess something like this is

Re: file data = array(s)

2011-12-14 Thread Dave Angel
On 12/14/2011 05:20 PM, Eric wrote: I'm trying to read some file data into a set of arrays. The file data is just four columns of numbers, like so: 1.22.2 3.3 0.5 0.1 0.21.0 10.1 ... and so on I'd like to read this into four arrays, one array for each column.

Re: AttributeError in with statement (3.2.2)

2011-12-14 Thread Terry Reedy
On 12/14/2011 3:01 AM, Steven D'Aprano wrote: On Wed, 14 Dec 2011 01:29:13 -0500, Terry Reedy wrote: To complement what Eric says below: The with statement is looking for an instance *method*, which by definition, is a function attribute of a *class* (the class of the context manager) that

Re: What is this widget?

2011-12-14 Thread Terry Reedy
On 12/14/2011 1:47 PM, Muddy Coder wrote: Hi Folks, I am trying to write letters on a photo that is opened in a canvas. So I think I must need a widget to contain the letters I will type in. I tried to use a Label, it worked. But, a Label covered part of the photo underneath, so I can't use it.

Re: file data = array(s)

2011-12-14 Thread Eric
On Dec 14, 4:59 pm, Dave Angel d...@davea.name wrote: Note that your code won't work (and mine probably won't either) if one of the lines has 3 or 5 items.  Or if one of the numbers isn't legal format for a float.  So you need to think about error checking, or decide whether a partial result

Re: file data = array(s)

2011-12-14 Thread Steven D'Aprano
On Wed, 14 Dec 2011 14:20:40 -0800, Eric wrote: I'm trying to read some file data into a set of arrays. The file data is just four columns of numbers, like so: 1.22.2 3.3 0.5 0.1 0.21.0 10.1 ... and so on I'd like to read this into four arrays, one array for each

PyCharm, .idea, and source control

2011-12-14 Thread alex23
Hey everyone, I've been using PyCharm for the past month and only just hit an issue that I'm hoping someone else may have some experience with resolving. My problem has to do with PyCharm storing project configuration files in its .idea folder inside the project. This is both a mix of

What is this widget? -- again

2011-12-14 Thread Muddy Coder
Hi Folks, Sorry for the unclear question in last post. Well, I am using Tkinter to do GUI, and I just don't know what kind of widget can let me do annotation on an image being displayed. An example is the Paint of Windows: a dotted line box appearing on a image to hold a typed in text. I just

How to use a color value returned by colorChooser?

2011-12-14 Thread Muddy Coder
Hi Folks, This should be a simple question, but I just can't get an answer from Phython Docs. You see, when we created a widget, and need to tweak the color, we just simply configure it, such as: abutton = Button(root, text='Foo') abutton.config(fg='blue') so we can make the Button color in

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

2011-12-14 Thread rusi
On Dec 14, 10:15 pm, Eelco hoogendoorn.ee...@gmail.com wrote: 'Kindof' off-topic, but what the hell :). deja-vu We keep having these debates -- so I wonder how off-topic it is... And so do famous CSists: http://research.microsoft.com/en-us/um/people/gurevich/opera/123.pdf /deja-vu : : Again,

Re: How to use a color value returned by colorChooser?

2011-12-14 Thread MRAB
On 15/12/2011 02:26, Muddy Coder wrote: Hi Folks, This should be a simple question, but I just can't get an answer from Phython Docs. You see, when we created a widget, and need to tweak the color, we just simply configure it, such as: abutton = Button(root, text='Foo')

Re: AttributeError in with statement (3.2.2)

2011-12-14 Thread Steven D'Aprano
On Wed, 14 Dec 2011 18:13:36 -0500, Terry Reedy wrote: On 12/14/2011 3:01 AM, Steven D'Aprano wrote: On Wed, 14 Dec 2011 01:29:13 -0500, Terry Reedy wrote: To complement what Eric says below: The with statement is looking for an instance *method*, which by definition, is a function attribute

Re: AttributeError in with statement (3.2.2)

2011-12-14 Thread MRAB
On 15/12/2011 05:01, Steven D'Aprano wrote: On Wed, 14 Dec 2011 18:13:36 -0500, Terry Reedy wrote: On 12/14/2011 3:01 AM, Steven D'Aprano wrote: On Wed, 14 Dec 2011 01:29:13 -0500, Terry Reedy wrote: To complement what Eric says below: The with statement is looking for an instance

using twisted as a client-server hybrid

2011-12-14 Thread Littlefield, Tyler
Hello all: I have a quick question--I am working on a project where a system will connect to me to get commands. The idea is to make the server the client, used for dispatching commands, so I'm trying to find a way that I can set it up to listen, but poll stdin somehow for input. Is this a

Re: AttributeError in with statement (3.2.2)

2011-12-14 Thread Steven D'Aprano
On Thu, 15 Dec 2011 05:15:58 +, MRAB wrote: On 15/12/2011 05:01, Steven D'Aprano wrote: On Wed, 14 Dec 2011 18:13:36 -0500, Terry Reedy wrote: On 12/14/2011 3:01 AM, Steven D'Aprano wrote: On Wed, 14 Dec 2011 01:29:13 -0500, Terry Reedy wrote: To complement what Eric says below: The

Re: using twisted as a client-server hybrid

2011-12-14 Thread Chris Angelico
On Thu, Dec 15, 2011 at 6:14 PM, Littlefield, Tyler ty...@tysdomain.com wrote: Hello all: I have a quick question--I am working on a project where a system will connect to me to get commands. The idea is to make the server the client, used for dispatching commands, so  I'm trying to find a way

Re: AttributeError in with statement (3.2.2)

2011-12-14 Thread Steven D'Aprano
On Thu, 15 Dec 2011 05:01:21 +, Steven D'Aprano wrote: From the Python glossary: method: A function which is defined inside a class body. That is actually a bit too narrow, as a function can be added to the class after it is defined. But the point then is that it is treated as if

[issue13599] Compiled regexes don't show all attributes in dir()

2011-12-14 Thread Martin Häcker
New submission from Martin Häcker spamfaen...@gmx.de: When looking at a regex with dir() you don't get all available attributes - which is inconvenient as some very important ones (like .pattern) are not visible. To demonstrate: import re re.compile('foo').pattern 'foo'

[issue4625] IDLE won't open anymore, .idlerc unaccessible

2011-12-14 Thread Ned Deily
Ned Deily n...@acm.org added the comment: A couple of comments on the patch: 1. Displaying a popup is fine but it gets annoying when it does it repeatedly. Since this is really a non-fatal error as the user can continue, it would be better to only display the popup once. 2. Another file in

[issue4625] IDLE won't open anymore, .idlerc unaccessible

2011-12-14 Thread Ned Deily
Changes by Ned Deily n...@acm.org: Added file: http://bugs.python.org/file23954/issue4625_rev1_27.patch ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue4625 ___

[issue9404] IDLE won't launch on XP

2011-12-14 Thread Ned Deily
Ned Deily n...@acm.org added the comment: As there are proposed patches in Issue4625 that address the original problem reported here, let's move the discussion there. -- nosy: +ned.deily resolution: - duplicate stage: - committed/rejected status: open - closed superseder: - IDLE

[issue13600] rot_13 codec not working

2011-12-14 Thread Ram Rachum
New submission from Ram Rachum r...@rachum.com: The `rot_13` codec is supposed to work like this, no? 'qwerty'.encode('utf-8') b'qwerty' 'qwerty'.encode('rot_13') Traceback (most recent call last): File pyshell#1, line 1, in module 'qwerty'.encode('rot_13') TypeError: encoder did not

[issue13598] string.Formatter doesn't support empty curly braces {}

2011-12-14 Thread maniram maniram
maniram maniram maniandra...@gmail.com added the comment: Attached is a patch for test.test_string to test for this bug. Can somebody please comment on my paches or commit my patches. -- Added file: http://bugs.python.org/file23955/test_string.diff

[issue13599] Compiled regexes don't show all attributes in dir()

2011-12-14 Thread Ezio Melotti
Ezio Melotti ezio.melo...@gmail.com added the comment: This seems already fixed in 2.7.2+/3.2/3.3, what version have you tried? -- resolution: - out of date status: open - pending type: - enhancement ___ Python tracker rep...@bugs.python.org

[issue13600] rot_13 codec not working

2011-12-14 Thread Ezio Melotti
Ezio Melotti ezio.melo...@gmail.com added the comment: See #7475. -- nosy: +ezio.melotti ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue13600 ___

[issue13571] Backup files support in IDLE

2011-12-14 Thread maniram maniram
maniram maniram maniandra...@gmail.com added the comment: In response to Roger Serwy: I rarely have IDLE crash on Linux. If you're experiencing these issues on Windows, see #13582. I'm on Ubuntu Linux and IDLE does'nt crash. Many editors have backup files in the case of a crash and after a

[issue13498] os.makedirs exist_ok documentation is incorrect, as is some of the behavior

2011-12-14 Thread Laurent Mazuel
Changes by Laurent Mazuel laurent.maz...@gmail.com: -- nosy: +Laurent.Mazuel ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue13498 ___ ___

[issue13600] rot_13 codec not working

2011-12-14 Thread Petri Lehtinen
Petri Lehtinen pe...@digip.org added the comment: Ram Rachum wrote: The `rot_13` codec is supposed to work like this, no? No it isn't. In Python 3, str.encode() always encodes to bytes and bytes.decode() always decodes to str. IOW, str.encode() encodes text (Unicode) to data (bytes), and

[issue13600] rot_13 codec not working

2011-12-14 Thread Ram Rachum
Ram Rachum r...@rachum.com added the comment: Then I suggest replacing this error message: encoder did not return a bytes object (type=str) and this one: 'memoryview' object has no attribute 'translate' With something like: Please use `codecs.lookup('rot-13').encode` --

[issue13600] rot_13 codec not working

2011-12-14 Thread Petri Lehtinen
Petri Lehtinen pe...@digip.org added the comment: Issue #7475 discusses fixing the error messages, too. -- components: +Library (Lib) resolution: - duplicate stage: committed/rejected - status: open - closed superseder: - codecs missing: base64 bz2 hex zlib hex_codec ...

[issue7475] codecs missing: base64 bz2 hex zlib hex_codec ...

2011-12-14 Thread Petri Lehtinen
Petri Lehtinen pe...@digip.org added the comment: Issue 13600 has been marked as a duplicate of this issue. FRT, +1 to the idea of adding encoded_format and decoded_format attributes to CodecInfo, and also to adding {str,bytes}.{transform,untransform} back. -- nosy: +petri.lehtinen

[issue13359] urllib2 doesn't escape spaces in http requests

2011-12-14 Thread Sandro Tosi
Changes by Sandro Tosi sandro.t...@gmail.com: -- nosy: +sandro.tosi ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue13359 ___ ___ Python-bugs-list

[issue13599] Compiled regexes don't show all attributes in dir()

2011-12-14 Thread Martin Häcker
Martin Häcker spamfaen...@gmx.de added the comment: Indeed, I'm on version % python --version Python 2.7.1 Sorry. -- status: pending - closed ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue13599

[issue13359] urllib2 doesn't escape spaces in http requests

2011-12-14 Thread maniram maniram
maniram maniram maniandra...@gmail.com added the comment: Seems good. -- nosy: +maniram.maniram ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue13359 ___

[issue8684] improvements to sched.py

2011-12-14 Thread Roundup Robot
Roundup Robot devn...@psf.upfronthosting.co.za added the comment: New changeset f5aed0dba844 by Giampaolo Rodola' in branch 'default': Fix #8684: make sched.scheduler class thread-safe http://hg.python.org/cpython/rev/f5aed0dba844 -- nosy: +python-dev

[issue8684] improvements to sched.py

2011-12-14 Thread Giampaolo Rodola'
Changes by Giampaolo Rodola' g.rod...@gmail.com: -- resolution: - fixed stage: patch review - committed/rejected status: open - closed ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue8684 ___

[issue13449] sched - provide an async argument for run() method

2011-12-14 Thread Giampaolo Rodola'
Giampaolo Rodola' g.rod...@gmail.com added the comment: What about run(nowait=...) or run(only_ready=...)? Doing this as a separate method seems unnecessarily complicated to me in terms of implementation (move run logic into _run, add run and run_nowait, etc...). Most importantly, the user

[issue13449] sched - provide an async argument for run() method

2011-12-14 Thread Antoine Pitrou
Antoine Pitrou pit...@free.fr added the comment: That's a good point. Then perhaps call the flag wait or blocking, since it avoids false positives and is more explicit than async? -- ___ Python tracker rep...@bugs.python.org

[issue13449] sched - provide an async argument for run() method

2011-12-14 Thread Giampaolo Rodola'
Giampaolo Rodola' g.rod...@gmail.com added the comment: blocking seems the most explicit to me. With this, we can also fix issue1641 by providing a specific section into asyncore doc which explains how to use asyncore in conjunction with sched. --

[issue13597] Improve documentation of stdout/stderr buffering in Python 3.x

2011-12-14 Thread Antoine Pitrou
Antoine Pitrou pit...@free.fr added the comment: I'm surprised to hear that stderr is line buffered by default. Historically stderr is never buffered (at least on POSIX) and for good reason: errors should be seen immediately Was this an oversight in migrating stdin/out/err to the new io

[issue13601] sys.stderr should be unbuffered (or always line-buffered)

2011-12-14 Thread Antoine Pitrou
New submission from Antoine Pitrou pit...@free.fr: In issue13597, Philip Jenvey points out: “I'm surprised to hear that stderr is line buffered by default. Historically stderr is never buffered (at least on POSIX) and for good reason: errors should be seen immediately” Recent changes to the

[issue13599] Compiled regexes don't show all attributes in dir()

2011-12-14 Thread Ezio Melotti
Changes by Ezio Melotti ezio.melo...@gmail.com: -- stage: - committed/rejected ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue13599 ___ ___

[issue13449] sched - provide an async argument for run() method

2011-12-14 Thread Roundup Robot
Roundup Robot devn...@psf.upfronthosting.co.za added the comment: New changeset 2975618965c0 by Giampaolo Rodola' in branch 'default': Fix #13449: add 'blocking' parameter to sched.scheduler.run() so that the scheduler can be used in non-blocking applications

[issue1641] asyncore delayed calls feature

2011-12-14 Thread Giampaolo Rodola'
Giampaolo Rodola' g.rod...@gmail.com added the comment: With issue13449 fixed I think we can now provide this functionnality by adding a specific section into asyncore doc which explains how to use asyncore in conjunction with sched module. As such, asyncore.py itself won't need any change.

  1   2   >