Re: Why NOT only one class per file?

2007-04-05 Thread Steven Howe
Now we're at the '_/How many Angels can dance on the head of a pin/_' question (like anything with wings would waste time dancing. Ever seen eagles mate (not the football players)? Dance it's not, but it looks like /sex on a roller coaster only better/! Get me a pair of wings!). Religious war

Re:

2007-04-05 Thread C.L.
James Stroud mbi.ucla.edu> writes: > > C.L. wrote: > > I was looking for a function or method that would return the index to the > > first matching element in a list. ... > > ... __please don't be overly defensive__ ... > > The amount of typing wasted to defend design decisions such as this can

Re: Looping issues

2007-04-05 Thread Peter Otten
Larry Bates wrote: > If the files aren't terribly large (not tested): > > correct_lines=open(r"C:\Python25\Scripts\Output" \ > "\correct_settings.txt", "r").readlines() > > current_lines=open(r"C:\Python25\Scripts\Output\output.txt", > "r").readlines() >

Re: Why NOT only one class per file?

2007-04-05 Thread Alex Martelli
John Nagle <[EMAIL PROTECTED]> wrote: > systems that didn't work that way, in which the program source was > manipulated within the language environment, in a more structured > fashion. Smalltalk, LISP, and (wierdly) Forth environments have been > built that way. But it never really caught on.

Re: SNMP agent

2007-04-05 Thread alain
On Apr 5, 6:50 pm, [EMAIL PROTECTED] (Cameron Laird) wrote: > In article <[EMAIL PROTECTED]>, > > alain <[EMAIL PROTECTED]> wrote: > >On Apr 4, 1:30 pm, alf <[EMAIL PROTECTED]> wrote: > > >> twistedmatrix.org? > > >I already took a look at it but the agent functionality is somewhat > >primitive. I

Re: "index" method only for mutable sequences??

2007-04-05 Thread James Stroud
C.L. wrote: > I was looking for a function or method that would return the index to the > first > matching element in a list. Coming from a C++ STL background, I thought it > might > be called "find". My first stop was the Sequence Types page of the Library > Reference (http://docs.python.org/lib

Re: Problems with os.spawnv

2007-04-05 Thread Gabriel Genellina
Henrik Lied wrote: > > Does the command work OK from the console? > > Try from the python interpreter, using P_WAIT, and inspect the returned > > value. > That's what I've done. P_WAIT returned a the PID 127 - but there's > still no sign of the FLV-file, I'm afraid. This does not look like a Pyth

Re: Extract zip file from email attachment

2007-04-05 Thread Gabriel Genellina
erikcw wrote: > resp = p.retr(msg_num) > if resp[0].startswith('+OK'): You don't have to check this; errors are transformed into exceptions. > fileObj = StringIO.StringIO() cStringIO is faster > fileObj.write( part.get_payload() ) You

Re: communication between two classes which in different threading

2007-04-05 Thread Marco
Yes, use signal/slot could reslove this question! On 4/6/07, Marco <[EMAIL PROTECTED]> wrote: > Hello, > > I write two class, which one is Gui(PyQt4) other is socket server. I > wanna: if socket recv() something, Gui will show it in a label. > But it seems that I cannot call the func from other

About python Sybase module and the database manipulation!

2007-04-05 Thread boyeestudio
I write a python program which can insert one record into the Sybase databae at a time using the function "fetchone()",But I find it runs slowly. So I want speed it up,But I don't know how to manipulate the database more efficiently! Thread or any other methods can do it?? -- http://mail.python.o

Re: "index" method only for mutable sequences??

2007-04-05 Thread 7stud
C.L. wrote: > I was looking for a function or method that would return the index to the > first > matching element in a list. Coming from a C++ STL background, I thought it > might > be called "find". My first stop was the Sequence Types page of the Library > Reference (http://docs.python.org/li

Re: Welch essential for learning Tkinter well?

2007-04-05 Thread Paul Rubin
Dick Moores <[EMAIL PROTECTED]> writes: > In a couple of places recently I've seen Brent Welch's _Practical > Programming in Tcl & Tk_ () recommended for > learning Tkinter well. I'm skeptical of the value of learning Tkinter really well. No matter how thoroughly you le

"index" method only for mutable sequences??

2007-04-05 Thread C.L.
I was looking for a function or method that would return the index to the first matching element in a list. Coming from a C++ STL background, I thought it might be called "find". My first stop was the Sequence Types page of the Library Reference (http://docs.python.org/lib/typesseq.html); it wasn't

Re: ipython env

2007-04-05 Thread Fernando Perez
Larry Bates wrote: > Greg Donald wrote: >> Anyone know what's up with environment variables when using ipython? [...] > In Cpython you get this with: > > import os > os.environ['EDITOR'] Yup, same in ipython :) Just to clarify, env is just a convenience function in ipython that simply does thi

communication between two classes which in different threading

2007-04-05 Thread Marco
Hello, I write two class, which one is Gui(PyQt4) other is socket server. I wanna: if socket recv() something, Gui will show it in a label. But it seems that I cannot call the func from other threading. How to reslove it? Thank you! -- LinuX Power -- http://mail.python.org/mailman/listinfo/

Re: Easy question: More items in a For loop?

2007-04-05 Thread BJörn Lindqvist
> Here is some sample tuna: > ['[7:55pm] My teachings goes back to the last iceage.\r\n', > '[7:55pm] <%Zack> ahh now it does\r\n', '[7:55pm] <%Zack> ok\r\n', > '[7:55pm] Or it is down just for you.\r\n', '[7:55pm] <@FC3> > which one? that -12000 ice age or the one before\r\n', '[7:55pm] > the e

Re: Why NOT only one class per file?

2007-04-05 Thread Sherm Pendley
Bruno Desthuilliers <[EMAIL PROTECTED]> writes: > Sherm Pendley a écrit : >> Bruno Desthuilliers <[EMAIL PROTECTED]> writes: >> >> >>>Sherm Pendley a écrit : >>> >>>In my book, it's huge classes and methods that are usually a smell of >>>a design problem. >> >> >> Obviously we're reading different

Re: Support SSL for Solaris 10

2007-04-05 Thread Trent Mick
campos wrote: > Last time I installed Python 2.5 by default, it didn't support SSL. > When I tried to use HTTPS, the following error occured: > AttributeError: 'module' object has no attribute 'ssl' The ActivePython 2.5 builds for Solaris on SPARC (the "solaris8-sparc" build) supports OpenSSL. No

Re: Extract zip file from email attachment

2007-04-05 Thread erikcw
On Apr 5, 8:00 pm, hlubenow <[EMAIL PROTECTED]> wrote: > erikcw wrote: > > Hi all, > > > I'm trying to extract zip file (containing an xml file) from an email > > so I can process it. But I'm running up against some brick walls. > > I've been googling and reading all afternoon, and can't seem to f

Easy question: More items in a For loop?

2007-04-05 Thread Adam W.
I'm trying to write a script that will parse IRC chat logs and color code them if it finds certain characters. I was able to make this work with one character, but to make it even more accurate I would like to use two identifying characters. Here is my code : import urllib2 response = urllib2.u

Re: Why NOT only one class per file?

2007-04-05 Thread John Nagle
Bruno Desthuilliers wrote: > John Nagle a écrit : > >> Nate Finch wrote: > Having source code as text files may not be such a bad thing. Diffing, > grepping and versioning binary files is not that easy... There are tools for that sort of thing, although they're not well known in the open so

Re: Why NOT only one class per file?

2007-04-05 Thread Malcolm Dew-Jones
Chris Lasher ([EMAIL PROTECTED]) wrote: : A friend of mine with a programming background in Java and Perl places : each class in its own separate file in . Java doesn't actually require one class per file, it requires one public class per file. You can have any number of helper classes in the sa

Re: Indentifying the LAST occurrence of an item in a list

2007-04-05 Thread John Machin
On Apr 6, 4:55 am, "mkPyVS" <[EMAIL PROTECTED]> wrote: > Not sure below is better but it hacks at larger chunks (excuse the 10 > second coding) > m = [2,9,1,5,6,3,1,1,9,2] > f = 1 > temp = m Overwritten 3 statements later > location = m.index(f) > gloc = location > temp = m[location:] > while 1:

Re: Why NOT only one class per file?

2007-04-05 Thread Carl Banks
On Apr 4, 5:23 pm, "Chris Lasher" <[EMAIL PROTECTED]> wrote: > A friend of mine with a programming background in Java and Perl places > each class in its own separate file in . I informed him that keeping > all related classes together in a single file is more in the Python > idiom than one file pe

Re: Extract zip file from email attachment

2007-04-05 Thread hlubenow
erikcw wrote: > Hi all, > > I'm trying to extract zip file (containing an xml file) from an email > so I can process it. But I'm running up against some brick walls. > I've been googling and reading all afternoon, and can't seem to figure > it out. > > Here is what I have so far. > > p = POP3(

Re: Why NOT only one class per file?

2007-04-05 Thread Bruno Desthuilliers
Sherm Pendley a écrit : > Bruno Desthuilliers <[EMAIL PROTECTED]> writes: > > >>Sherm Pendley a écrit : >> >>In my book, it's huge classes and methods that are usually a smell of >>a design problem. > > > Obviously we're reading different books. Obviously. But I didn't gain this knowledge from

Extract zip file from email attachment

2007-04-05 Thread erikcw
Hi all, I'm trying to extract zip file (containing an xml file) from an email so I can process it. But I'm running up against some brick walls. I've been googling and reading all afternoon, and can't seem to figure it out. Here is what I have so far. p = POP3("mail.server.com") print p.getwelco

Re: RFC: Assignment as expression (pre-PEP)

2007-04-05 Thread Gabriel Genellina
En Thu, 05 Apr 2007 18:08:46 -0300, [EMAIL PROTECTED] <[EMAIL PROTECTED]> escribió: > I am trying to write a parser for a text string. Specifically, I am > trying to take a filename that contains meta-data about the content of > the A/V file (mpg, mp3, etc.). > > I first split the filename into

Re: Why NOT only one class per file?

2007-04-05 Thread Bruno Desthuilliers
Steve Holden a écrit : > Bruno Desthuilliers wrote: > >> John Nagle a écrit : >> >>> Nate Finch wrote: > > [...] > >> >>>Interestingly, PHP breaks this model; PHP programs are web pages. >> >> >> Err... Actually, "web pages" *are* text files. And FWIW, in most php >> programs (at least the

Re: way to extract only the message from pop3

2007-04-05 Thread Tim Williams
On 06/04/07, Tim Williams <[EMAIL PROTECTED]> wrote: > Content: ['text/plain', 'text/html', 'message/delivery-status', > 'text/plain', 'text/plain', 'text/plain', 'unknown', 'message/rfc822', > 'text/plain', 'text/html'] I should explain that this was the content in a single email > > # part.get

Re: RFC: Assignment as expression (pre-PEP)

2007-04-05 Thread Bruno Desthuilliers
Duncan Booth a écrit : > [EMAIL PROTECTED] wrote: > > >>Performing a list of mutually exclusive checks that require data >>processing can cause excessive tabification. For example, consider >>the following python snipet... >> >>temp = my_re1.match(exp) >>if temp: >> # do something with temp >>e

Re: Prevent Modification of Script?

2007-04-05 Thread Kiel W.
On Apr 4, 10:19 pm, James Stroud <[EMAIL PROTECTED]> wrote: > You are worrying a little too much. Lets say you are genuinely worried > about malware Thanks for the feedback. Perhaps you are correct about being too worried.. eh, to be honest you probably are. > Write your program in the language m

Re: RFC: Assignment as expression (pre-PEP)

2007-04-05 Thread Bruno Desthuilliers
[EMAIL PROTECTED] a écrit : > I would like to gauge interest in the following proposal: > > Problem: > > Assignment statements cannot be used as expressions. This is by design. > Performing a list of mutually exclusive checks that require data > processing can cause excessive tabification. For

Re: Prevent Modification of Script?

2007-04-05 Thread Kiel W.
On Apr 5, 2:45 am, Thomas Bellman <[EMAIL PROTECTED]> wrote: > No. To be blunt, it is an effect of you not knowing enough about > security. Blunt is good =) I ask question because I don't know. I appreciate your honesty. -- http://mail.python.org/mailman/listinfo/python-list

Re: way to extract only the message from pop3

2007-04-05 Thread Tim Williams
On 05/04/07, Collin Stocks <[EMAIL PROTECTED]> wrote: > On 3 Apr 2007 12:36:10 -0700, flit <[EMAIL PROTECTED]> wrote: > > Hello All, > > > > Using poplib in python I can extract only the headers using the .top, > > there is a way to extract only the message text without the headers? > > > so get

Re: RFC: Assignment as expression (pre-PEP)

2007-04-05 Thread Steven Bethard
Steven Bethard wrote: > [EMAIL PROTECTED] wrote: >> On Apr 5, 4:22 pm, Duncan Booth <[EMAIL PROTECTED]> wrote: >>> Can you come up with a real example where this happens and which >>> cannot be >>> easily rewritten to provide better, clearer code without the >>> indentation? >>> >>> I'll admit to

Re: grandparent method with super

2007-04-05 Thread Bruno Desthuilliers
[EMAIL PROTECTED] a écrit : > On Apr 5, 3:19 pm, Martin Manns <[EMAIL PROTECTED]> wrote: > >>Hi, >> >>I have a class structure as follows and I would like to invoke the >>method A.m() from D.m >> >>class A(object): >>def m(self): >>class B(A): >>def m(self): >>class C(A): >>

Re: RFC: Assignment as expression (pre-PEP)

2007-04-05 Thread Steven Bethard
[EMAIL PROTECTED] wrote: > On Apr 5, 4:22 pm, Duncan Booth <[EMAIL PROTECTED]> wrote: >> Can you come up with a real example where this happens and which cannot be >> easily rewritten to provide better, clearer code without the indentation? >> >> I'll admit to having occasionally had code not entir

Re: grandparent method with super

2007-04-05 Thread Martin Manns
On 5 Apr 2007 15:05:25 -0700 [EMAIL PROTECTED] wrote: > > class E(C,D): > def m(self): > for cls in E.__mro__: > if cls != E and cls not in E.__bases__: > cls.m(self) > break > > > ... but it's probably better that you > rethink your class

Re: Problems with os.spawnv

2007-04-05 Thread Henrik Lied
On Apr 6, 12:09 am, "Gabriel Genellina" <[EMAIL PROTECTED]> wrote: > En Thu, 05 Apr 2007 18:53:04 -0300, Henrik Lied <[EMAIL PROTECTED]> > escribió: > > > On Apr 5, 11:39 pm, "Gabriel Genellina" <[EMAIL PROTECTED]> > > wrote: > >> v = os.spawnl(os.P_NOWAIT, "mencoder", "mencoder", > >> "/Users

RE: grandparent method with super

2007-04-05 Thread John Clark
> Not really. The first grandparent would be the first occurrence in the list from left to right, which satisfies the requirement that its shortest path to the current class is 2. > The only problem: How do I get it? > Martin I suppose you could do a self.__class__.__bases__[0].__bases__[

Re: RFC: Assignment as expression (pre-PEP)

2007-04-05 Thread [EMAIL PROTECTED]
On Apr 5, 6:01 pm, Neil Hodgson <[EMAIL PROTECTED]> wrote: > [EMAIL PROTECTED]: > > > else: > > my_match = capper_re.match(f): > > if my_match: > > capper = capper_re.match(f).group(1) > > if capper == 'JJ' or capper == 'JeffreyJacobs'

Re: grandparent method with super

2007-04-05 Thread attn . steven . kuo
On Apr 5, 2:13 pm, Martin Manns <[EMAIL PROTECTED]> wrote: > On Thu, 5 Apr 2007 16:55:38 -0400 > > > > "John Clark" <[EMAIL PROTECTED]> wrote: > > >That works, but when I replace A with something else, I do not get > > >the > > grandparent anymore > > >without changing all the method calls. Basical

Re: Problems with os.spawnv

2007-04-05 Thread Gabriel Genellina
En Thu, 05 Apr 2007 18:53:04 -0300, Henrik Lied <[EMAIL PROTECTED]> escribió: > On Apr 5, 11:39 pm, "Gabriel Genellina" <[EMAIL PROTECTED]> > wrote: >> v = os.spawnl(os.P_NOWAIT, "mencoder", "mencoder", >> "/Users/henriklied/test.mov", "-ofps", "25", "-o", "...") >> > Thanks for your reply

Re: ipython env

2007-04-05 Thread Larry Bates
Greg Donald wrote: > Anyone know what's up with environment variables when using ipython? > > When I type 'env' and hit return I get a dictionary full of useful > information (trimmed for brevity): > > In [1]: env > Out[1]: > {'EDITOR': '/usr/bin/vim', > [...] > '_': '/Library/Frameworks/Python.f

Re: RFC: Assignment as expression (pre-PEP)

2007-04-05 Thread Neil Hodgson
[EMAIL PROTECTED]: > else: > my_match = capper_re.match(f): > if my_match: > capper = capper_re.match(f).group(1) > if capper == 'JJ' or capper == 'JeffreyJacobs': > capper = 'Jeffrey C. Jacobs' > p

tkinter canvas mvc

2007-04-05 Thread Gigs_
Hi all! I have just finished my tkinter text editor, learning tkinter purpose. Now I want to learn canvas so I want to make my paint program, I think that this will be the best to do over model-view-controler pattern which I need to learn also. Is there any good tutorial for mvc in python or

Re: ascii-unicode replacement

2007-04-05 Thread Andrea Valle
Many thanks Gabriel Convert to unicode right there, using read_text.decode("ascii"). You have unicode now. That's exactly what I was searching for. This new line: text = text.decode("ascii") solved my problem. Best -a- -- Andrea Valle -

Re: ipython env

2007-04-05 Thread Greg Donald
On 4/5/07, Gabriel Genellina <[EMAIL PROTECTED]> wrote: > > NameError: name 'env' is not defined > > Try os.environ Thanks. -- Greg Donald http://destiney.com/ -- http://mail.python.org/mailman/listinfo/python-list

Re: Why NOT only one class per file?

2007-04-05 Thread Sherm Pendley
"Nate Finch" <[EMAIL PROTECTED]> writes: > As to the guy who writes 1000+ line classes dude, refactor some. > You're trying to make the class do too much, almost by definition. You haven't even seen my code, you don't even know what language it's in, but you're telling me it's wrong? Wow -

Re: Python and Java

2007-04-05 Thread Steve Holden
Ed Jensen wrote: > Steve Holden <[EMAIL PROTECTED]> wrote: >> Jython is an implementation of Python that compiles to Java bytecode, >> but at the moment there's some version lag so it won't handle the mos >> recent language enhancements. Probably worth a look, though. >> >>http://www.jython.o

Re: ipython env

2007-04-05 Thread Gabriel Genellina
En Thu, 05 Apr 2007 18:48:27 -0300, Greg Donald <[EMAIL PROTECTED]> escribió: > Anyone know what's up with environment variables when using ipython? > > When I type 'env' and hit return I get a dictionary full of useful > information (trimmed for brevity): > But then when try to access the infor

Re: Problems with os.spawnv

2007-04-05 Thread Henrik Lied
On Apr 5, 11:39 pm, "Gabriel Genellina" <[EMAIL PROTECTED]> wrote: > En Thu, 05 Apr 2007 18:19:56 -0300, Henrik Lied <[EMAIL PROTECTED]> > escribió: > > > So, I thought to myself that spawnv would be a good fit for this. The > > problem is that it doesn't fire of the command. > > > Here's my test s

Re: Why NOT only one class per file?

2007-04-05 Thread Sherm Pendley
Bruno Desthuilliers <[EMAIL PROTECTED]> writes: > Sherm Pendley a écrit : > > In my book, it's huge classes and methods that are usually a smell of > a design problem. Obviously we're reading different books. But that's OK - I'm not on a crusade to convince everyone to work my way. If "one class

Re: grandparent method with super

2007-04-05 Thread Gabriel Genellina
En Thu, 05 Apr 2007 18:13:06 -0300, Martin Manns <[EMAIL PROTECTED]> escribió: > On Thu, 5 Apr 2007 16:55:38 -0400 > "John Clark" <[EMAIL PROTECTED]> wrote: >> Because the MRO isn't just a depth first traversal, the term "first >> grandparent" gets tricky to define... > > Not really. The first gr

ipython env

2007-04-05 Thread Greg Donald
Anyone know what's up with environment variables when using ipython? When I type 'env' and hit return I get a dictionary full of useful information (trimmed for brevity): In [1]: env Out[1]: {'EDITOR': '/usr/bin/vim', [...] '_': '/Library/Frameworks/Python.framework/Versions/Current/bin/ipython'

Re: Python and Java

2007-04-05 Thread Ed Jensen
Steve Holden <[EMAIL PROTECTED]> wrote: > Jython is an implementation of Python that compiles to Java bytecode, > but at the moment there's some version lag so it won't handle the mos > recent language enhancements. Probably worth a look, though. > >http://www.jython.org/ Does Jython compil

Re: UNICODE mode for regular expressions - time to change the default?

2007-04-05 Thread Steve Holden
John Nagle wrote: >Regular expressions are compiled in ASCII mode unless > Unicode mode is specified to "rc.compile". The difference is that regular > expressions in ASCII mode don't recognize things like > Unicode whitespace, even when applied to Unicode strings. > For example, Unicode charac

Re: Problems with os.spawnv

2007-04-05 Thread Henrik Lied
On Apr 5, 11:33 pm, [EMAIL PROTECTED] wrote: > On Apr 5, 4:19 pm, "Henrik Lied" <[EMAIL PROTECTED]> wrote: > > > > > Hi there! > > > I'm trying to convert a video in a background process. > > The scenario I'm after: > > 1. The user uploads a video > > 2. The video is saved in my media directory, an

Re: Problems with os.spawnv

2007-04-05 Thread Gabriel Genellina
En Thu, 05 Apr 2007 18:19:56 -0300, Henrik Lied <[EMAIL PROTECTED]> escribió: > So, I thought to myself that spawnv would be a good fit for this. The > problem is that it doesn't fire of the command. > > Here's my test script: http://dpaste.com/hold/7981/ > > Why won't this work? The while-loop

Re: Problems with os.spawnv

2007-04-05 Thread kyosohma
On Apr 5, 4:19 pm, "Henrik Lied" <[EMAIL PROTECTED]> wrote: > Hi there! > > I'm trying to convert a video in a background process. > The scenario I'm after: > 1. The user uploads a video > 2. The video is saved in my media directory, and the database is > populated with the references > 3. The vide

Re: Looping issues

2007-04-05 Thread hlubenow
[EMAIL PROTECTED] wrote: > On Apr 5, 2:18 pm, "anglozaxxon" <[EMAIL PROTECTED]> wrote: >> On Apr 5, 2:01 pm, [EMAIL PROTECTED] wrote: >> >> >> >> > What I am trying to do is compare two files to each other. >> >> > If the 2nd file contains the same line the first file contains, I want >> > to prin

Re: elementary tuple question. (sorry)

2007-04-05 Thread 7stud
On Apr 5, 3:08 pm, "Steven W. Orr" <[EMAIL PROTECTED]> wrote: > I have a tuple that I got from struct.unpack. Now I want to pass the data > from the returned tuple to struct.pack > > >>> fmt > > 'l 10l 11i h 4h c 47c 0l'>>>struct.pack(fmt, tup) > > Traceback (most recent call last): >File "", l

Re: elementary tuple question. (sorry)

2007-04-05 Thread Gabriel Genellina
En Thu, 05 Apr 2007 18:08:14 -0300, Steven W. Orr <[EMAIL PROTECTED]> escribió: > I have a tuple that I got from struct.unpack. Now I want to pass the data > from the returned tuple to struct.pack > fmt > 'l 10l 11i h 4h c 47c 0l' struct.pack(fmt, tup) > Traceback (most recent call las

Problems with os.spawnv

2007-04-05 Thread Henrik Lied
Hi there! I'm trying to convert a video in a background process. The scenario I'm after: 1. The user uploads a video 2. The video is saved in my media directory, and the database is populated with the references 3. The video gets converted to FLV - but the user shouldn't have to wait around for th

Re: elementary tuple question. (sorry)

2007-04-05 Thread attn . steven . kuo
On Apr 5, 2:08 pm, "Steven W. Orr" <[EMAIL PROTECTED]> wrote: > I have a tuple that I got from struct.unpack. Now I want to pass the data > from the returned tuple to struct.pack > > >>> fmt > > 'l 10l 11i h 4h c 47c 0l'>>>struct.pack(fmt, tup) > > Traceback (most recent call last): >File "", l

Re: grandparent method with super

2007-04-05 Thread Martin Manns
On Thu, 5 Apr 2007 16:55:38 -0400 "John Clark" <[EMAIL PROTECTED]> wrote: > >That works, but when I replace A with something else, I do not get > >the > grandparent anymore > >without changing all the method calls. Basically, I would like to > >call the > method m in the first > >grandpar

Re: RFC: Assignment as expression (pre-PEP)

2007-04-05 Thread [EMAIL PROTECTED]
On Apr 5, 4:22 pm, Duncan Booth <[EMAIL PROTECTED]> wrote: > Can you come up with a real example where this happens and which cannot be > easily rewritten to provide better, clearer code without the indentation? > > I'll admit to having occasionally had code not entirely dissimilar to this > when f

elementary tuple question. (sorry)

2007-04-05 Thread Steven W. Orr
I have a tuple that I got from struct.unpack. Now I want to pass the data from the returned tuple to struct.pack >>> fmt 'l 10l 11i h 4h c 47c 0l' >>>struct.pack(fmt, tup) Traceback (most recent call last): File "", line 1, in ? struct.error: required argument is not an integer What's the idi

Re: UNICODE mode for regular expressions - time to change the default?

2007-04-05 Thread John Machin
On Apr 6, 5:50 am, John Nagle <[EMAIL PROTECTED]> wrote: >Regular expressions are compiled in ASCII mode > unless > Unicode mode is specified to "rc.compile". The difference is that regular > expressions in ASCII mode don't recognize things like > Unicode whitespace, even when applied to Unico

RE: grandparent method with super

2007-04-05 Thread John Clark
>> Pretty sure you can do this: >> >> class A(object): >> def m(self): >> class B(A): >> def m(self): >> class C(A): >> def m(self): >> class D(B,C): >> def m(self): >> A.m(self) >> >> I don't think you want to try to use super() in this case. > >That works, but

Pil Raw Image Viewer-- How to get image mode

2007-04-05 Thread Andrew
Hello Ive been messing around with a simple raw image viewer using Pil and Tkinter However I am running into problems displaying the images they appear to be not correct I believe it is cause of the modes for the different files but I am unsure If someone could examine my code and assist in he

Re: grandparent method with super

2007-04-05 Thread Martin Manns
On Thu, 5 Apr 2007 16:33:37 -0400 "John Clark" <[EMAIL PROTECTED]> wrote: > Pretty sure you can do this: > > class A(object): > def m(self): > class B(A): > def m(self): > class C(A): > def m(self): > class D(B,C): > def m(self): > A.m(self) > > I don't thi

Re: RFC: Assignment as expression (pre-PEP)

2007-04-05 Thread Duncan Booth
Carsten Haese <[EMAIL PROTECTED]> wrote: > If that's your only justification for this proposal, that's almost > certainly not enough to convince anybody of its necessity. Your code > example should be rewritten as a loop: > > match_actions = [(my_re1, action1), > (my_re2, action2

Re: how to build a forum in Python?

2007-04-05 Thread Pierre Quentel
Hi, I think you should take a look at Karrigell : http://karrigell.sourceforge.net It's a Python web framework and the package includes a forum application Regards, Pierre -- http://mail.python.org/mailman/listinfo/python-list

RE: grandparent method with super

2007-04-05 Thread John Clark
Pretty sure you can do this: class A(object): def m(self): class B(A): def m(self): class C(A): def m(self): class D(B,C): def m(self): A.m(self) I don't think you want to try to use super() in this case. -jdc -Original Message- From: [E

Re: grandparent method with super

2007-04-05 Thread kyosohma
On Apr 5, 3:19 pm, Martin Manns <[EMAIL PROTECTED]> wrote: > Hi, > > I have a class structure as follows and I would like to invoke the > method A.m() from D.m > > class A(object): > def m(self): > class B(A): > def m(self): > class C(A): > def m(self): > class D(B,C): >

Re: RFC: Assignment as expression (pre-PEP)

2007-04-05 Thread Duncan Booth
[EMAIL PROTECTED] wrote: > Performing a list of mutually exclusive checks that require data > processing can cause excessive tabification. For example, consider > the following python snipet... > > temp = my_re1.match(exp) > if temp: > # do something with temp > else: > temp = my_re2.match(e

grandparent method with super

2007-04-05 Thread Martin Manns
Hi, I have a class structure as follows and I would like to invoke the method A.m() from D.m class A(object): def m(self): class B(A): def m(self): class C(A): def m(self): class D(B,C): def m(self): # Call A.m with super? I have read http://www.py

Re: Cascading ifs

2007-04-05 Thread Sick Monkey
If it is just the indentation that is bothering you, you could do this: match = "test" if match == "1": print "1" elif match == "2": print "2" elif match == "test": print "test" On 4/2/07, Ernesto García García <[EMAIL PROTECTED]> wrote: Hi experts, How would you do this without the

Re: RFC: Assignment as expression (pre-PEP)

2007-04-05 Thread Carsten Haese
On Thu, 2007-04-05 at 12:51 -0700, [EMAIL PROTECTED] wrote: > I would like to gauge interest in the following proposal: > > Problem: > > Assignment statements cannot be used as expressions. > > Performing a list of mutually exclusive checks that require data > processing can cause excessive tabif

Re: Trouble w/ 'create table' sql on mx.ODBC

2007-04-05 Thread Greg Corradini
Thanks for responding everyone, I never received a traceback, the program did complete without changes to the database. However, the conn.commit() did work (Thanks Steve). I should've know that was the problem (or at least tried), b/c I saw so many posts about a similar problem with Update and I

Re: Looping issues

2007-04-05 Thread Sick Monkey
Ooops, Sorry I left .lower() out. def fopen(fname): try: return open(fname, 'U') except IOError, detail: return fail("couldn't open " + fname + ": " + str(detail))

Re: Looping issues

2007-04-05 Thread Sick Monkey
Try this. NOTE: The script below will compare lines of both files (even hidden characters such as \n)... def fopen(fname): try: return open(fname, 'U') except IOError, detail: return fail("couldn't open " + fnam

Re: Can we make a local variable in a function as global variable???

2007-04-05 Thread Collin Stocks
Then name it something else. I tend to chose "this" because it is a meaningless name that would not tend to be used for anything else. I would have used "self", except that that tends to be used inside classes. My inspiration for coming up with this is to make modules a little more like classes. I

Re: Objects, lists and assigning values

2007-04-05 Thread Hamilton, William
-Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Manuel Graune Sent: Thursday, April 05, 2007 12:14 PM To: python-list@python.org Subject: Objects, lists and assigning values Hello, while trying to learn how to program using objects in python (up to now s

Re: Looping issues

2007-04-05 Thread Hamilton, William
-Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of [EMAIL PROTECTED] Sent: Thursday, April 05, 2007 1:01 PM To: python-list@python.org Subject: Looping issues What I am trying to do is compare two files to each other. If the 2nd file contains the same line t

Re: ascii-unicode replacement

2007-04-05 Thread Gabriel Genellina
En Thu, 05 Apr 2007 14:28:20 -0300, Andrea Valle <[EMAIL PROTECTED]> escribió: > I scripted some text files with another language which cannot handle > unicode. > As I need special character in the resulting text files (IPA > extension), my idea was to define some special ascii sequences in the

RFC: Assignment as expression (pre-PEP)

2007-04-05 Thread TimeHorse
I would like to gauge interest in the following proposal: Problem: Assignment statements cannot be used as expressions. Performing a list of mutually exclusive checks that require data processing can cause excessive tabification. For example, consider the following python snipet... temp = my_r

UNICODE mode for regular expressions - time to change the default?

2007-04-05 Thread John Nagle
Regular expressions are compiled in ASCII mode unless Unicode mode is specified to "rc.compile". The difference is that regular expressions in ASCII mode don't recognize things like Unicode whitespace, even when applied to Unicode strings. For example, Unicode character 0x00A0 is a "NO-BREAK SP

Re: Looping issues

2007-04-05 Thread Bruno Desthuilliers
[EMAIL PROTECTED] a écrit : > What I am trying to do is compare two files to each other. > > If the 2nd file contains the same line the first file contains, I want > to print it. I wrote up the following code: > > > > correct_settings = open("C:\Python25\Scripts\Output > \correct_settings.txt",

Re: how to remove multiple occurrences of a string within a list?

2007-04-05 Thread waylan
On Apr 3, 6:05 pm, Steven Bethard <[EMAIL PROTECTED]> wrote: > bahoo wrote: > > The larger problem is, I have a list of strings that I want to remove > > from another list of strings. > > If you don't care about the resulting order:: > > >>> items = ['foo', 'bar', 'baz', 'bar', 'foo', 'frobble

Re: Looping issues

2007-04-05 Thread anglozaxxon
On Apr 5, 2:27 pm, Larry Bates <[EMAIL PROTECTED]> wrote: > [EMAIL PROTECTED] wrote: > > What I am trying to do is compare two files to each other. > > > If the 2nd file contains the same line the first file contains, I want > > to print it. I wrote up the following code: > > > correct_settings = o

Re: Why NOT only one class per file?

2007-04-05 Thread Steve Holden
Bruno Desthuilliers wrote: > John Nagle a écrit : >> Nate Finch wrote: [...] > >>Interestingly, PHP breaks this model; PHP programs are web pages. > > Err... Actually, "web pages" *are* text files. And FWIW, in most php > programs (at least the clean ones), the application logic is in separa

Re: Trouble w/ 'create table' sql on mx.ODBC

2007-04-05 Thread Gabriel Genellina
En Thu, 05 Apr 2007 16:25:08 -0300, Greg Corradini <[EMAIL PROTECTED]> escribió: > Lately I've been using the mx.ODBC module to query Access (mdb) tables. > For > the life of me, I can't get the 'create table' sql command to work. I use > this command in Oracle and I've seen other mx.ODBC user

Re: Trouble w/ 'create table' sql on mx.ODBC

2007-04-05 Thread Steve Holden
Greg Corradini wrote: > Hello, > Lately I've been using the mx.ODBC module to query Access (mdb) tables. For > the life of me, I can't get the 'create table' sql command to work. I use > this command in Oracle and I've seen other mx.ODBC users weave into their > scripts for Access. But I still can'

Re: Why NOT only one class per file?

2007-04-05 Thread Nate Finch
On Apr 5, 10:48 am, Bruno Desthuilliers wrote: > Nate Finch a écrit : > > > So, here's a view from a guy who's not a python nut and has a long > > history of professional programming in other languages (C++, C, C#, > > Java) > > There are quite a few professional programmers here with experience o

Trouble w/ 'create table' sql on mx.ODBC

2007-04-05 Thread Greg Corradini
Hello, Lately I've been using the mx.ODBC module to query Access (mdb) tables. For the life of me, I can't get the 'create table' sql command to work. I use this command in Oracle and I've seen other mx.ODBC users weave into their scripts for Access. But I still can't get this simple test run belo

Re: Why NOT only one class per file?

2007-04-05 Thread Bruno Desthuilliers
John Nagle a écrit : > Nate Finch wrote: > >> I think you're all going about this the wrong way. There's no reason >> to *always* have one class per file. However, there's also no reason >> to have 1600 lines of code and 50 classes in one file either. > > >It's really an operating system t

Re: Can we make a local variable in a function as global variable???

2007-04-05 Thread Steve Holden
Collin Stocks wrote: > As for me, I find this problem annoying, but easy to solve. My solution is: > > >>> this=__import__(__name__) > > To set global variable spam to 4, I say: > > >>> this.spam=4 > > This always works, and is much more convenient than: > > >>> global spam > >>> spam=4 >

  1   2   3   >