Re: Self function

2009-05-05 Thread Steven D'Aprano
On Mon, 04 May 2009 17:54:50 -0400, Terry Reedy wrote: bearophileh...@lycos.com wrote: Another possible syntax: def fact(n): return 1 if n = 1 else n * return(n - 1) But I guess most people don't see this problem as importantcommon enough to justify changing the language.

Re: Self function

2009-05-05 Thread Carl Banks
On May 4, 8:22 pm, Steven D'Aprano ste...@remove.this.cybersource.com.au wrote: On Mon, 04 May 2009 15:51:15 -0700, Carl Banks wrote: All recursion does it make what you're doing a lot less readable for almost all programmers. What nonsense. It's not nonsense for a singly-linked list. I

Which one is best Python or Java for developing GUI applications?

2009-05-05 Thread srinivasan srinivas
Could you tell me does Python have any advantages over Java for the development of GUI applications? Thanks, Srini Now surf faster and smarter ! Check out the new Firefox 3 - Yahoo! Edition http://downloads.yahoo.com/in/firefox/?fr=om_email_firefox --

Re: Self function

2009-05-05 Thread Chris Rebert
On Mon, May 4, 2009 at 11:08 PM, Steven D'Aprano ste...@remove.this.cybersource.com.au wrote: On Mon, 04 May 2009 17:54:50 -0400, Terry Reedy wrote: bearophileh...@lycos.com wrote: Another possible syntax: def fact(n):     return 1 if n = 1 else n * return(n - 1) But I guess most people

Re: Any idea to emulate tail -f

2009-05-05 Thread CTO
On May 5, 2:00 am, Joel Juvenal Rivera Rivera joel...@gmail.com wrote: I want to make something very similar to  the command tail -f (follow a file), i have been trying  with some while True and some microsleeps (about .1 s); did someone has already done something like this? And about the

Re: Self function

2009-05-05 Thread Carl Banks
On May 4, 8:26 pm, Steven D'Aprano ste...@remove.this.cybersource.com.au wrote: On Mon, 04 May 2009 16:33:13 -0700, Carl Banks wrote: On May 4, 4:06 pm, bearophileh...@lycos.com wrote: Carl Banks: 1. Singly-linked lists can and should be handled with iteration. I was talking about a

Re: Self function

2009-05-05 Thread Arnaud Delobelle
On 5 May, 07:08, Steven D'Aprano ste...@remove.this.cybersource.com.au wrote: On Mon, 04 May 2009 17:54:50 -0400, Terry Reedy wrote: bearophileh...@lycos.com wrote: Another possible syntax: def fact(n):     return 1 if n = 1 else n * return(n - 1) But I guess most people don't see

Re: Self function

2009-05-05 Thread CTO
On May 5, 2:08 am, Steven D'Aprano ste...@remove.this.cybersource.com.au wrote: On Mon, 04 May 2009 17:54:50 -0400, Terry Reedy wrote: bearophileh...@lycos.com wrote: Another possible syntax: def fact(n):     return 1 if n = 1 else n * return(n - 1) But I guess most people don't see

Re: Self function

2009-05-05 Thread Paul Rubin
bearophileh...@lycos.com writes: This happens to me more than one time every year. So I have written this: ... self_name = getframeinfo(currentframe()).function ZOMG, you've got to be kidding. I'd expect Pylint to catch that sort of error statically. If not, the best approach is

Re: Which one is best Python or Java for developing GUI applications?

2009-05-05 Thread Paul Rubin
srinivasan srinivas sri_anna...@yahoo.co.in writes: Could you tell me does Python have any advantages over Java for the development of GUI applications? Yes. -- http://mail.python.org/mailman/listinfo/python-list

Re: Code works fine except...

2009-05-05 Thread John Yeung
On May 5, 1:12 am, John Yeung gallium.arsen...@gmail.com wrote: [...] the problem may require bigger guns (either much better math or much more sophisticated programming). Yes, I'm responding to myself. Well, I went ahead with the approach I mentioned earlier, generating all possible matches

Re: Personal recommendations for Python and Django on-boarding materials

2009-05-05 Thread Bruno Desthuilliers
Arnaud Delobelle a écrit : Grant Rettke gret...@gmail.com writes: Hi folks, From one developer to another, I am looking for some personal recommendations on what are the best materials for fast tracking an on- boarding to Python and Django. I know how to program, get web apps and OO; this is

Re: Which one is best Python or Java for developing GUI applications?

2009-05-05 Thread Bruno Desthuilliers
Paul Rubin a écrit : srinivasan srinivas sri_anna...@yahoo.co.in writes: Could you tell me does Python have any advantages over Java for the development of GUI applications? Yes. Indeed. -- http://mail.python.org/mailman/listinfo/python-list

Re: Tkinter, Trouble with Message,Label widget

2009-05-05 Thread Hendrik van Rooyen
norseman norse...@hughes.net wrote: Hendrik van Rooyen mentioned the textvar too. Thanks Hendrik Yeah - and also omitted to mention the set method. With friends like that, who needs enemies? - Hendrik -- http://mail.python.org/mailman/listinfo/python-list

Re: Which one is best Python or Java for developing GUI applications?

2009-05-05 Thread Leon
I think there are two advantages over java for GUI application First, python is more productive and has very rich third modules support, you can check the demo of wxPython. Second, you can develop native-looking GUI BTW: I'm developing GUI application using python and wxPython. Second, On

Re: Self function

2009-05-05 Thread Steven D'Aprano
On Mon, 04 May 2009 23:09:25 -0700, Carl Banks wrote: On May 4, 8:22 pm, Steven D'Aprano ste...@remove.this.cybersource.com.au wrote: On Mon, 04 May 2009 15:51:15 -0700, Carl Banks wrote: All recursion does it make what you're doing a lot less readable for almost all programmers. What

Re: Which one is best Python or Java for developing GUI applications?

2009-05-05 Thread Paul Rudin
Paul Rubin http://phr...@nospam.invalid writes: srinivasan srinivas sri_anna...@yahoo.co.in writes: Could you tell me does Python have any advantages over Java for the development of GUI applications? Yes. Clearly c.l.p needs to adopt the SNB http://cam.misc.org.uk/snb convention :) --

Re: Self function

2009-05-05 Thread Steven D'Aprano
On Tue, 05 May 2009 00:09:27 -0700, Arnaud Delobelle wrote: Are you aware of PEP 3130? http://www.python.org/dev/peps/pep-3130/ I am now. Very disappointing. (BTW, it seems to me that your implementation breaks as soon as two functions are decorated - not tested!) Of course it does! That's

Re: Self function

2009-05-05 Thread Carl Banks
On May 5, 12:51 am, Steven D'Aprano ste...@remove.this.cybersource.com.au wrote: On Mon, 04 May 2009 23:09:25 -0700, Carl Banks wrote: In Python the One Obvious Way is iteration when possible, recursion when necessary. There's nothing obvious about solving the 8 Queens problem using

Re: Self function

2009-05-05 Thread wolfram . hinderer
On 5 Mai, 08:08, Steven D'Aprano ste...@remove.this.cybersource.com.au wrote: Self-reflective functions like these are (almost?) unique in Python in that they require a known name to work correctly. You can rename a class, instance or module and expect it to continue to work, but not so for

Re: Self function

2009-05-05 Thread Steven D'Aprano
On Mon, 04 May 2009 23:55:41 -0700, Carl Banks wrote: On May 4, 8:26 pm, Steven D'Aprano ste...@remove.this.cybersource.com.au wrote: On Mon, 04 May 2009 16:33:13 -0700, Carl Banks wrote: On May 4, 4:06 pm, bearophileh...@lycos.com wrote: Carl Banks: 1. Singly-linked lists can and

Re: Self function

2009-05-05 Thread Steven D'Aprano
On Tue, 05 May 2009 01:25:49 -0700, Carl Banks wrote: *Sigh* Well, I'm out of this debate. Apparently it's not possible to argue that recursivie algorithms should be avoided *sometimes* without everyone citing cases that obviously aren't from those times (as if I had been arguing that

Re: Which one is best Python or Java for developing GUI applications?

2009-05-05 Thread srinivasan srinivas
Could you list down those advantages?? - Original Message From: Bruno Desthuilliers bruno.42.desthuilli...@websiteburo.invalid To: python-list@python.org Sent: Tuesday, 5 May, 2009 1:07:41 PM Subject: Re: Which one is best Python or Java for developing GUI applications? Paul Rubin a

Re: change some lines from a read file

2009-05-05 Thread utab
On May 4, 10:06 pm, Anthra Norell anthra.nor...@bluewin.ch wrote: utab wrote: Dear all, I have to change some lines from a template file, which is rather long to paste here, but I would like to make some parts of some lines optional with my command line arguments but I could not see this

Re: Which one is best Python or Java for developing GUI applications?

2009-05-05 Thread Chris Rebert
On Tue, May 5, 2009 at 12:26 AM, Paul Rudin paul.nos...@rudin.co.uk wrote: Paul Rubin http://phr...@nospam.invalid writes: srinivasan srinivas sri_anna...@yahoo.co.in writes: Could you tell me does Python have any advantages over Java for the development of GUI applications? Yes. Clearly

Re: Any idea to emulate tail -f

2009-05-05 Thread Lawrence D'Oliveiro
In message mailman.5091.1241503147.11746.python-l...@python.org, Joel Juvenal Rivera Rivera wrote: I want to make something very similar to the command tail -f (follow a file) ... http://codecodex.com/wiki/index.php?title=Monitoring_a_Log_File --

what's the best way to call a method of object without a guarantee of its existence

2009-05-05 Thread Leon
One way, define the object before it is used, like this: object = None . . if object is not None: object.method() The other way, using try ... catch try: object.method() catch NameError: pass for big programs, which is better, or any other way? Miles --

Re: find sublist inside list

2009-05-05 Thread Gerard Flanagan
Matthias Gallé wrote: Hi. My problem is to replace all occurrences of a sublist with a new element. Example: Given ['a','c','a','c','c','g','a','c'] I want to replace all occurrences of ['a','c'] by 6 (result [6,6,'c','g',6]). For novelty value: from itertools import izip def

Re: Any idea to emulate tail -f

2009-05-05 Thread Iain King
On May 5, 7:00 am, Joel Juvenal Rivera Rivera joel...@gmail.com wrote: I want to make something very similar to  the command tail -f (follow a file), i have been trying  with some while True and some microsleeps (about .1 s); did someone has already done something like this? And about the

Re: what's the best way to call a method of object without a guarantee of its existence

2009-05-05 Thread Marco Mariani
Leon wrote: One way, define the object before it is used, like this: object = None This is a good practice anyway. Conditional existance of objects is quite evil. Resorting to if defined('foo') is double-plus-ugly. The other way, using try ... catch try: object.method() catch

Re: find sublist inside list

2009-05-05 Thread mzdude
On May 4, 4:54 pm, Gabriel Genellina gagsl-...@yahoo.com.ar wrote: En Mon, 04 May 2009 15:12:41 -0300, mzdude jsa...@cox.net escribió: substring isn't limited to 0..255 substring = \0x%d\0x%d % (257,257) 'acaccgac'.replace(ac, substring)

Re: stuck with PyOBEX

2009-05-05 Thread alejandro
Ejla! I have sent you a mail (in case you check it often like me :-)) David Boddie da...@boddie.org.uk wrote in message news:gtkhdr$ob...@get-news01.get.basefarm.net... On Sunday 03 May 2009 10:33, alejandro wrote: Yes! I'll send you an updated version to try if you would like to test it.

Re: exit a program gracefully

2009-05-05 Thread Lawrence D'Oliveiro
In message mailman.5079.1241476454.11746.python-l...@python.org, Gabriel Genellina wrote: I prefer to put the code inside a function, and just `return` earlier. It would be nice if Python offered a straightforward equivalent to ... initialization goes here ... do /*once*/ {

Re: exit a program gracefully

2009-05-05 Thread Cameron Simpson
On 05May2009 23:28, Lawrence D'Oliveiro l...@geek-central.gen.new_zealand wrote: | In message mailman.5079.1241476454.11746.python-l...@python.org, Gabriel | Genellina wrote: | | I prefer to put the code inside a function, and just `return` earlier. | | It would be nice if Python offered a

help required with pylons

2009-05-05 Thread M Kumar
Hi, I am having an application server in pylons, which was giving error sometimes and sometimes it gives the result. I will copy paste the error below. I am new to pylons and not getting any clue of this kind of behavior. Please help me what should I do to avoid this kind of errors.

problem in using sendmail in multi thread

2009-05-05 Thread gganesh
hi, I'm a beginner in using Python script I'm trying to send mails using multi-thread I wrote FROM = 'ganeshx...@.com' # for more mail add';' the another mail id listTo = ['g@gmail.com', 'xxjango...@gmail.com', 'xx...@yahoo.co.in'] SUBJECT = 'This is the subject' MSGBODY = 'This the

Re: Self function

2009-05-05 Thread Luis Zarrabeitia
On Tuesday 05 May 2009 02:46:58 am Chris Rebert wrote: devils_advocate Adding syntax is EVIL(tm) for it angers the Gods of Backwards Compatibility, and this proposal is completely unnecessary because you could instead just write: [...] And there would be much clashing with existing variable

Re: Self function

2009-05-05 Thread Luis Zarrabeitia
On Tuesday 05 May 2009 03:51:19 am Steven D'Aprano wrote: def ivisit(node):     print node     while node and node.link is not None:         node = node.link         print node def rvisit(node):     print node     if node and node.link is not None:         rvisit(node.link) If there

Re: Self function

2009-05-05 Thread Luis Zarrabeitia
On Tuesday 05 May 2009 04:25:49 am Carl Banks wrote: Iteration should be used instead of recursion anywhere a tail- recursive algorithm is possible.  Recursion should be used only when tail-recursion is not possible. Why? Is it because most languages suck at recursion (specially python, as

How to build Python 2.6.2 on HP-UX Itanium with thread support?

2009-05-05 Thread henning . vonbargen
Our program that makes use of cx_Oracle and multi-threading (and works fine on Windows, Linux and other platforms, including HP-UX PA-RISC), fails to run on HP-UX Itanium. When trying to start the first daemon thread, the program raises an exception: ... File

Re: Self function

2009-05-05 Thread Arnaud Delobelle
On 5 May, 13:33, Luis Zarrabeitia ky...@uh.cu wrote: On Tuesday 05 May 2009 02:46:58 am Chris Rebert wrote: devils_advocate Adding syntax is EVIL(tm) for it angers the Gods of Backwards Compatibility, and this proposal is completely unnecessary because you could instead just write:

New Module Proposal

2009-05-05 Thread Riccardo Fadiga
Greetings, I'm a basic python coder, and I wrote for myself a module wich has many function regarding encryption/decryption with Caesar, Vigenere, RSA and many more ciphers. People told me that it would be useful that it would be included in stardard Python distribution. I'll send you a copy of

Re: Multiprocessing.Queue - I want to end.

2009-05-05 Thread Luis Alberto Zarrabeitia Gomez
Quoting Cameron Simpson c...@zip.com.au: | And as it happens I have an IterableQueue class right here which does | _exact_ what was just described. You're welcome to it if you like. | Added bonus is that, as the name suggests, you can use the class as | an iterator: | for item in iterq:

Is there is any way to send messages to chunk of emails ID's concurrently using smptlib

2009-05-05 Thread gganesh
Hi friends, I suppose sendmail() can send mails one by one ,how to send mails concurrently , It would be very grateful,if someone could point out a solution. Thanks Ganesh -- http://mail.python.org/mailman/listinfo/python-list

Re: Can someone please explain to me this code?

2009-05-05 Thread CTO
root.change_attributes(event_mask = X.KeyPressMask) This asks X to send this application keypress events root.grab_key(keycode, X.AnyModifier, 1,X.GrabModeAsync, X.GrabModeAsync) This tells X to grab the keyboard if the given keycode is generated and any modifier is pressed, not to stop

Re: Problem with case insensitive volumes

2009-05-05 Thread spillz
os;walk will tell you the correct case for each node.   So if it gives you a different case than the stored form, you have your answer. Thanks, although I was hoping that wouldn't be the answer (I have to compare a LOT of files). -- http://mail.python.org/mailman/listinfo/python-list

Re: Profiling gives very different predictions of best algorithm

2009-05-05 Thread Rick
On May 2, 9:10 am, Rick rpmul...@gmail.com wrote: I was posting to the list mostly because I would like to know whether I can do something different when I profile my code so that it give results that correspond more closely to those that the nonprofiling results give. A good comment that

Re: Question of UTF16BE encoding / decoding

2009-05-05 Thread Napalmski
In article mailman.5089.1241500903.11746.python-l...@python.org, metolone+gm...@gmail.com says... import binascii s = '004e006100700061006c006d' h = binascii.unhexlify(s) print h.decode('utf-16-be') -Mark And: name2 = name2.encode(utf-16-be) print binascii.b2a_hex(name2) to

Re: find sublist inside list

2009-05-05 Thread bearophileHUGS
John O'Hagan: li=['a', 'c', 'a', 'c', 'c', 'g', 'a', 'c'] for i  in range(len(li)):     if li[i:i + 2] == ['a', 'c']:         li[i:i + 2] = ['6'] Oh well, I have done a mistake, it seems. Another solution then: 'acaccgac'.replace(ac, chr(6)) '\x06\x06cg\x06' Bye, bearophile --

Re: Any idea to emulate tail -f

2009-05-05 Thread Paul Scott
On Mon, 2009-05-04 at 23:50 -0700, CTO wrote: You might want to try http://pyinotify.sourceforge.net/. Works well on Linux systems. Otherwise, I'd watch the mtime on the file and fork to handle the change. pyinotify works really well. If you need to watch a file, simply use the IN_MODIFY

Re: exit a program gracefully

2009-05-05 Thread Scott David Daniels
Lawrence D'Oliveiro wrote: It would be nice if Python offered a straightforward equivalent to ... do /*once*/ { ... do stuff ... if (check1_failed) break; ... do even more stuff ... } while (false); ... cleanup goes here ...

Re: change some lines from a read file

2009-05-05 Thread Anthra Norell
utab wrote: On May 4, 10:06 pm, Anthra Norell anthra.nor...@bluewin.ch wrote: utab wrote: Dear all, I have to change some lines from a template file, which is rather long to paste here, but I would like to make some parts of some lines optional with my command line arguments

Re: Open a dialog from MainWindow - pyQT4 - Beginner :-)

2009-05-05 Thread nickgaens
On May 4, 7:31 pm, Florian Wollenschein florian.wollensch...@fernuni- Hagen.de wrote: Dear folks, I'm just working on a pyQT4 version of my txt to html converter thc (see listick.org for details). I created the MainWindow with QT Designer and then converted it to .py with pyuic4. It works

Re: Problem with case insensitive volumes

2009-05-05 Thread Scott David Daniels
spillz wrote: os;walk will tell you the correct case for each node. So if it gives you a different case than the stored form, you have your answer. Thanks, although I was hoping that wouldn't be the answer (I have to compare a LOT of files). What is so tough about something like: base,

Re: object query assigned variable name?

2009-05-05 Thread Sion Arrowsmith
John O'Hagan resea...@johnohagan.com wrote: I can see that it's tantalizing, though, because _somebody_ must know about the assignment; after all, we just executed it! Except we haven't, if we're talking about reporting from the object's __init__: class Brian: ... def __init__(self): ...

Re: Code works fine except...

2009-05-05 Thread Ross
On May 5, 12:32 am, John Yeung gallium.arsen...@gmail.com wrote: On May 5, 1:12 am, John Yeung gallium.arsen...@gmail.com wrote: [...] the problem may require bigger guns (either much better math or much more sophisticated programming). Yes, I'm responding to myself. Well, I went ahead

Python-URL! - weekly Python news and links (May 5)

2009-05-05 Thread Gabriel Genellina
QOTW: ... [S]omebody's gotta put up some resistance to cute shortcuts, or we'll find ourselves back with Perl. - Peter Pearson http://groups.google.com/group/comp.lang.python/msg/2ce1b43e4d40528f How much memory occupies an object?

Re: for with decimal values?

2009-05-05 Thread Sion Arrowsmith
Gabriel Genellina gagsl-...@yahoo.com.ar wrote: En Sun, 03 May 2009 17:41:49 -0300, Zentrader zentrad...@gmail.com escribió: There is no need for a function or a generator. A for() loop is a unique case of a while loop ## for i in range(-10.5, 10.5, 0.1): ctr = -10.5 while ctr 10.5:

Re: Open a dialog from MainWindow - pyQT4 - Beginner :-)

2009-05-05 Thread Florian Wollenschein
nickga...@gmail.com wrote: On May 4, 7:31 pm, Florian Wollenschein florian.wollensch...@fernuni- Hagen.de wrote: Dear folks, I'm just working on a pyQT4 version of my txt to html converter thc (see listick.org for details). I created the MainWindow with QT Designer and then converted it to

call function of class instance with no assigned name?

2009-05-05 Thread George Oliver
hi, I'm a Python beginner with a basic question. I'm writing a game where I have keyboard input handling defined in one class, and command execution defined in another class. The keyboard handler class contains a dictionary that maps a key to a command string (like 'h': 'left') and the command

Re: Problem with case insensitive volumes

2009-05-05 Thread spillz
On May 5, 10:02 am, Scott David Daniels scott.dani...@acm.org wrote: What is so tough about something like: base, dirs, files = next(os.walk(dirn))  # older: os.walk(dirn).next() current = dict((name.upper() for name in dirs + files) ... changed = some_name == current[some_name.upper()] ...

Re: call function of class instance with no assigned name?

2009-05-05 Thread Chris Rebert
On Tue, May 5, 2009 at 8:52 AM, George Oliver georgeolive...@gmail.com wrote: hi, I'm a Python beginner with a basic question. I'm writing a game where I have keyboard input handling defined in one class, and command execution defined in another class. The keyboard handler class contains a

Re: problem in using sendmail in multi thread

2009-05-05 Thread Aahz
In article 343747e9-549f-4336-9b15-522411a78...@x1g2000prh.googlegroups.com, gganesh ganesh@gmail.com wrote: I'm a beginner in using Python script I'm trying to send mails using multi-thread You need a separate SMTP connection for each thread. -- Aahz (a...@pythoncraft.com) *

SQL and CSV

2009-05-05 Thread Nick
I have a requirement to read a CSV file. Normally, no problem, just import CSV and slurp the file up. However, in this case I want to filter out lines that have fields set to particular values. It would be neat to be able to do something like this. select * from test.csv where status Canceled

Re: SQL and CSV

2009-05-05 Thread Tim Golden
Nick wrote: I have a requirement to read a CSV file. Normally, no problem, just import CSV and slurp the file up. However, in this case I want to filter out lines that have fields set to particular values. It would be neat to be able to do something like this. select * from test.csv where

Re: list comprehension question

2009-05-05 Thread J Kenneth King
Emile van Sebille em...@fenx.com writes: On 5/1/2009 7:31 AM J Kenneth King said... Chris Rebert c...@rebertia.com writes: b = [] for pair in a: for item in pair: b.append(item) This is much more clear than a nested comprehension. I love comprehensions, but abusing them can

Re: call function of class instance with no assigned name?

2009-05-05 Thread Arnaud Delobelle
Chris Rebert c...@rebertia.com writes: On Tue, May 5, 2009 at 8:52 AM, George Oliver georgeolive...@gmail.com wrote: hi, I'm a Python beginner with a basic question. I'm writing a game where I have keyboard input handling defined in one class, and command execution defined in another class.

Re: Any idea to emulate tail -f

2009-05-05 Thread J Kenneth King
Iain King iaink...@gmail.com writes: On May 5, 7:00 am, Joel Juvenal Rivera Rivera joel...@gmail.com wrote: I want to make something very similar to  the command tail -f (follow a file), i have been trying  with some while True and some microsleeps (about .1 s); did someone has already done

Re: SQL and CSV

2009-05-05 Thread Nick
On May 5, 5:19 pm, Tim Golden m...@timgolden.me.uk wrote: Nick wrote: I have a requirement to read a CSV file. Normally, no problem, just import CSV and slurp the file up. However, in this case I want to filter out lines that have fields set to particular values. It would be neat to

Re: problem in using sendmail in multi thread

2009-05-05 Thread Piet van Oostrum
gganesh ganesh@gmail.com (g) wrote: g hi, g I'm a beginner in using Python script g I'm trying to send mails using multi-thread g I wrote g FROM = 'ganeshx...@.com' g # for more mail add';' the another mail id g listTo = ['g@gmail.com', 'xxjango...@gmail.com', g

Error in running python -v on Mac ox 10.5.

2009-05-05 Thread silverburgh
Hi, I run 'python -v' on Macos 10.5 but I get this error : # can't create /System/Library/Frameworks/Python.framework/Versions/ 2.5/lib/python2.5/encodings/utf_8.pyc Can you please tell me how to fix it? And why I am seeing a lot of 'install' message' when i run 'python - v'? I don't think I

thc v0.3 - txt to html converter - better code?

2009-05-05 Thread Florian Wollenschein
Hi all, here's some code of thc, my txt to html converter programmed with Python and pyQT4: --- if self.rdioBtnTransitional.isChecked(): if self.cmboBoxLang.currentText() == English:

Re: desperately looking for a howto on running my wxPython app on Vista

2009-05-05 Thread Paul Sijben
Mike Driscoll wrote: On Apr 29, 4:17 am, Paul Sijben paul.sij...@xs4all.nl wrote: Is there any way to check which is the offending pyd/dll? (normally Vista does not give out much data on what went wrong) Paul You might be able to find it using the Dependency Walker utility:

Re: list comprehension question

2009-05-05 Thread Emile van Sebille
On 5/5/2009 9:15 AM J Kenneth King said... List comprehensions can make a reader of your code apprehensive because it can read like a run-on sentence and thus be difficult to parse. The Python documentation discourages their use and I believe for good reason. Can you provide a link for this?

Re: for with decimal values?

2009-05-05 Thread J. Cliff Dyer
On Sun, 2009-05-03 at 19:48 -0700, alex23 wrote: On May 4, 11:41 am, Esmail ebo...@hotmail.com wrote: All this discussion makes me wonder if it would be a good idea for Python to have this feature (batteries included and all) - it would have its uses, no? Well, sometimes more discussion

Re: call function of class instance with no assigned name?

2009-05-05 Thread George Oliver
On May 5, 9:01 am, Chris Rebert c...@rebertia.com wrote: On Tue, May 5, 2009 at 8:52 AM, George Oliver georgeolive...@gmail.com wrote: I create instances of these classes in a list attached to a third, 'brain' class. You could exploit Python's dynamism by using the getattr() function:

Re: Code works fine except...

2009-05-05 Thread MRAB
Ross wrote: On May 5, 12:32 am, John Yeung gallium.arsen...@gmail.com wrote: On May 5, 1:12 am, John Yeung gallium.arsen...@gmail.com wrote: [...] the problem may require bigger guns (either much better math or much more sophisticated programming). Yes, I'm responding to myself. Well, I

Re: Is there is any way to send messages to chunk of emails ID's concurrently using smptlib

2009-05-05 Thread Minesh Patel
On Mon, May 4, 2009 at 2:01 PM, Piet van Oostrum p...@cs.uu.nl wrote: gganesh ganesh@gmail.com (g) wrote: g Hi friends, g I suppose sendmail() can send mails one by one ,how to send mails g concurrently , g It would be very grateful,if someone could point out a solution. You can always use

Re: Re: list comprehension question

2009-05-05 Thread J. Cliff Dyer
On Fri, 2009-05-01 at 13:00 -0400, John Posner wrote: Shane Geiger wrote: if type(el) == list or type(el) is tuple: A tiny improvement: if type(el) in (list, tuple): Another alternative, which might be useful in some cases: if hasattr(el, '__iter__'): This covers

help for documentation and license

2009-05-05 Thread Murali kumar
hi all.. I finished my application using python 2.6 and wxpython 2.8.9 I want to generate documentation for my application.. please suggest me and provide links to generate documents in easy way.. I want to host my product as open source.. I'dont know about licensing.. help me for

Re: list comprehension question

2009-05-05 Thread J. Cliff Dyer
On Tue, 2009-05-05 at 12:15 -0400, J Kenneth King wrote: Emile van Sebille em...@fenx.com writes: On 5/1/2009 7:31 AM J Kenneth King said... Chris Rebert c...@rebertia.com writes: b = [] for pair in a: for item in pair: b.append(item) This is much more clear than a

Re: SQL and CSV

2009-05-05 Thread Matimus
On May 5, 9:25 am, Nick nic...@gmail.com wrote: On May 5, 5:19 pm, Tim Golden m...@timgolden.me.uk wrote: Nick wrote: I have a requirement to read a CSV file. Normally, no problem, just import CSV and slurp the file up. However, in this case I want to filter out lines that have

Re: help for documentation and license

2009-05-05 Thread Gökhan SEVER
Hi, Even though I don't know what your project does, you will need to use Sphinx to create semi-automatic documentation out of your project. I would recommend you to take a look a quality free Python module: Matplotlib (http://matplotlib.sourceforge.net/index.html) Go ahead, and check out the

Re: help for documentation and license

2009-05-05 Thread CTO
On May 5, 2:30 pm, Gökhan SEVER gokhanse...@gmail.com wrote: Hi, Even though I don't know what your project does, you will need to use Sphinx to create semi-automatic documentation out of your project. I would recommend you to take a look a quality free Python module: Matplotlib

Re: thc v0.3 - txt to html converter - better code?

2009-05-05 Thread Stefan Behnel
Florian Wollenschein wrote: here's some code of thc, my txt to html converter programmed with Python and pyQT4: --- if self.rdioBtnTransitional.isChecked(): if self.cmboBoxLang.currentText() == English:

Re: call function of class instance with no assigned name?

2009-05-05 Thread Dave Angel
George Oliver wrote: hi, I'm a Python beginner with a basic question. I'm writing a game where I have keyboard input handling defined in one class, and command execution defined in another class. The keyboard handler class contains a dictionary that maps a key to a command string (like 'h':

Re: desperately looking for a howto on running my wxPython app on Vista

2009-05-05 Thread Mike Driscoll
On May 5, 11:43 am, Paul Sijben paul.sij...@xs4all.nl wrote: Mike Driscoll wrote: On Apr 29, 4:17 am, Paul Sijben paul.sij...@xs4all.nl wrote: Is there any way to check which is the offending pyd/dll?  (normally Vista does not give out much data on what went wrong) Paul You might be

Re: Self function

2009-05-05 Thread Paul Rubin
Steven D'Aprano ste...@remove.this.cybersource.com.au writes: def rvisit(node): print node if node and node.link is not None: rvisit(node.link) Less redundant (remember the extra recursion doesn't cost anything if the compiler is sane enough to turn it into a jump): def

Re: Which one is best Python or Java for developing GUI applications?

2009-05-05 Thread Pascal Chambon
Chris Rebert a écrit : On Tue, May 5, 2009 at 12:26 AM, Paul Rudin paul.nos...@rudin.co.uk wrote: Paul Rubin http://phr...@nospam.invalid writes: srinivasan srinivas sri_anna...@yahoo.co.in writes: Could you tell me does Python have any advantages over Java for the development

Numpy on python 2.7a

2009-05-05 Thread A. Cavallo
Hi, I'm trying to compile numpy using my own pet project based on the python svn code (that's the reason for the 2.7a tag). It is essentially a /opt python installation and it tailored for linux: its main goal is to be installed in parallel so it won't collide with a system installed python

Re: call function of class instance with no assigned name?

2009-05-05 Thread George Oliver
On May 5, 11:59 am, Dave Angel da...@ieee.org wrote: 1) forget about getattr() unless you have hundreds of methods in your map. The real question is why you need two maps. What good is the command string doing you? Why not just map the keyvalues directly into function objects? Thanks for

Re: SQL and CSV

2009-05-05 Thread Tim Golden
Nick wrote: Part of the problem is that the 'selection' needs to be in a config file. I can put the if row['status'] != 'Cancelled': return True into a config, read it and eval it, but its not quite as clean as an sql route. Still not clear what the restriction is. If you were writing SQL

Re: Way to use proxies login to site?

2009-05-05 Thread Kushal Kumaran
On Wed, Apr 29, 2009 at 8:21 AM, inVINCable invinceable...@gmail.com wrote: On Apr 27, 7:40 pm, inVINCable invinceable...@gmail.com wrote: Hello, I have been using ClientForm to log in to sites ClientCookie so I can automatically log into my site to do some penetration testing, although, I

Re: Self function

2009-05-05 Thread Steve Howell
On May 4, 11:08 pm, Steven D'Aprano ste...@remove.this.cybersource.com.au wrote: I propose a small piece of sugar. When a function is entered, Python creates an ordinary local name in the function's local namespace, and binds the function itself to that name. Two possibilities for the name

Re: Self function

2009-05-05 Thread Aaron Brady
On May 5, 2:50 pm, Steve Howell showel...@yahoo.com wrote: On May 4, 11:08 pm, Steven D'Aprano ste...@remove.this.cybersource.com.au wrote: I propose a small piece of sugar. When a function is entered, Python creates an ordinary local name in the function's local namespace, and binds the

Re: call function of class instance with no assigned name?

2009-05-05 Thread Aaron Brady
On May 5, 2:17 pm, George Oliver georgeolive...@gmail.com wrote: On May 5, 11:59 am, Dave Angel da...@ieee.org wrote: 1) forget about getattr() unless you have hundreds of methods in your map.  The real question is why you need two maps. What good is the command string doing you?   Why not

Re: Self function

2009-05-05 Thread Duncan Booth
Aaron Brady castiro...@gmail.com wrote: Here is how to get the function into the function as an argument, and still permit recursive calls onto it. def auto( f ): ... def _inner( *ar, **kw ): ... return f( g, *ar, **kw ) ... g= _inner ... return g ... @auto ...

Re: Code works fine except...

2009-05-05 Thread Ross
On May 5, 1:33 pm, MRAB goo...@mrabarnett.plus.com wrote: Ross wrote: On May 5, 12:32 am, John Yeung gallium.arsen...@gmail.com wrote: On May 5, 1:12 am, John Yeung gallium.arsen...@gmail.com wrote: [...] the problem may require bigger guns (either much better math or much more

Re: AutoComplete in C++ Editor for Python

2009-05-05 Thread justme
I the rope project http://rope.sourceforge.net/ has an autocomplete lib. (I have not used it just remember reading about it) -- http://mail.python.org/mailman/listinfo/python-list

Re: python docs for beginner programmer?

2009-05-05 Thread Deep_Feelings
that is good ,thank you anyone did that ? learning from python docs straight away ? -- http://mail.python.org/mailman/listinfo/python-list

  1   2   3   >