Re: object.enable() anti-pattern

2013-05-09 Thread Dan Sommers
On Fri, 10 May 2013 05:03:10 +, Steven D'Aprano wrote: There is no sensible use-case for creating a file OBJECT unless it initially wraps an open file pointer. > So far the only counter-examples given aren't counter-examples ... Well, sure, if you discount operations like "create t

Re: object.enable() anti-pattern

2013-05-09 Thread Roy Smith
In article <518c7f05$0$29997$c3e8da3$54964...@news.astraweb.com>, Steven D'Aprano 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 file descriptor is no longer vali

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 > wrote: > | On Thu, 09 May 2013 18:23:31 +1000, Cameron Simpson wrote: > | > | > On 09May2013 19:54, Greg Ewing wrote: > | > | Steven D'Aprano wrote: > | > | > There is no sensible use-case for cr

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 wrote: > >> I must admit I am astonished at how controversial the opinion "if your >> object is useless until you call 'start', you should automatically cal

Re: Message passing syntax for objects | OOPv2

2013-05-09 Thread Roy Smith
In article , Chris Angelico 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 rack space (plus 4 Unibus cards worth of controller). That's no

Re: Message passing syntax for objects | OOPv2

2013-05-09 Thread Chris Angelico
On Fri, May 10, 2013 at 1:08 PM, Mark Janssen wrote: > On Thu, May 9, 2013 at 4:58 PM, alex23 wrote: >> On 10 May, 07:51, Mark Janssen 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

Re: object.enable() anti-pattern

2013-05-09 Thread Chris Angelico
On Fri, May 10, 2013 at 1:19 PM, Mark Janssen 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 view. Life is

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: Message passing syntax for objects | OOPv2

2013-05-09 Thread Mark Janssen
On Thu, May 9, 2013 at 4:58 PM, alex23 wrote: > On 10 May, 07:51, Mark Janssen 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, >> mi

Re: object.enable() anti-pattern

2013-05-09 Thread Roy Smith
In article <518c5bbc$0$29997$c3e8da3$54964...@news.astraweb.com>, Steven D'Aprano 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

Re: object.enable() anti-pattern

2013-05-09 Thread Chris Angelico
On Fri, May 10, 2013 at 12:30 PM, Steven D'Aprano 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 share your astonishment. This i

Re: Message passing syntax for objects | OOPv2

2013-05-09 Thread Chris Angelico
On Fri, May 10, 2013 at 9:58 AM, alex23 wrote: > On 10 May, 07:51, Mark Janssen 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 major project going live in > a few

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.exist

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: 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

Re: object.enable() anti-pattern

2013-05-09 Thread Roy Smith
In article , Michael Speer 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 objects is they model external real-world entities, which have ext

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, an

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 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 Nope... googling for

Re: object.enable() anti-pattern

2013-05-09 Thread Cameron Simpson
On 10May2013 10:56, Greg Ewing 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 with | O_CREAT+O_EXCL, w

Re: Message passing syntax for objects | OOPv2

2013-05-09 Thread alex23
On 10 May, 07:51, Mark Janssen 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 or should be. Please

Re: Message passing syntax for objects | OOPv2

2013-05-09 Thread alex23
On 10 May, 03:33, Ian Kelly 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, repeated over and

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 -- http://mail.p

Re: object.enable() anti-pattern

2013-05-09 Thread Cameron Simpson
On 09May2013 11:30, Steven D'Aprano wrote: | On Thu, 09 May 2013 18:23:31 +1000, Cameron Simpson wrote: | | > On 09May2013 19:54, Greg Ewing wrote: | > | Steven D'Aprano wrote: | > | > There is no sensible use-case for creating a file WITHOUT OPENING | > | > it. What would be the point? | > | |

[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: Message passing syntax for objects | OOPv2

2013-05-09 Thread Chris Angelico
On Fri, May 10, 2013 at 8:30 AM, Ian Kelly wrote: > On Thu, May 9, 2013 at 3:51 PM, Mark Janssen > 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"? The carpentry community is fractured.

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: 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 h

Re: Message passing syntax for objects | OOPv2

2013-05-09 Thread Ian Kelly
On Thu, May 9, 2013 at 3:51 PM, Mark Janssen wrote: > On Thu, May 9, 2013 at 10:33 AM, Ian Kelly wrote: >> On Wed, May 8, 2013 at 8:35 PM, Mark Janssen >> wrote: >>> Okay, to anyone who might be listening, I found the core of the problem. >> >> What "problem" are you referring to? You've been

Re: object.enable() anti-pattern

2013-05-09 Thread Chris Angelico
On Fri, May 10, 2013 at 4:59 AM, Roy Smith 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 might

Re: Message passing syntax for objects | OOPv2

2013-05-09 Thread Mark Janssen
On Thu, May 9, 2013 at 10:33 AM, Ian Kelly wrote: > On Wed, May 8, 2013 at 8:35 PM, Mark Janssen > 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 s

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: 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 collumn

Re: object.enable() anti-pattern

2013-05-09 Thread Roy Smith
In article <518be931$0$29997$c3e8da3$54964...@news.astraweb.com>, Steven D'Aprano 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 python file object only exposes those

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. H

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 wrote: There is no sensible use-case for creating a file without opening it. Sure there is. Sometimes just creating th

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 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

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() # conditions(if/else

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 spel

Re: Message passing syntax for objects | OOPv2

2013-05-09 Thread Ian Kelly
On Wed, May 8, 2013 at 8:35 PM, Mark Janssen 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 it all is. I recall so

Re: Style question -- plural of class name?

2013-05-09 Thread Neil Cerutti
On 2013-05-09, Jussi Piitulainen 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 "ints". > > Like "s

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, 2

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

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: Urgent:Serial Port Read/Write

2013-05-09 Thread Chris Angelico
On Fri, May 10, 2013 at 1:35 AM, chandan kumar 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 "Exception" se

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 also

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 scri

Re: Urgent:Serial Port Read/Write

2013-05-09 Thread Chris Angelico
On Fri, May 10, 2013 at 1:35 AM, 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

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: Style question -- plural of class name?

2013-05-09 Thread Neil Cerutti
On 2013-05-08, Denis McMahon 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 instan

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 scena

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 lin

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. The

Re: object.enable() anti-pattern

2013-05-09 Thread Oscar Benjamin
On 9 May 2013 14:07, Roy Smith wrote: > In article <518b32ef$0$11120$c3e8...@news.astraweb.com>, > Steven D'Aprano 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. T

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

2013-05-09 Thread Neil Cerutti
On 2013-05-09, rlelis 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, > content[:1])).replace('-','_').lower() >

Re: object.enable() anti-pattern

2013-05-09 Thread Roy Smith
In article <518b32ef$0$11120$c3e8...@news.astraweb.com>, Steven D'Aprano 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 example, the unix "touch" command

Re: Making safe file names

2013-05-09 Thread Roy Smith
In article <518b133b$0$29997$c3e8da3$54964...@news.astraweb.com>, Steven D'Aprano 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 -- http://mail.python.org/mailman/lis

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 dat

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 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.  Their > > computation models are

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 Coupl

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 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.

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: 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

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

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: 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: 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 li

Re: Anybody familiar with pygments ?

2013-05-09 Thread Fábio Santos
On 9 May 2013 05:19, "dabaichi" 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 with no color ?

Re: object.enable() anti-pattern

2013-05-09 Thread Cameron Simpson
On 09May2013 19:54, Greg Ewing 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 lightweight method of making a lock

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 wrote: > Hello, > > I am trying to check if an image is animated. I can't rely on the > extension as it may be a gif that's be

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: > > > > f

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 RA

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 an

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: Append to python List

2013-05-09 Thread Chris Angelico
On Thu, May 9, 2013 at 4:36 PM, RAHUL RAJ 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 list, with 'output'

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 outpu

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 swit

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

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