MacroPy 0.1.2: Macros for Pythoon. Quasiquotes, Case Classes, Pattern Matching, LINQ and more!

2013-05-09 Thread Haoyi Li
Hey All, MacroPy is an implementation of Macros in the Python Programming, providing a mechanism for user-defined functions (macros) to perform transformations on the abstract syntax tree(AST) of Python code at module import time. This is an easy way to modify the semantics of a python program

Append to python List

2013-05-09 Thread RAHUL RAJ
Checkout the following code: sample2 = [x+y for x in range(1,10) for y in range(1,10) if x!=y] output=[] output=[x for x in sample2 if x not in output] the output I get is 3 4 5 6 7 8 9 10 3 5 6 7 8 9 10 11 4 5 7 8 9 10 11 12 5 6 7 9 10 11 12 13 6 7 8 9 11 12 13 14 7 8 9 10 11 13 14 15 8 9

Re: object.enable() anti-pattern

2013-05-09 Thread Terry Jan Reedy
On 5/9/2013 1:23 AM, Steven D'Aprano wrote: Besides, this is not to denigrate the idea of a read() function that takes a filename and returns its contents. But that is not an object constructor. It may construct a file object internally, but it doesn't return the file object, so it is

Re: Help with implementing callback functions using ctypes

2013-05-09 Thread Stefan Behnel
dieter, 09.05.2013 07:54: jamadagni writes: ... I cannot help you with ctypes. But, if you might be able to use cython, then calling callbacks is not too difficult +1 for using Cython. It also has (multi-)source level gdb support, which greatly helps in debugging crashes like this one.

Re: Append to python List

2013-05-09 Thread Jussi Piitulainen
RAHUL RAJ writes: Checkout the following code: sample2 = [x+y for x in range(1,10) for y in range(1,10) if x!=y] output=[] output=[x for x in sample2 if x not in output] the output I get is 3 4 5 6 7 8 9 10 3 5 6 7 8 9 10 11 4 5 7 8 9 10 11 12 5 6 7 9 10 11 12 13 6 7 8 9 11 12 13 14

Forming a small python programming group

2013-05-09 Thread kreta06
Hi All, I'm looking for one or two medium-advanced python programmers to practice programming on a Windows 7 platform. In addition, any interests in writing python code to query Microsoft SQL databases (2005-2008) is also welcomed. I've coded in python 2.7 and currently am trying to make the

Re: Append to python List

2013-05-09 Thread Gary Herron
On 05/08/2013 11:36 PM, RAHUL RAJ wrote: Checkout the following code: sample2 = [x+y for x in range(1,10) for y in range(1,10) if x!=y] output=[] output=[x for x in sample2 if x not in output] This statement is not doing what you expect. It is not building a list in the variable named

Re: Append to python List

2013-05-09 Thread Chris Angelico
On Thu, May 9, 2013 at 4:36 PM, RAHUL RAJ omrahulraj...@gmail.com wrote: output=[x for x in sample2 if x not in output] output=[] for x in sample2: if x not in output: output.append(x) The first one constructs a list, then points the name 'output' at it. The second one builds up a

Re: object.enable() anti-pattern

2013-05-09 Thread Gregory Ewing
Steven D'Aprano wrote: There is no sensible use-case for creating a file without opening it. What would be the point? Early unix systems often used this as a form of locking. -- Greg -- http://mail.python.org/mailman/listinfo/python-list

Re: Forming a small python programming group

2013-05-09 Thread Terry Jan Reedy
On 5/9/2013 2:59 AM, kreta06 wrote: Hi All, I'm looking for one or two medium-advanced python programmers to practice programming on a Windows 7 platform. In addition, any interests in writing python code to query Microsoft SQL databases (2005-2008) is also welcomed. I've coded in python 2.7

Re: Append to python List

2013-05-09 Thread RAHUL RAJ
Then what about this code part? [(x, y) for x in [1,2,3] for y in [3,1,4] if x != y] and the following code part: for x in [1,2,3]: for y in [3,1,4]: if x != y: combs.append((x, y)) On Thursday, May 9, 2013 12:24:24 PM UTC+5:30, Gary Herron wrote: On 05/08/2013 11:36 PM, RAHUL

Re: Append to python List

2013-05-09 Thread RAHUL RAJ
I'm getting same output for both code parts, why not for th code parts in question? On Thursday, May 9, 2013 1:48:51 PM UTC+5:30, RAHUL RAJ wrote: Then what about this code part? [(x, y) for x in [1,2,3] for y in [3,1,4] if x != y] and the following code part: for x in

Re: PIL: check if image is animated

2013-05-09 Thread Sven
Figured out my issue. I did called the check_animated function more than once and the second call causes the exception unless I seek back to 0 On 6 May 2013 21:57, Sven sven...@gmail.com wrote: Hello, I am trying to check if an image is animated. I can't rely on the extension as it may be a

Re: object.enable() anti-pattern

2013-05-09 Thread Cameron Simpson
On 09May2013 19:54, Greg Ewing greg.ew...@canterbury.ac.nz wrote: | Steven D'Aprano wrote: | There is no sensible use-case for creating a file without opening | it. What would be the point? | | Early unix systems often used this as a form of locking. Not just early systems: it's a nice

Re: Anybody familiar with pygments ?

2013-05-09 Thread Fábio Santos
On 9 May 2013 05:19, dabaichi valben...@outlook.com wrote: And hereis the output file: That's not the output file. That is just an HTML fragment to put on your page. A full HTML file will need more things, which is the reason why you don't see color output. I want to know why output html file

Re: help on Implementing a list of dicts with no data pattern

2013-05-09 Thread rlelis
On Thursday, May 9, 2013 12:47:47 AM UTC+1, rlelis wrote: Hi guys, I'm working on this long file, where i have to keep reading and storing different excerpts of text (data) in different variables (list). Once done that i want to store in dicts the data i got from the lists

Re: Style question -- plural of class name?

2013-05-09 Thread Thomas Rachel
Am 09.05.2013 02:38 schrieb Colin J. Williams: On 08/05/2013 4:20 PM, Roy Smith wrote: A list of FooEntry's +1 Go back to school. Both of you... That is NOT the way to build a plural form... Thomas -- http://mail.python.org/mailman/listinfo/python-list

Re: object.enable() anti-pattern

2013-05-09 Thread Wayne Werner
On Wed, 8 May 2013, Steven D'Aprano wrote: I'm looking for some help in finding a term, it's not Python-specific but does apply to some Python code. This is an anti-pattern to avoid. The idea is that creating a resource ought to be the same as turning it on, or enabling it, or similar. For

Re: Append to python List

2013-05-09 Thread Steven D'Aprano
On Thu, 09 May 2013 01:18:51 -0700, RAHUL RAJ wrote: Then what about this code part? What about it? [(x, y) for x in [1,2,3] for y in [3,1,4] if x != y] and the following code part: for x in [1,2,3]: for y in [3,1,4]: if x != y: combs.append((x, y)) Apart from not

Re: Append to python List

2013-05-09 Thread 88888 Dihedral
Jussi Piitulainen於 2013年5月9日星期四UTC+8下午2時55分20秒寫道: RAHUL RAJ writes: Checkout the following code: sample2 = [x+y for x in range(1,10) for y in range(1,10) if x!=y] output=[] output=[x for x in sample2 if x not in output] the output I get is 3 4 5 6 7 8 9 10

Re: Append to python List

2013-05-09 Thread Jussi Piitulainen
8 Dihedral writes: This is just the handy style for a non-critical loop. In a critical loop, the number of the total operation counts does matter in the execution speed. Do you use speed often? -- http://mail.python.org/mailman/listinfo/python-list

Re: object.enable() anti-pattern

2013-05-09 Thread Steven D'Aprano
On Thu, 09 May 2013 18:23:31 +1000, Cameron Simpson wrote: On 09May2013 19:54, Greg Ewing greg.ew...@canterbury.ac.nz wrote: | Steven D'Aprano wrote: | There is no sensible use-case for creating a file WITHOUT OPENING | it. What would be the point? | | Early unix systems often used this

Re: object.enable() anti-pattern

2013-05-09 Thread Steven D'Aprano
On Thu, 09 May 2013 06:08:25 -0500, Wayne Werner wrote: Ah, that's it - the problem is that it introduces /Temporal Coupling/ to one's code: http://blog.ploeh.dk/2011/05/24/DesignSmellTemporalCoupling/ Good catch! That's not the blog post I read, but that's the same concept. Temporal

Alternate computational models can be harmonious (was Message passing syntax for objects | OOPv2)

2013-05-09 Thread rusi
On May 9, 10:39 am, Steven D'Aprano steve +comp.lang.pyt...@pearwood.info wrote: On Wed, 08 May 2013 19:35:58 -0700, Mark Janssen wrote: Long story short: the lambda calculus folks have to split from the Turing machine folks.  These models of computation should not use the same language.  

Re: help on Implementing a list of dicts with no data pattern

2013-05-09 Thread Dave Angel
On 05/09/2013 05:57 AM, rlelis wrote: On Thursday, May 9, 2013 12:47:47 AM UTC+1, rlelis wrote: Hi guys, I'm working on this long file, where i have to keep reading and storing different excerpts of text (data) in different variables (list). Once done that i want to store in dicts the

Re: Making safe file names

2013-05-09 Thread Roy Smith
In article 518b133b$0$29997$c3e8da3$54964...@news.astraweb.com, Steven D'Aprano steve+comp.lang.pyt...@pearwood.info wrote: I suspect that the only way to be completely ungoogleable would be to name yourself something common, not something obscure. http://en.wikipedia.org/wiki/The_band --

Re: object.enable() anti-pattern

2013-05-09 Thread Roy Smith
In article 518b32ef$0$11120$c3e8...@news.astraweb.com, Steven D'Aprano steve+comp.lang.pyt...@pearwood.info wrote: There is no sensible use-case for creating a file without opening it. Sure there is. Sometimes just creating the name in the file system is all you want to do. That's why, for

Re: help on Implementing a list of dicts with no data pattern

2013-05-09 Thread Neil Cerutti
On 2013-05-09, rlelis ricardo.lel...@gmail.com wrote: This is what i have for now: highway_dict = {} aging_dict = {} queue_row = [] for content in file_content: if 'aging' in content: # aging 0 100 collumns = ''.join(map(str,

Re: object.enable() anti-pattern

2013-05-09 Thread Oscar Benjamin
On 9 May 2013 14:07, Roy Smith r...@panix.com wrote: In article 518b32ef$0$11120$c3e8...@news.astraweb.com, Steven D'Aprano steve+comp.lang.pyt...@pearwood.info wrote: There is no sensible use-case for creating a file without opening it. Sure there is. Sometimes just creating the name in

Re: Red Black Tree implementation?

2013-05-09 Thread duncan smith
On 09/05/13 02:40, Dan Stromberg wrote: OK, I've got one copy of trees.py with md5 211f80c0fe7fb9cb42feb9645b4b3ffe. You seem to be saying I should have two though, but I don't know that I do... [snip] Yes, 211f80c0fe7fb9cb42feb9645b4b3ffe is the correct checksum for the latest version.

Re: help on Implementing a list of dicts with no data pattern

2013-05-09 Thread rlelis
I apologize once again. Is my first post here and i'm getting used to the group as long as i get the feedback of my errors by you guys. I'm using Python 2.7.3 with no dependencies, i'm simply using the standard library. Here is the big picture of the scenario(i have added it in the pastebin link

Re: help on Implementing a list of dicts with no data pattern

2013-05-09 Thread Dave Angel
On 05/09/2013 10:33 AM, rlelis wrote: I apologize once again. Is my first post here and i'm getting used to the group as long as i get the feedback of my errors by you guys. I'm using Python 2.7.3 with no dependencies, i'm simply using the standard library. Here is the big picture of the

Re: Style question -- plural of class name?

2013-05-09 Thread Neil Cerutti
On 2013-05-08, Denis McMahon denismfmcma...@gmail.com wrote: On Wed, 08 May 2013 16:20:48 -0400, Roy Smith wrote: FooEntry is a class. How would you describe a list of these in a docstring? A list of FooEntries A list of FooEntrys A list of FooEntry's A list of FooEntry instances

Urgent:Serial Port Read/Write

2013-05-09 Thread chandan kumar
Hi all,I'm new to python and facing issue using serial in python.I'm facing the below error      ser.write(port,command)NameError: global name 'ser' is not defined Please find the attached script and let me know whats wrong in my script and also how can i read data from serial port for the  same

Re: Urgent:Serial Port Read/Write

2013-05-09 Thread Chris Angelico
On Fri, May 10, 2013 at 1:35 AM, chandan kumar chandan_...@yahoo.co.in wrote: Hi all, I'm new to python and facing issue using serial in python.I'm facing the below error ser.write(port,command) NameError: global name 'ser' is not defined Please find the attached script and let me

Re: Urgent:Serial Port Read/Write

2013-05-09 Thread Frank Miles
On Thu, 09 May 2013 23:35:53 +0800, chandan kumar wrote: Hi all,I'm new to python and facing issue using serial in python.I'm facing the below error     ser.write(port,command)NameError: global name 'ser' is not defined Please find the attached script and let me know whats wrong in my script

Re: Urgent:Serial Port Read/Write

2013-05-09 Thread MRAB
On 09/05/2013 16:35, chandan kumar wrote: Hi all, I'm new to python and facing issue using serial in python.I'm facing the below error *ser.write(port,command)* *NameError: global name 'ser' is not defined* * * Please find the attached script and let me know whats wrong in my script and

Re: Urgent:Serial Port Read/Write

2013-05-09 Thread Chris Angelico
On Fri, May 10, 2013 at 1:35 AM, chandan kumar chandan_...@yahoo.co.in wrote: Please find the attached script and let me know whats wrong in my script and also how can i read data from serial port for the same script. Don't do this: except serial.serialutil.SerialException: print

Re: help on Implementing a list of dicts with no data pattern

2013-05-09 Thread rlelis
On Thursday, May 9, 2013 12:47:47 AM UTC+1, rlelis wrote: @Dave Angel this is how i mange to read and store the data in file. data = [] # readdata f = open(source_file, 'r') for line in f: header = (line.strip()).lower() # conditions(if/else clauses) on the header content to filter

Re: Style question -- plural of class name?

2013-05-09 Thread Jussi Piitulainen
Neil Cerutti writes: If there's no chance for confusion between a class named FooEntry and another named FooEntries, then the first attempt seems best. Pluralize a class name by following the usual rules, e.g., strings and ints. Like strings would be foo entries. Which might work well. (I

IV ECCOMAS Thematic Conference VipIMAGE 2013: LAST CALL

2013-05-09 Thread tava...@fe.up.pt
Dear Colleague, Attending several requests, the organizing committee has extended the submission of abstracts for the International Conference VipIMAGE 2013 - IV ECCOMAS THEMATIC CONFERENCE ON COMPUTATIONAL VISION AND MEDICAL IMAGE PROCESSING (www.fe.up.pt/~vipimage) to be held October 14-16,

Re: Style question -- plural of class name?

2013-05-09 Thread Neil Cerutti
On 2013-05-09, Jussi Piitulainen jpiit...@ling.helsinki.fi wrote: Neil Cerutti writes: If there's no chance for confusion between a class named FooEntry and another named FooEntries, then the first attempt seems best. Pluralize a class name by following the usual rules, e.g., strings and

Re: Message passing syntax for objects | OOPv2

2013-05-09 Thread Ian Kelly
On Wed, May 8, 2013 at 8:35 PM, Mark Janssen dreamingforw...@gmail.com wrote: Okay, to anyone who might be listening, I found the core of the problem. What problem are you referring to? You've been posting on this topic for going on two months now, and I still have no idea of what the point of

Re: Style question -- plural of class name?

2013-05-09 Thread Robert Kern
On 2013-05-08 21:20, Roy Smith wrote: FooEntry is a class. How would you describe a list of these in a docstring? A list of FooEntries A list of FooEntrys A list of FooEntry's A list of FooEntry instances The first one certainly sounds the best, but it seems wierd to change the spelling of

Re: help on Implementing a list of dicts with no data pattern

2013-05-09 Thread Dave Angel
On 05/09/2013 12:14 PM, rlelis wrote: On Thursday, May 9, 2013 12:47:47 AM UTC+1, rlelis wrote: @Dave Angel this is how i mange to read and store the data in file. data = [] # readdata f = open(source_file, 'r') for line in f: header = (line.strip()).lower() #

Re: object.enable() anti-pattern

2013-05-09 Thread Steven D'Aprano
On Thu, 09 May 2013 09:07:42 -0400, Roy Smith wrote: In article 518b32ef$0$11120$c3e8...@news.astraweb.com, Steven D'Aprano steve+comp.lang.pyt...@pearwood.info wrote: There is no sensible use-case for creating a file without opening it. Sure there is. Sometimes just creating the name

Re: object.enable() anti-pattern

2013-05-09 Thread MRAB
On 09/05/2013 19:21, Steven D'Aprano wrote: On Thu, 09 May 2013 09:07:42 -0400, Roy Smith wrote: In article 518b32ef$0$11120$c3e8...@news.astraweb.com, Steven D'Aprano steve+comp.lang.pyt...@pearwood.info wrote: There is no sensible use-case for creating a file without opening it. Sure

Re: Help with implementing callback functions using ctypes

2013-05-09 Thread Nobody
On Wed, 08 May 2013 04:19:07 -0700, jamadagni wrote: I have the below C program spiro.c (obviously a simplified testcase) which I compile to a sharedlib using clang -fPIC -shared -o libspiro.so spiro.c, sudo cp to /usr/lib and am trying to call from a Python script spiro.py using ctypes.

Re: object.enable() anti-pattern

2013-05-09 Thread Roy Smith
In article 518be931$0$29997$c3e8da3$54964...@news.astraweb.com, Steven D'Aprano steve+comp.lang.pyt...@pearwood.info wrote: There is no sensible use-case for creating a file OBJECT unless it initially wraps an open file pointer. OK, I guess that's a fair statement. But mostly because a

Re: help on Implementing a list of dicts with no data pattern

2013-05-09 Thread rlelis
On Thursday, May 9, 2013 7:19:38 PM UTC+1, Dave Angel wrote: Yes it's a list of string. I don't get the NameError: name 'file_content' is not defined in my code. After i appended the headers i wanted to cut the data list it little bit more because there was some data (imagine some other

Re: Message passing syntax for objects | OOPv2

2013-05-09 Thread Mark Janssen
These models of computation should not use the same language. Their computation models are too radically different. Their computation models are exactly equivalent. No they are not. While one can find levels of indirection to translate between one and the other, that doesn't mean they're

Re: Message passing syntax for objects | OOPv2

2013-05-09 Thread Mark Janssen
On Thu, May 9, 2013 at 10:33 AM, Ian Kelly ian.g.ke...@gmail.com wrote: On Wed, May 8, 2013 at 8:35 PM, Mark Janssen dreamingforw...@gmail.com wrote: Okay, to anyone who might be listening, I found the core of the problem. What problem are you referring to? You've been posting on this

Re: object.enable() anti-pattern

2013-05-09 Thread Chris Angelico
On Fri, May 10, 2013 at 4:59 AM, Roy Smith r...@panix.com wrote: It's not hard to imagine a file class which could be used like: f = file(/path/to/my/file) f.delete() That would be a totally different model from the current python file object. And then there would be plenty of things you

Re: Message passing syntax for objects | OOPv2

2013-05-09 Thread Ian Kelly
On Thu, May 9, 2013 at 3:51 PM, Mark Janssen dreamingforw...@gmail.com wrote: On Thu, May 9, 2013 at 10:33 AM, Ian Kelly ian.g.ke...@gmail.com wrote: On Wed, May 8, 2013 at 8:35 PM, Mark Janssen dreamingforw...@gmail.com wrote: Okay, to anyone who might be listening, I found the core of the

Re: help on Implementing a list of dicts with no data pattern

2013-05-09 Thread Dave Angel
On 05/09/2013 05:22 PM, rlelis wrote: On Thursday, May 9, 2013 7:19:38 PM UTC+1, Dave Angel wrote: Yes it's a list of string. I don't get the NameError: name 'file_content' is not defined in my code. That's because you have the 3 lines below which we hadn't seen yet. After i appended the

Re: object.enable() anti-pattern

2013-05-09 Thread Greg Ewing
Cameron Simpson wrote: You open a file with 0 modes, so that it is _immediately_ not writable. Other attempts to make the lock file thus fail because of the lack of write, I don't think that's quite right. You open it with O_CREAT+O_EXCL, which atomically fails if the file already exists. The

Re: Message passing syntax for objects | OOPv2

2013-05-09 Thread Chris Angelico
On Fri, May 10, 2013 at 8:30 AM, Ian Kelly ian.g.ke...@gmail.com wrote: On Thu, May 9, 2013 at 3:51 PM, Mark Janssen dreamingforw...@gmail.com wrote: the community stays fractured. The open source community seems pretty healthy to me. What is the basis of your claim that it is fractured?

[ANN] flask-canvas

2013-05-09 Thread Demian Brecht
A Flask extension for Facebook canvas-based applications. https://github.com/demianbrecht/flask-canvas Docs available on RTD: https://flask-canvas.readthedocs.org/en/latest/ -- Demian Brecht http://demianbrecht.github.com -- http://mail.python.org/mailman/listinfo/python-list

Re: object.enable() anti-pattern

2013-05-09 Thread Cameron Simpson
On 09May2013 11:30, Steven D'Aprano steve+comp.lang.pyt...@pearwood.info wrote: | On Thu, 09 May 2013 18:23:31 +1000, Cameron Simpson wrote: | | On 09May2013 19:54, Greg Ewing greg.ew...@canterbury.ac.nz wrote: | | Steven D'Aprano wrote: | | There is no sensible use-case for creating a file

Re: object.enable() anti-pattern

2013-05-09 Thread Gregory Ewing
Wayne Werner wrote: You don't ever want a class that has functions that need to be called in a certain order to *not* crash. That seems like an overly broad statement. What do you think the following should do? f = open(myfile.dat) f.close() data = f.read() -- Greg --

Re: Message passing syntax for objects | OOPv2

2013-05-09 Thread alex23
On 10 May, 03:33, Ian Kelly ian.g.ke...@gmail.com wrote: You've been posting on this topic for going on two months now, and I still have no idea of what the point of it all is. As Charlie Brooker put it: almost every monologue consists of nothing but the words PLEASE AUTHENTICATE MY EXISTENCE,

Re: Message passing syntax for objects | OOPv2

2013-05-09 Thread alex23
On 10 May, 07:51, Mark Janssen dreamingforw...@gmail.com wrote: You see Ian, while you and the other millions of coding practitioners have (mal)adapted to a suboptimal coding environment where hey there's a language for everyone  and terms are thrown around, misused, this is not how it needs

Re: object.enable() anti-pattern

2013-05-09 Thread Cameron Simpson
On 10May2013 10:56, Greg Ewing greg.ew...@canterbury.ac.nz wrote: | Cameron Simpson wrote: | You open a file with 0 modes, so | that it is _immediately_ not writable. Other attempts to make the | lock file thus fail because of the lack of write, | | I don't think that's quite right. You open it

Re: Making safe file names

2013-05-09 Thread Gregory Ewing
Roy Smith wrote: In article 518b133b$0$29997$c3e8da3$54964...@news.astraweb.com, Steven D'Aprano steve+comp.lang.pyt...@pearwood.info wrote: I suspect that the only way to be completely ungoogleable would be to name yourself something common, not something obscure.

Re: object.enable() anti-pattern

2013-05-09 Thread Michael Speer
By his reasoning it simply shouldn't exist. Instead you would access the information only like this: with open(myfile.dat) as f: data = f.read() Which is my preferred way to work with resources requiring cleanup in python anyways, as it ensures I have the least chance of messing things up, and

Re: object.enable() anti-pattern

2013-05-09 Thread Roy Smith
In article mailman.1514.1368145123.3114.python-l...@python.org, Michael Speer knome...@gmail.com wrote: By his reasoning it simply shouldn't exist. Instead you would access the information only like this: with open(myfile.dat) as f: data = f.read() The problem with things like file

Re: Making safe file names

2013-05-09 Thread Tim Chase
On 2013-05-10 12:04, Gregory Ewing wrote: Roy Smith wrote: http://en.wikipedia.org/wiki/The_band Nope... googling for the band brings that up as the very first result. The Google knows all. You cannot escape The Google... That does it. I'm naming my band Google. :-) -tkc --

python call golang

2013-05-09 Thread Thanatos xiao
Hey ! Now! I have written a python script . I want to call a golang script in python script. Who can give me some advices? thanks! -- http://mail.python.org/mailman/listinfo/python-list

Re: object.enable() anti-pattern

2013-05-09 Thread Steven D'Aprano
On Thu, 09 May 2013 19:34:25 +0100, MRAB wrote: There is no sensible use-case for creating a file OBJECT unless it initially wraps an open file pointer. You might want to do this: f = File(path) if f.exists(): ... This would be an alternative to: if os.path.exists(path):

Re: Message passing syntax for objects | OOPv2

2013-05-09 Thread Chris Angelico
On Fri, May 10, 2013 at 9:58 AM, alex23 wuwe...@gmail.com wrote: On 10 May, 07:51, Mark Janssen dreamingforw...@gmail.com wrote: Languages can reach for an optimal design (within a constant margin of leeway). Language expressivity can be measured. I'm sure that's great. I, however, have a

Re: object.enable() anti-pattern

2013-05-09 Thread Chris Angelico
On Fri, May 10, 2013 at 12:30 PM, Steven D'Aprano steve+comp.lang.pyt...@pearwood.info wrote: I must admit I am astonished at how controversial the opinion if your object is useless until you call 'start', you should automatically call 'start' when the object is created has turned out to be. I

Re: object.enable() anti-pattern

2013-05-09 Thread Roy Smith
In article 518c5bbc$0$29997$c3e8da3$54964...@news.astraweb.com, Steven D'Aprano steve+comp.lang.pyt...@pearwood.info wrote: I must admit I am astonished at how controversial the opinion if your object is useless until you call 'start', you should automatically call 'start' when the object

Re: Message passing syntax for objects | OOPv2

2013-05-09 Thread Mark Janssen
On Thu, May 9, 2013 at 4:58 PM, alex23 wuwe...@gmail.com wrote: On 10 May, 07:51, Mark Janssen dreamingforw...@gmail.com wrote: You see Ian, while you and the other millions of coding practitioners have (mal)adapted to a suboptimal coding environment where hey there's a language for everyone

Re: object.enable() anti-pattern

2013-05-09 Thread Mark Janssen
I think where things went pear shaped is when you made the statement: There is no sensible use-case for creating a file OBJECT unless it initially wraps an open file pointer. That's a pretty absolute point of view. Life is rarely so absolute. In the old days, it was useful to have

Re: object.enable() anti-pattern

2013-05-09 Thread Chris Angelico
On Fri, May 10, 2013 at 1:19 PM, Mark Janssen dreamingforw...@gmail.com wrote: I think where things went pear shaped is when you made the statement: There is no sensible use-case for creating a file OBJECT unless it initially wraps an open file pointer. That's a pretty absolute point of

Re: Message passing syntax for objects | OOPv2

2013-05-09 Thread Chris Angelico
On Fri, May 10, 2013 at 1:08 PM, Mark Janssen dreamingforw...@gmail.com wrote: On Thu, May 9, 2013 at 4:58 PM, alex23 wuwe...@gmail.com wrote: On 10 May, 07:51, Mark Janssen dreamingforw...@gmail.com wrote: You see Ian, while you and the other millions of coding practitioners have (mal)adapted

Re: Message passing syntax for objects | OOPv2

2013-05-09 Thread Roy Smith
In article mailman.1523.1368160434.3114.python-l...@python.org, Chris Angelico ros...@gmail.com wrote: The first hard disk I ever worked with stored 20MB in the space of a 5.25 slot (plus its associated ISA controller card). Heh. The first hard disk I ever worked with stored 2.4 MB in 6U of

Re: object.enable() anti-pattern

2013-05-09 Thread Steven D'Aprano
On Thu, 09 May 2013 23:09:55 -0400, Roy Smith wrote: In article 518c5bbc$0$29997$c3e8da3$54964...@news.astraweb.com, Steven D'Aprano steve+comp.lang.pyt...@pearwood.info wrote: I must admit I am astonished at how controversial the opinion if your object is useless until you call 'start',

Re: object.enable() anti-pattern

2013-05-09 Thread Steven D'Aprano
On Fri, 10 May 2013 09:36:43 +1000, Cameron Simpson wrote: On 09May2013 11:30, Steven D'Aprano steve+comp.lang.pyt...@pearwood.info wrote: | On Thu, 09 May 2013 18:23:31 +1000, Cameron Simpson wrote: | | On 09May2013 19:54, Greg Ewing greg.ew...@canterbury.ac.nz wrote: | | Steven

Re: object.enable() anti-pattern

2013-05-09 Thread Roy Smith
In article 518c7f05$0$29997$c3e8da3$54964...@news.astraweb.com, Steven D'Aprano steve+comp.lang.pyt...@pearwood.info wrote: there is no way to create a C file descriptor in a closed state. Such a thing does not exist. If you have a file descriptor, the file is open. Once you close it, the

[issue17943] AttributeError: 'long' object has no attribute 'release' in Queue.put()

2013-05-09 Thread Georg Brandl
New submission from Georg Brandl: I'm a bit puzzled by this exception in a long-running process (running on Python 2.7.3): ... File /usr/lib/python2.7/Queue.py, line 138, in put self.not_empty.notify() item = ('message',

[issue2704] IDLE: Patch to make PyShell behave more like a Terminal interface

2013-05-09 Thread Roger Serwy
Roger Serwy added the comment: Welcome Phil! Your patch looks good and applied cleanly to the default branch and behaves as you specified. Your submission mechanics are good! You might want to look into signing a contributor's agreement:

[issue6699] IDLE: Warn user about overwriting a file that has a newer version on filesystem

2013-05-09 Thread Terry J. Reedy
Changes by Terry J. Reedy tjre...@udel.edu: -- versions: +Python 2.7, Python 3.4 -Python 3.2 ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue6699 ___

[issue17922] Crash in clear_weakref

2013-05-09 Thread Jan Safranek
Jan Safranek added the comment: On 05/07/2013 06:06 PM, Antoine Pitrou wrote: a significant amount of static data inside CPython actually survives Py_Finalize :-/ As a solution, would it be possible to wipe all registered types in Py_Finalize? Jan --

[issue17922] Crash in clear_weakref

2013-05-09 Thread Jan Safranek
Jan Safranek added the comment: On 05/07/2013 05:32 PM, Antoine Pitrou wrote: Jan, one possibility would be for Pegasus to stop unloading Python, it seems. It is always possibility. Actually, Pegasus plugin is just a shared object (.so) and the .so is linked with Python. Pegasus calls

[issue11354] argparse: nargs could accept range of options count

2013-05-09 Thread paul j3
paul j3 added the comment: I think this patch should build on http://bugs.python.org/issue9849, which seeks to improve the error checking for nargs. There, add_argument returns an ArgumentError if the nargs value is not a valid string, interger, or it there is mismatch between a tuple

[issue16584] unhandled IOError filecmp.cmpfiles() if file not readable

2013-05-09 Thread Till Maas
Till Maas added the comment: I just tried on a Windows 8 system with python from GIMP. The error occurs there as well if I compare two empty files after I removed permissions for one of the files. I do not know how to manage Windows' file ACLs in python, therefore I created the test case

[issue17583] IDLE HOWTO

2013-05-09 Thread Amit Saha
Amit Saha added the comment: Hello, I just wanted to check if I should attach the image files separately and submit the text as a diff? Thanks. -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue17583

[issue17944] Refactor test_zipfile

2013-05-09 Thread Serhiy Storchaka
New submission from Serhiy Storchaka: Here is a patch which refactors test_zipfile, decreases it's size by 269 lines, makes adding tests for new compression types and new tests for all compression types simpler, and makes test_zipfile discoverable. -- components: Tests files:

[issue17927] Argument copied into cell still referenced by frame

2013-05-09 Thread Nick Coghlan
Nick Coghlan added the comment: Ah, I misread the second patch, I think due to the copy the cell into in the comment. I believe I would have grasped it immediately if it said something like reference the cell from. -- ___ Python tracker

[issue17941] namedtuple should support fully qualified name for more portable pickling

2013-05-09 Thread Richard Oudkerk
Richard Oudkerk added the comment: If the name is a qualified dotted name, it will be split and the first part becomes the __module__. That will not work correctly if the module name has a dot in it. -- nosy: +sbt ___ Python tracker

[issue16601] Restarting iteration over tarfile continues from where it left off.

2013-05-09 Thread Roundup Robot
Roundup Robot added the comment: New changeset 9b86fb6f5bc9 by Serhiy Storchaka in branch '2.7': Issue #16601: Restarting iteration over tarfile no more continues from where http://hg.python.org/cpython/rev/9b86fb6f5bc9 New changeset 9ed127d8ad61 by Serhiy Storchaka in branch '3.3': Issue

[issue16601] Restarting iteration over tarfile continues from where it left off.

2013-05-09 Thread Serhiy Storchaka
Serhiy Storchaka added the comment: Thank you for contribution. I have committed simpler test. -- resolution: - fixed stage: patch review - committed/rejected status: open - closed versions: -Python 3.2 ___ Python tracker rep...@bugs.python.org

[issue16601] Restarting iteration over tarfile continues from where it left off.

2013-05-09 Thread Michael Birtwell
Michael Birtwell added the comment: Sorry about the delay in the contributor form. Things got in the way then I completely forgot about it. It's done now. -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue16601

[issue16631] tarfile.extractall() doesn't extract everything if .next() was used

2013-05-09 Thread Serhiy Storchaka
Serhiy Storchaka added the comment: Patch for issue16601 has fixed this issue too. -- resolution: - duplicate stage: patch review - committed/rejected status: open - closed superseder: - Restarting iteration over tarfile continues from where it left off.

[issue17656] Python 2.7.4 breaks ZipFile extraction of zip files with unicode member paths

2013-05-09 Thread Serhiy Storchaka
Serhiy Storchaka added the comment: Shouldn't it left opened until regression fix release has released. -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue17656 ___

[issue17656] Python 2.7.4 breaks ZipFile extraction of zip files with unicode member paths

2013-05-09 Thread Antoine Pitrou
Antoine Pitrou added the comment: I don't think so. The bug is fixed, and the fix will be in the release. -- ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue17656 ___

[issue17809] FAIL: test_expanduser when $HOME ends with /

2013-05-09 Thread Roundup Robot
Roundup Robot added the comment: New changeset dee0a2dea11e by Ezio Melotti in branch '3.3': #17809: fix a test failure in test_expanduser when $HOME has a trailing /. Patch by Kubilay Kocak. http://hg.python.org/cpython/rev/dee0a2dea11e New changeset 489f075430de by Ezio Melotti in branch

[issue17943] AttributeError: 'long' object has no attribute 'release' in Queue.put()

2013-05-09 Thread Antoine Pitrou
Antoine Pitrou added the comment: Waiters are created through _allocate_lock(), so you should look there. But, unless you have further info, I don't think keeping this open as a bug is useful. -- ___ Python tracker rep...@bugs.python.org

[issue17809] FAIL: test_expanduser when $HOME ends with /

2013-05-09 Thread Ezio Melotti
Ezio Melotti added the comment: Fixed, thanks for the patch! -- resolution: - fixed stage: commit review - committed/rejected status: open - closed ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue17809

  1   2   >