Re: Help in wxpython

2009-12-03 Thread r0g
Krishnakant wrote: > On Wed, 2009-12-02 at 00:20 -0800, madhura vadvalkar wrote: >> Hi >> >> I am trying to write an PAINT like application where on the mouse >> File "C:/Python26/circle.py", line 19, in InitBuffer >> dc=wx.BufferedDC(None,self.buffer) >> AttributeError: 'SketchWindow' obj

Re: Question on Python as career

2009-12-03 Thread joy99
On Dec 3, 11:16 am, Tim Roberts wrote: > joy99 wrote: > > >I am a researcher in India's one of the premier institutes.(Indian > >Institute of Science,Bangalore). > > >I have done one MA in Linguistics, did a PhD in Natural Language > >Processing and doing a Post Doctoral now. > >... > >After I co

Re: Moving from Python 2 to Python 3: A 4 page "cheat sheet"

2009-12-03 Thread Mark Summerfield
On 2 Dec, 22:49, "John Posner" wrote: > On Wed, 02 Dec 2009 13:34:11 -0500, Carsten Haese   > > wrote: > > > With string interpolation, you don't need to do that, either. > '%*d' % (8,456) > > '     456' > > Thanks, Carsten and Mark D. -- I'd forgotten about the use of "*" in   > minimum-fie

Re: Moving from Python 2 to Python 3: A 4 page "cheat sheet"

2009-12-03 Thread Mark Summerfield
On 2 Dec, 20:59, MRAB wrote: > Mark Summerfield wrote: > > On 2 Dec, 19:28, David H Wild wrote: > >> In article > >> <351fcb4c-4e88-41b0-a0aa-b3d63832d...@e23g2000yqd.googlegroups.com>, > >>    Mark Summerfield wrote: > > >>> I only just found out that I was supposed to give a different URL: > >

Re: pbs scripts

2009-12-03 Thread r0g
aoife wrote: > Hi,very new.hoping to incorporate python into my postgrad. > > Basically I have 2,000 files.I want to write a script that says: > > open each file in turn > for each file: >open this pbs script and run MUSCLE (a sequence alignment tool) > on each file >close this fi

Re: Moving from Python 2 to Python 3: A 4 page "cheat sheet"

2009-12-03 Thread Mark Summerfield
On 3 Dec, 01:17, Antoine Pitrou wrote: > Le Tue, 01 Dec 2009 06:03:36 -0800, Mark Summerfield a écrit : > > > I've produced a 4 page document that provides a very concise summary of > > Python 2<->3 differences plus the most commonly used new Python 3 > > features. It is aimed at existing Python 2

Call C program

2009-12-03 Thread Patxi Bocos
Hi!, I am developing a Python application and I need to call a C program which needs one parameter and it returns another one. How could I do it? Thanks :) -- http://mail.python.org/mailman/listinfo/python-list

Re: Question about file objects...

2009-12-03 Thread r0g
J wrote: > Something that came up in class... > > when you are pulling data from a file using f.next(), the file is read > one line at a time. > > What was explained to us is that Python iterates the file based on a > carriage return as the delimiter. > But what if you have a file that has one li

Re: Reading a file that is changing and getting the new lines

2009-12-03 Thread r0g
Ouray Viney wrote: > Hi: > > Problem: > = > I want to read a ASCII text file that can have data appended to it. I > have hacked some code together that handles the basics, but it falls > short. My code doesn't read in the new lines that could have been > added to the end of the file. No

Re: Question on Python as career

2009-12-03 Thread Tim Roberts
joy99 wrote: > >I am a researcher in India's one of the premier institutes.(Indian >Institute of Science,Bangalore). > >I have done one MA in Linguistics, did a PhD in Natural Language >Processing and doing a Post Doctoral now. >... >After I complete my Post Doctoral which may be only 2-3 months a

Re: Question on Python as career

2009-12-03 Thread r0g
Tim Roberts wrote: > joy99 wrote: >> I am a researcher in India's one of the premier institutes.(Indian >> Institute of Science,Bangalore). >> >> I have done one MA in Linguistics, did a PhD in Natural Language >> Processing and doing a Post Doctoral now. >> ... >> After I complete my Post Doctora

Re: peppy

2009-12-03 Thread Johann Spies
On Tue, Dec 01, 2009 at 07:35:52AM +, Nobody wrote: > On Tue, 01 Dec 2009 08:51:20 +0200, Johann Spies wrote: > > > After reading about peppy on Freshmeat I decided to try it out after > > installing it using easy_install. But: > > > > $ peppy > > > File > > "/usr/lib/python2.5/site-pack

Re: Help in wxpython

2009-12-03 Thread Dietmar Schwertberger
On Wed, 2009-12-02 at 00:20 -0800, madhura vadvalkar wrote: def InitBuffer(self): size=self.GetClientSize() self.Buffer=wx.EmptyBitmap(size.width,size.height) dc=wx.BufferedDC(None,self.buffer) dc.SetBackground(wx.Brush(self.GetBackgroundColour())) dc

Re: Moving from Python 2 to Python 3: A 4 page "cheat sheet"

2009-12-03 Thread Wolodja Wentland
On Wed, Dec 02, 2009 at 08:03 -0800, Mark Summerfield wrote: > On Dec 2, 11:20 am, Wolodja Wentland > > It would be quite nice if you could mark all the Python 3 idioms that > > work in Python 2.X as well. This would allow readers that are still using > > Python 2.X and are used to the 'old way'

Re: Moving from Python 2 to Python 3: A 4 page "cheat sheet"

2009-12-03 Thread David H Wild
In article <9d290ad6-e0b8-4bfa-92c8-8209c7e93...@a21g2000yqc.googlegroups.com>, Mark Summerfield wrote: > > There is a typographical fault on page 4 of this pdf file. The letter > > "P" is missing from the word "Python" at the head of the comparison > > columns. > I can't see that problem---I'

Re: Noob thread lock question

2009-12-03 Thread Astley Le Jasper
Cheers for the responses. ALJ -- http://mail.python.org/mailman/listinfo/python-list

Help with function prototype

2009-12-03 Thread Nadav Chernin
Hi, all In past I asked about module - inspect, that can't to get me prototype of C-implemented functions ( usually all built-in functions ). But, still I see that all Python Editors ( IDLE for example ) can to show prototype of built-in functions - by tooltip. When you print for example: s

Re: Insane Problem

2009-12-03 Thread Victor Subervi
On Wed, Dec 2, 2009 at 4:08 PM, MRAB wrote: > Victor Subervi wrote: > >> Hi; >> I have spent 2-3 hours trying to track this bug. Here's the code snippet: >> >> form = cgi.FieldStorage() >> fn = getattr(options, 'products') >> ourOptionsNames = [] >> optionsNames, doNotUse = fn('names') >> f

Re: Noob thread lock question

2009-12-03 Thread Lie Ryan
On 12/3/2009 6:33 AM, Astley Le Jasper wrote: I have a number of threads that write to a database. I have created a thread lock, but my question is this: - If one thread hits a lock, do a) all the other threads stop, or b) just the ones that come to the same lock? Just the ones the comes to th

Re: Creating a local variable scope.

2009-12-03 Thread Lie Ryan
On 12/2/2009 2:56 PM, Ben Finney wrote: The ‘camelCase’ form is not conformant with PEP 8 at all (which makes me glad, since it's hideous). For some reason, every time I look at a unittest code, I was thinking of Java... and not just because it's modeled after JUnitTest. -- http://mail.python

Re: Creating a local variable scope.

2009-12-03 Thread Ben Finney
Lie Ryan writes: > On 12/2/2009 2:56 PM, Ben Finney wrote: > > The ‘camelCase’ form is not conformant with PEP 8 at all (which makes me > > glad, since it's hideous). > > For some reason, every time I look at a unittest code, I was thinking > of Java... and not just because it's modeled after JUn

Re: Call C program

2009-12-03 Thread Daniel Fetchinson
> I am developing a Python application and I need to call a C program which > needs one parameter and it returns another one. You mean you need to call a C function from python? Here is an example with a C function that adds two integers: /* call this source file mymo

Re: python bijection

2009-12-03 Thread M.-A. Lemburg
Raymond Hettinger wrote: > [Joshua Bronson] >> Raymond, do you think there might be any future in including a built- >> in bidict data structure in Python? > > I don't think so. There are several forces working against it: > > * the recipe is new, so it hasn't had a chance to mature > or to ga

Re: Declaring a class level nested class?

2009-12-03 Thread Jean-Michel Pichavant
cmckenzie wrote: Hi. I'm new to Python, but I've managed to make some nice progress up to this point. After some code refactoring, I ran into a class design problem and I was wondering what the experts thought. It goes something like this: class module: nestedClass def __init__():

Re: Insane Problem

2009-12-03 Thread Victor Subervi
On Thu, Dec 3, 2009 at 6:07 AM, Victor Subervi wrote: > On Wed, Dec 2, 2009 at 4:08 PM, MRAB wrote: > >> Victor Subervi wrote: >> >>> Hi; >>> I have spent 2-3 hours trying to track this bug. Here's the code snippet: >>> >>> form = cgi.FieldStorage() >>> fn = getattr(options, 'products') >>> ou

Re: Declaring a class level nested class?

2009-12-03 Thread Jean-Michel Pichavant
Chris Rebert wrote: On Wed, Dec 2, 2009 at 8:55 PM, cmckenzie wrote: Hi. I'm new to Python, but I've managed to make some nice progress up to this point. After some code refactoring, I ran into a class design problem and I was wondering what the experts thought. It goes something like this:

Re: prolog with python

2009-12-03 Thread Sandy
you can also look at swi-prolog and python bridge: pyswip. I am using it and its very nice though it has some issues with 64-bit os. http://code.google.com/p/pyswip/ - dksr On Dec 3, 2:56 am, Chris Rebert wrote: > On Wed, Dec 2, 2009 at 6:47 PM, William Heath wrote: > > Hi All, > > > I have t

Re: Call C program

2009-12-03 Thread Patrick Sabin
Have a look at the ctypes module http://python.net/crew/theller/ctypes/tutorial.html e.g.: from ctypes import * cdll.LoadLibrary("libc.so.6") libc = CDLL("libc.so.6") print libc.rand() print libc.atoi("34") - Patrick Patxi Bocos wrote: Hi!, I am developing a Python application and I need t

Organization of GUIs

2009-12-03 Thread Michael Mossey
I have a question about typical organization of GUIs. I will be using PyQt. I have mostly used Python and C++ in my professional life, but I just took an 8 month detour into using a functional programming language called Haskell. Haskell is "pure" meaning that for the most part data is not mutable

Re: Moving from Python 2 to Python 3: A 4 page "cheat sheet"

2009-12-03 Thread Mark Summerfield
On 2 Dec, 21:28, David H Wild wrote: > In article > <9d290ad6-e0b8-4bfa-92c8-8209c7e93...@a21g2000yqc.googlegroups.com>, >    Mark Summerfield wrote: > > > > There is a typographical fault on page 4 of this pdf file. The letter > > > "P" is missing from the word "Python" at the head of the compar

Re: How to set object parameters nicely?

2009-12-03 Thread Lie Ryan
On 12/2/2009 10:26 AM, allen.fowler wrote: I've tried this, but have found two issues: 1) I can't set default values. 2) I can't set required values. In both of the above cases, if the object is created without the "exact" dict() I expect, all the assumption my methods make about what is availa

Re: Noob thread lock question

2009-12-03 Thread Astley Le Jasper
When you say don't forget about the GIL, what should I not be forgetting? I'm using sqlite and the following: <<> thread_lock = threading.RLock() def db_execute(sql): thread_lock.acquire() try: connection = sqlite3.connect(database_name)

Re: How to set object parameters nicely?

2009-12-03 Thread inhahe
On Thu, Dec 3, 2009 at 9:16 AM, Lie Ryan wrote: > On 12/2/2009 10:26 AM, allen.fowler wrote: >> >> I've tried this, but have found two issues: >> >> 1) I can't set default values. >> 2) I can't set required values. >> >> In both of the above cases, if the object is created without the >> "exact" d

Re: How to set object parameters nicely?

2009-12-03 Thread inhahe
On Thu, Dec 3, 2009 at 9:32 AM, inhahe wrote: > On Thu, Dec 3, 2009 at 9:16 AM, Lie Ryan wrote: >> On 12/2/2009 10:26 AM, allen.fowler wrote: >>> >>> I've tried this, but have found two issues: >>> >>> 1) I can't set default values. >>> 2) I can't set required values. >>> >>> In both of the above

Re: Call C program

2009-12-03 Thread Dave Angel
Patxi Bocos wrote: Hi!, I am developing a Python application and I need to call a C program which needs one parameter and it returns another one. How could I do it? Thanks :) You don't specify your python version, nor your OS. And you don't really say what state that C program is in. S

Re: Organization of GUIs

2009-12-03 Thread Lie Ryan
On 12/4/2009 12:44 AM, Michael Mossey wrote: I have a question about typical organization of GUIs. I will be using PyQt. Model-View-Controller (MVC) pattern. Model - all the business logic lives in the model. View - your GUI Controller - Takes input Controller notifies Model if there is user

Strange MySQL / sqlite3 Problem with unicode

2009-12-03 Thread Hans Müller
I have a strange unicode problem with mySQL and sqlite. In my application I get a table as a sqlite table which is being compared to an existing mySQL Table. The sqlite drive returns all strings from the table as a unicode string which is Ok. The mysql drive returns all strings as utf-8 coded

Socket question

2009-12-03 Thread perlsyntax
Is there away in python i can connect to a server in socket to two servers at the same time or can't it be done? -- http://mail.python.org/mailman/listinfo/python-list

Re: Noob thread lock question

2009-12-03 Thread Lie Ryan
On 12/4/2009 1:20 AM, Astley Le Jasper wrote: When you say don't forget about the GIL, what should I not be forgetting? I'm using sqlite and the following: I mean don't forget that when the GIL is locked, all threads (except the current one, and threads waiting on I/O) will not be able to run.

Declaring a class level nested class?

2009-12-03 Thread cmckenzie
Sigh, I'm using Google Groups and it seems I can't see my original post and everyone's replies. I'm really keen to reply back, so I'll just re-post my follow up for now and make sure I don't make a habit of this. (I'll get a news reader) Here goes: I agree, I'm C# and Java influenced, but I've got

Re: Declaring a class level nested class?

2009-12-03 Thread cmckenzie
On Dec 3, 9:59 am, cmckenzie wrote: > Sigh, I'm using Google Groups and it seems I can't see my original > post and everyone's replies. I'm really keen to reply back, so I'll > just re-post my follow up for now and make sure I don't make a habit > of this. (I'll get a news reader) Here goes: > > I

Re: Declaring a class level nested class?

2009-12-03 Thread Lie Ryan
On 12/3/2009 3:55 PM, cmckenzie wrote: I can't figure out what the correct way to construct the "nested" class so it can belong to "module". which one you want? 1. The Outside's class contains a nested class class Outside(object): class Inside(object): ... 2. The Outside's class

Re: Insane Problem

2009-12-03 Thread Victor Subervi
On Thu, Dec 3, 2009 at 8:02 AM, Victor Subervi wrote: > On Thu, Dec 3, 2009 at 6:07 AM, Victor Subervi wrote: > >> On Wed, Dec 2, 2009 at 4:08 PM, MRAB wrote: >> >>> Victor Subervi wrote: >>> Hi; I have spent 2-3 hours trying to track this bug. Here's the code snippet: f

Re: Insane Problem

2009-12-03 Thread Carsten Haese
Victor Subervi wrote: > I believe I mentioned in my first post that the "print test" does print > the exact fields being called from the referring page. Was any part of "What do the print statements actually print? Please copy and paste their output." unclear to you in any way? > Perhaps this > i

Re: Python without wrapper script

2009-12-03 Thread Jonathan Hartley
On Dec 2, 4:12 pm, Ulrich Eckhardt wrote: > eric.frederich wrote: > > Is there a way to set up environment variables in python itself > > without having a wrapper script. > > Yes, sure, you can set environment variables... > > > The wrapper script is now something like > > > #!/bin/bash > > >

Re: Python without wrapper script

2009-12-03 Thread Jonathan Hartley
On Dec 3, 3:13 pm, Jonathan Hartley wrote: > On Dec 2, 4:12 pm, Ulrich Eckhardt wrote: > > > > > eric.frederich wrote: > > > Is there a way to set up environment variables in python itself > > > without having a wrapper script. > > > Yes, sure, you can set environment variables... > > > > The wra

Re: Help in wxpython

2009-12-03 Thread Lie Ryan
On 12/3/2009 6:55 PM, r0g wrote: Krishnakant wrote: Madhura, Sorry to be a bit off-topic, but, I would really recommend you to use pygtk instead of wx. For one thing, the developers at pygtk are very active (they have their mailing list as well ) and it comes by default with python on almost all

Strange unicode / no unicode phenomen with mysql

2009-12-03 Thread Hans Müller
I have a strange unicode problem with mySQL and sqlite. In my application I get a table as a sqlite table which is being compared to an existing mySQL Table. The sqlite drive returns all strings from the table as a unicode string which is Ok. The mysql drive returns all strings as utf-8 coded

Re: Socket question

2009-12-03 Thread exarkun
On 02:52 pm, fasteliteprogram...@gmail.com wrote: Is there away in python i can connect to a server in socket to two servers at the same time or can't it be done? I'm not sure what you're asking. Can you clarify? Jean-Paul -- http://mail.python.org/mailman/listinfo/python-list

Re: Insane Problem

2009-12-03 Thread Victor Subervi
On Thu, Dec 3, 2009 at 10:13 AM, Carsten Haese wrote: > Victor Subervi wrote: > > I believe I mentioned in my first post that the "print test" does print > > the exact fields being called from the referring page. > > Was any part of "What do the print statements actually print? Please > copy and p

Re: Socket question

2009-12-03 Thread perlsyntax
On 12/03/2009 09:28 AM, exar...@twistedmatrix.com wrote: On 02:52 pm, fasteliteprogram...@gmail.com wrote: Is there away in python i can connect to a server in socket to two servers at the same time or can't it be done? I'm not sure what you're asking. Can you clarify? Jean-Paul I just want

Re: Declaring a class level nested class?

2009-12-03 Thread Lie Ryan
On 12/4/2009 1:59 AM, cmckenzie wrote: Sigh, I'm using Google Groups and it seems I can't see my original post and everyone's replies. I'm really keen to reply back, so I'll just re-post my follow up for now and make sure I don't make a habit of this. (I'll get a news reader) Here goes: I agree,

Re: Question on Python as career

2009-12-03 Thread Grant Edwards
On 2009-12-03, r0g wrote: >>> I have done one MA in Linguistics, did a PhD in Natural >>> Language Processing and doing a Post Doctoral now. ... >>> >>> After I complete my Post Doctoral which may be only 2-3 months >>> away, with this knowledge can I join IT? > Getting involved in an open sourc

Re: Insane Problem

2009-12-03 Thread Carsten Haese
Victor Subervi wrote: > In order to help you diagnose the problem, we need to see the *exact* > code you're running, we need to see the *exact* inputs going into it, > and we need to see the *exact* output coming out of it. > > > Let's see your answers and see if you're right that the

Re: Call C program

2009-12-03 Thread Grant Edwards
On 2009-12-03, Patrick Sabin wrote: >> I am developing a Python application and I need to call a C program >> which needs one parameter and it returns another one. > Have a look at the ctypes module > http://python.net/crew/theller/ctypes/tutorial.html Ctypes is great, except it's for calling

Re: Socket question

2009-12-03 Thread Grant Edwards
On 2009-12-03, perlsyntax wrote: > On 12/03/2009 09:28 AM, exar...@twistedmatrix.com wrote: >> On 02:52 pm, fasteliteprogram...@gmail.com wrote: >> >>> Is there away in python i can connect to a server in socket to >>> two servers at the same time or can't it be done? >> >> I'm not sure what you'r

Re: Insane Problem

2009-12-03 Thread Victor Subervi
On Thu, Dec 3, 2009 at 10:53 AM, Carsten Haese wrote: > Victor Subervi wrote: > > In order to help you diagnose the problem, we need to see the *exact* > > code you're running, we need to see the *exact* inputs going into it, > > and we need to see the *exact* output coming out of it.

Re: Socket question

2009-12-03 Thread D'Arcy J.M. Cain
On Thu, 03 Dec 2009 09:45:19 -0600 perlsyntax wrote: > On 12/03/2009 09:28 AM, exar...@twistedmatrix.com wrote: > > On 02:52 pm, fasteliteprogram...@gmail.com wrote: > >> Is there away in python i can connect to a server in socket to two > >> servers at the same time or can't it be done? > > > >

Re: Socket question

2009-12-03 Thread cassiope
On Dec 3, 7:45 am, perlsyntax wrote: > On 12/03/2009 09:28 AM, exar...@twistedmatrix.com wrote:> On 02:52 pm, > fasteliteprogram...@gmail.com wrote: > >> Is there away in python i can connect to a server in socket to two > >> servers at the same time or can't it be done? > > > I'm not sure what y

Re: How to set object parameters nicely?

2009-12-03 Thread Bruno Desthuilliers
allen.fowler a écrit : (snip) In this case, and I am trying to create a number of ORM-like objects. (Though, there is no database involved.) So, instances of these classes are acting as records that are shuttled around in the system, and the object's properties are acting as values. The paramet

Re: Socket question

2009-12-03 Thread Lie Ryan
On 12/4/2009 1:52 AM, perlsyntax wrote: Is there away in python i can connect to a server in socket to two servers at the same time or can't it be done? use threading or non-blocking read. -- http://mail.python.org/mailman/listinfo/python-list

Re: Insane Problem

2009-12-03 Thread Carsten Haese
Victor Subervi wrote: > No, it doesn't, because you've only provided one third of what I asked > for. I also asked for the code and the inputs that go into it. > > > I provided those earlier. No, you didn't provide the exact code you're running. You provided a selected snippet you deemed

Re: Insane Problem

2009-12-03 Thread Victor Subervi
On Thu, Dec 3, 2009 at 12:38 PM, Carsten Haese wrote: > Victor Subervi wrote: > > No, it doesn't, because you've only provided one third of what I > asked > > for. I also asked for the code and the inputs that go into it. > > > > > > I provided those earlier. > > No, you didn't provide the

Re: python bijection

2009-12-03 Thread geremy condra
On Thu, Dec 3, 2009 at 7:04 AM, M.-A. Lemburg wrote: > Raymond Hettinger wrote: >> [Joshua Bronson] >>> Raymond, do you think there might be any future in including a built- >>> in bidict data structure in Python? >> >> I don't think so.  There are several forces working against it: >> >> * the re

Re: python bijection

2009-12-03 Thread M.-A. Lemburg
geremy condra wrote: > On Thu, Dec 3, 2009 at 7:04 AM, M.-A. Lemburg wrote: >> I think the only major CS data type missing from Python is some >> form of (fast) directed graph implementation à la kjGraph: >> >>http://gadfly.sourceforge.net/kjbuckets.html >> >> With these, you can easily build

Re: Organization of GUIs

2009-12-03 Thread Dietmar Schwertberger
Michael Mossey schrieb: View can be fine-grained. Often the View consists of a number of GUI objects. Some people write this in a democratic arrangement---they all talk to each other. This can make analyzing system behavior complicated. Hence my proposal for a hierarchy. Yes, the democratic arra

Ignoring XML Namespaces with ElementTree

2009-12-03 Thread Pete
Is there anyway to configure ElementTree to ignore the XML namespace? For the past couple months, I've been using minidom to parse an XML file that is generated by a unit within my organization that can't stick with a standard. This hasnt been a problem until recently when the script was provided a

Incorrect number of bytes returned by getsockopt(socket.SOL_SOCKET, socket.TCP_INFO, buflen)

2009-12-03 Thread Ashwin Rao
Hi, I need to retrieve the tcp_info from a socket using getsockopt. The details of structure tcp_info are available at [http://src.gnu- darwin.org/src/sys/netinet/tcp.h.html]. The getsockopt method for a socket whose documentation is available at [http://docs.python.org/ library/socket.html#socke

Does Python mess with the (unicode) code page?

2009-12-03 Thread Roy Smith
We've got a windows executable which used to get run out of a shell script (Cygwin bash) and is now being run with subprocess.Popen(). The windows app is misbehaving. To make a long story short, the guy who wrote the code in question says, > it's all based on the return values of the WinAPI c

Re: Incorrect number of bytes returned by getsockopt(socket.SOL_SOCKET, socket.TCP_INFO, buflen)

2009-12-03 Thread Roy Smith
In article <5c2800de-a6d2-4863-b423-87ef80d95...@k17g2000yqh.googlegroups.com>, Ashwin Rao wrote: > I computed the size of the tcp_info using the > following program, which returned 104. > --- > #include > #include > > int main() > { > printf("%d", sizeof(struct tcp_info)); > } In general

Re: Ignoring XML Namespaces with ElementTree

2009-12-03 Thread Stefan Behnel
Pete, 03.12.2009 19:21: > Is there anyway to configure ElementTree to ignore the XML namespace? > For the past couple months, I've been using minidom to parse an XML > file that is generated by a unit within my organization that can't > stick with a standard. This hasnt been a problem until recentl

Re: Question about file objects...

2009-12-03 Thread nn
On Dec 2, 6:56 pm, Terry Reedy wrote: > J wrote: > > On Wed, Dec 2, 2009 at 09:27, nn wrote: > >>> Is there a way to read the file, one item at a time, delimited by > >>> commas WITHOUT having to read all 16,000 items from that one line, > >>> then split them out into a list or dictionary?? > > >

Re: Bored.

2009-12-03 Thread Anssi Saari
Necronymouse writes: > Hello, I am learning python for about 2 years and I am bored. Not with > python but I have a little problem, when i want to write something I > realise that somebody had alredy written it! So i don´t want to make a > copy of something but i wanna get better in python skills

Re: Help with function prototype

2009-12-03 Thread Chris Rebert
On Thu, Dec 3, 2009 at 3:02 AM, Nadav Chernin wrote: > Hi, all > > In past I asked about module – inspect, that can’t to get me prototype of > C-implemented functions ( usually all built-in functions ). > > But, still I see that all Python Editors ( IDLE for example ) can to show > prototype of bu

Re: Language mavens: Is there a programming with "if then else ENDIF" syntax?

2009-12-03 Thread Michael Torrie
Steven D'Aprano wrote: > But you're right, the convention of using verbs for functions isn't as > strong as the convention of using nouns for classes and types. The idea that functions should be verbs is plain wrong, coming from the traditional world of functional programming. Since functions s

Re: Language mavens: Is there a programming with "if then else ENDIF" syntax?

2009-12-03 Thread Michael Torrie
Steve Ferg wrote: > Is there any particular reason why this might be a *bad* language- > design idea? Syntactically, using braces, begin/end blocks, python white space, and your if/elif/then/endif structures, amounts to the same thing; they are all equivalent. Thus from a language pov, there's no

Re: Language mavens: Is there a programming with "if then else ENDIF" syntax?

2009-12-03 Thread Robert Kern
On 2009-12-03 14:56 PM, Michael Torrie wrote: I'm not sure, but Python's grammar is LL(1) I think, and probably darn close to context-free. It is LL(1) after some non-formal postprocessing of the tokens to properly handle the indentation. -- Robert Kern "I have come to believe that the who

Re: python bijection

2009-12-03 Thread Francis Carr
[In re R. Hettinger's critiques] > * it extends the language with arcane syntax tricks... I think most of these in the current version of J. Bronson's "bidict" can be left unused, or removed altogether. In almost all cases, a bidict should be accessed as an ordinary python dict. > * we've alrea

Re: slightly OT: Python BootCamp

2009-12-03 Thread J
On Sun, Nov 29, 2009 at 20:14, Terry Reedy wrote: > J wrote: >> >> Ok... so I've been re-teaching myself python, as it's been several >> years since I last really used it.  And in the midst of this, my >> contracting company came up to me on Friday and asked if I'd be >> interested in filling a la

Re: Help in wxpython

2009-12-03 Thread Nobody
On Thu, 03 Dec 2009 07:55:19 +, r0g wrote: > I have to recommend to opposite, stick with wx. What's the point of > tying yourself into GTK when wx works on Mac, PC and Linux? The main drawbacks are that wxWidgets sucks compared to GTK or Qt (mostly due to being modelled on the Win32 API, whic

More elegant solution for diffing two sequences

2009-12-03 Thread Ulrich Eckhardt
Hi! I'm trying to write some code to diff two fonts. What I have is every character (glyph) of the two fonts in a list. I know that the list is sorted by the codepoints of the characters. What I'd like to ask is whether there is a more elegant solution to the loop below or whether there are any

Re: Incorrect number of bytes returned by getsockopt(socket.SOL_SOCKET, socket.TCP_INFO, buflen)

2009-12-03 Thread Martien Verbruggen
On Thu, 3 Dec 2009 10:29:13 -0800 (PST), Ashwin Rao wrote: > tcp_info = sock.getsockopt(socket.SOL_SOCKET, socket.TCP_INFO, 104) In C, to get tcp_info, SOL_SOCKET should be IPPROTO_TCP. I'm assuming it's the same in Python, although I've never tried it. Martien --

Re: Ignoring XML Namespaces with ElementTree

2009-12-03 Thread Pete
On Dec 3, 2:55 pm, Stefan Behnel wrote: > Pete, 03.12.2009 19:21: > > > Is there anyway to configure ElementTree to ignore the XML namespace? > > For the past couple months, I've been using minidom to parse an XML > > file that is generated by a unit within my organization that can't > > stick wit

confusing thread behavior

2009-12-03 Thread paul
I have been experiencing strange thread behavior when I pass a message received via a Queue to a wx.PostEvent method (from wxPython). The relevant code in the thread is: def run(self): while self.is_running: task = self.queue.get() wx.PostEvent(self.app.handle_task, task) sel

Re: More elegant solution for diffing two sequences

2009-12-03 Thread Lie Ryan
On 12/4/2009 8:28 AM, Ulrich Eckhardt wrote: I'm trying to write some code to diff two fonts. What I have is every character (glyph) of the two fonts in a list. I know that the list is sorted by the codepoints of the characters. What I'd like to ask is whether there is a more elegant solution to

Re: confused with os.fork()

2009-12-03 Thread Aahz
In article , Dennis Lee Bieber wrote: >On Wed, 25 Nov 2009 13:52:09 -0800 (PST), Sandy >declaimed the following in gmane.comp.python.general: >> >> Sometimes (very rare) it prints something like this: >> ab >> c >> d >> e > > Not > >ab > >c >d >e > >? That's what I would guess, too. >

Re: confusing thread behavior

2009-12-03 Thread Mike Driscoll
On Dec 3, 3:42 pm, paul wrote: > I have been experiencing strange thread behavior when I pass a message > received via a Queue to a wx.PostEvent method (from wxPython). The > relevant code in the thread is: > > def run(self): >     while self.is_running: >         task = self.queue.get() >        

Re: Strange unicode / no unicode phenomen with mysql

2009-12-03 Thread Hans Müller
I found the bug, it's in the mysql module. When a column has COLLATE=utf8_bin set, the column is NOT returned as unicode. It's a known bug #541198 Thanks all for reading. Greetings Hans -- http://mail.python.org/mailman/listinfo/python-list

Re: Help in wxpython

2009-12-03 Thread Mike Driscoll
On Dec 2, 10:05 pm, Krishnakant wrote: > On Wed, 2009-12-02 at 00:20 -0800, madhura vadvalkar wrote: > > Hi > > > I am trying to write an  PAINT like application where on the mouse > > click a circle is drawn on canvas. I am new to python and using > > wxpython to create this. > > > here is the co

Re: Help in wxpython

2009-12-03 Thread Mike Driscoll
On Dec 3, 3:22 pm, Nobody wrote: > On Thu, 03 Dec 2009 07:55:19 +, r0g wrote: > > I have to recommend to opposite, stick with wx. What's the point of > > tying yourself into GTK when wx works on Mac, PC and Linux? > > The main drawbacks are that wxWidgets sucks compared to GTK or Qt (mostly >

Re: confusing thread behavior

2009-12-03 Thread paul
On Dec 3, 2:03 pm, Mike Driscoll wrote: > On Dec 3, 3:42 pm, paul wrote: > > > > > > > I have been experiencing strange thread behavior when I pass a message > > received via a Queue to a wx.PostEvent method (from wxPython). The > > relevant code in the thread is: > > > def run(self): > >     whi

Overriding module's class

2009-12-03 Thread Pavel Skvazh
Is it possible to override a class in the module or the module itself that is imported across the project to add new methods to it? For example I've got module 'a' with class A from a import A but I don't want to add a method to that A class not just in this unit, but across the project, so eve

Re: Bored.

2009-12-03 Thread Ognjen Bezanov
Anssi Saari wrote: Necronymouse writes: Hello, I am learning python for about 2 years and I am bored. Not with python but I have a little problem, when i want to write something I realise that somebody had alredy written it! So i don´t want to make a copy of something but i wanna get better in

Re: Overriding module's class

2009-12-03 Thread Bruno Desthuilliers
Pavel Skvazh a écrit : > Is it possible to override a class in the module or the module itself > that is imported across the project to add new methods to it? > > For example I've got > > module 'a' with class A > > from a import A > > but I don't want to add a method to that A class not just i

Re: Organization of GUIs

2009-12-03 Thread Michael Torrie
Lie Ryan wrote: > On 12/4/2009 12:44 AM, Michael Mossey wrote: >> I have a question about typical organization of GUIs. I will be using >> PyQt. >> > > Model-View-Controller (MVC) pattern. > > Model - all the business logic lives in the model. > View - your GUI > Controller - Takes input No, you

Re: Help in wxpython

2009-12-03 Thread Kevin Walzer
Madhura, Sorry to be a bit off-topic, but, I would really recommend you to use pygtk instead of wx. For one thing, the developers at pygtk are very active (they have their mailing list as well ) and it comes by default with python on almost all linux distros. You can also easily install it on w

Re: python bijection

2009-12-03 Thread geremy condra
On Thu, Dec 3, 2009 at 12:57 PM, M.-A. Lemburg wrote: > geremy condra wrote: >> On Thu, Dec 3, 2009 at 7:04 AM, M.-A. Lemburg wrote: >>> I think the only major CS data type missing from Python is some >>> form of (fast) directed graph implementation à la kjGraph: >>> >>>    http://gadfly.sourcefo

Re: UnicodeDecodeError? Argh! Nothing works! I'm tired and hurting and...

2009-12-03 Thread Michael Ströder
Aahz wrote: > In article <031bc732$0$1336$c3e8...@news.astraweb.com>, > Steven D'Aprano wrote: >> Good grief, it's about six weeks away from 2010 and Thunderbird still >> uses mbox as it's default mail box format. Hello, the nineties called, >> they want their mail formats back! Are the tbird d

Which is more pythonic?

2009-12-03 Thread Filip Gruszczyński
I have just written a very small snippet of code and started thinking, which version would be more pythonic. Basically, I am adding a list of string to combo box in qt. So, the most obvious way is: for choice in self.__choices: choicesBox.addItem(choice) But I could also do: map(self.__c

Re: Organization of GUIs

2009-12-03 Thread Michael Mossey
On Dec 3, 6:38 am, Lie Ryan wrote: > On 12/4/2009 12:44 AM, Michael Mossey wrote: > > > I have a question about typical organization of GUIs. I will be using > > PyQt. > > Model-View-Controller (MVC) pattern. > > Model - all the business logic lives in the model. > View - your GUI > Controller - T

  1   2   >