Re: Self function

2009-05-05 Thread Carl Banks
On May 4, 8:26 pm, Steven D'Aprano 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 binary tree with list-lik

Re: Self function

2009-05-05 Thread Arnaud Delobelle
On 5 May, 07:08, Steven D'Aprano 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 this problem as impor

Re: Self function

2009-05-05 Thread CTO
On May 5, 2:08 am, Steven D'Aprano 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 this problem as imp

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 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 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 and then selecting among

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

2009-05-05 Thread Bruno Desthuilliers
Arnaud Delobelle a écrit : Grant Rettke 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 the audience. I

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

2009-05-05 Thread Bruno Desthuilliers
Paul Rubin a écrit : srinivasan srinivas 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" 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 May

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

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

2009-05-05 Thread Paul Rudin
Paul Rubin writes: > srinivasan srinivas 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 convention :) -- http://mail.pyth

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'

Re: Self function

2009-05-05 Thread Carl Banks
On May 5, 12:51 am, Steven D'Aprano 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 > iteration. Or walking a binary tre

Re: Self function

2009-05-05 Thread wolfram . hinderer
On 5 Mai, 08:08, Steven D'Aprano 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 such > functions. When editing source

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

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

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 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 écrit : > srinivasan srinivas writes: >> C

Re: change some lines from a read file

2009-05-05 Thread utab
On May 4, 10:06 pm, Anthra Norell 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 > > directly,

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 wrote: > Paul Rubin writes: > >> srinivasan srinivas 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

Re: Any idea to emulate tail -f

2009-05-05 Thread Lawrence D'Oliveiro
In message , Joel Juvenal Rivera Rivera wrote: > I want to make something very similar to the command tail -f (follow a > file) ... -- http://mail.python.org/mailman/listinfo/python-list

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

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 replace2(da

Re: Any idea to emulate tail -f

2009-05-05 Thread Iain King
On May 5, 7:00 am, Joel Juvenal Rivera Rivera 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 file is the apac

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 NameEr

Re: find sublist inside list

2009-05-05 Thread mzdude
On May 4, 4:54 pm, "Gabriel Genellina" wrote: > En Mon, 04 May 2009 15:12:41 -0300, mzdude escribió: > > > substring isn't limited to 0..255 > substring = "\0x%d\0x%d" % (257,257) > 'acaccgac'.replace("ac", substring) > > '\x00x257\x00x257\x00x257\x00x257cg\x00x257\x00x257' > > This isn

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" 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. > > My mai

Re: exit a program gracefully

2009-05-05 Thread Lawrence D'Oliveiro
In message , 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*/ { ... do stuff ... if (check1_failed)

Re: exit a program gracefully

2009-05-05 Thread Cameron Simpson
On 05May2009 23:28, Lawrence D'Oliveiro wrote: | In message , 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

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 body

Re: Self function

2009-05-05 Thread Luis Zarrabeitia
On Tuesday 05 May 2009 02:46:58 am Chris Rebert wrote: > > 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 names, > for

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

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 t

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 "/usr/local/lib/python2.6/threading.p

Re: Self function

2009-05-05 Thread Arnaud Delobelle
On 5 May, 13:33, Luis Zarrabeitia wrote: > On Tuesday 05 May 2009 02:46:58 am Chris Rebert wrote: > > > > > 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

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 th

Re: Multiprocessing.Queue - I want to end.

2009-05-05 Thread Luis Alberto Zarrabeitia Gomez
Quoting Cameron Simpson : > | 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 proc

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 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 was emailed to me

Re: Question of UTF16BE encoding / decoding

2009-05-05 Thread Napalmski
In article , 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-encode, Thank you, much appreciated! -- http://m

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

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 ... What's

Re: change some lines from a read file

2009-05-05 Thread Anthra Norell
utab wrote: On May 4, 10:06 pm, Anthra Norell 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 di

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

2009-05-05 Thread nickgaens
On May 4, 7:31 pm, Florian Wollenschein 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 well so far. Then I created a new

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

Re: object query assigned variable name?

2009-05-05 Thread Sion Arrowsmith
John O'Hagan 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): ... print "I'm

Re: Code works fine except...

2009-05-05 Thread Ross
On May 5, 12:32 am, John Yeung wrote: > On May 5, 1:12 am, John Yeung 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, gener

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? http://groups.google.com/group/comp.lang.pytho

Re: for with decimal values?

2009-05-05 Thread Sion Arrowsmith
Gabriel Genellina wrote: >En Sun, 03 May 2009 17:41:49 -0300, Zentrader >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: >>print ctr >>ctr += 0.1 >

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 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 well so far. Th

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 hand

Re: Problem with case insensitive volumes

2009-05-05 Thread spillz
On May 5, 10:02 am, Scott David Daniels 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()] > ... not so fast.

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

Re: problem in using sendmail in multi thread

2009-05-05 Thread Aahz
In article <343747e9-549f-4336-9b15-522411a78...@x1g2000prh.googlegroups.com>, gganesh 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) <*> http://ww

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

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 stat

Re: list comprehension question

2009-05-05 Thread J Kenneth King
Emile van Sebille writes: > On 5/1/2009 7:31 AM J Kenneth King said... >> Chris Rebert 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 lead to r

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

2009-05-05 Thread Arnaud Delobelle
Chris Rebert writes: > On Tue, May 5, 2009 at 8:52 AM, 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 con

Re: Any idea to emulate tail -f

2009-05-05 Thread J Kenneth King
Iain King writes: > On May 5, 7:00 am, Joel Juvenal Rivera Rivera > 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? >> >> A

Re: SQL and CSV

2009-05-05 Thread Nick
On May 5, 5:19 pm, Tim Golden 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 be able t

Re: problem in using sendmail in multi thread

2009-05-05 Thread Piet van Oostrum
> gganesh (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> 'xx...@yahoo.co.in

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 se

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

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 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: > > http://www.dependen

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 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 == less co

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

2009-05-05 Thread George Oliver
On May 5, 9:01 am, Chris Rebert wrote: > On Tue, May 5, 2009 at 8:52 AM, George Oliver > 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: Thanks for the responses -- I shou

Re: Code works fine except...

2009-05-05 Thread MRAB
Ross wrote: On May 5, 12:32 am, John Yeung wrote: On May 5, 1:12 am, John Yeung 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, genera

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 wrote: >> gganesh (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 twisted which

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 co

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

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 writes: > > > On 5/1/2009 7:31 AM J Kenneth King said... > >> Chris Rebert writes: > >>> b = [] > >>> for pair in a: > >>> for item in pair: > >>> b.append(item) > >> > >> This is much more clear than a nest

Re: SQL and CSV

2009-05-05 Thread Matimus
On May 5, 9:25 am, Nick wrote: > On May 5, 5:19 pm, Tim Golden 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 part

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 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 (http://matplotlib.sou

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() == "Eng

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

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 wrote: > Mike Driscoll wrote: > > On Apr 29, 4:17 am, Paul Sijben 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 De

Re: Self function

2009-05-05 Thread Paul Rubin
Steven D'Aprano 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 rvisit(node): print node i

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 wrote: Paul Rubin writes: srinivasan srinivas writes: Could you tell me does Python have any advantages over Java for the development of GUI applications? Yes.

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

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

2009-05-05 Thread George Oliver
On May 5, 11:59 am, Dave Angel 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 the repl

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

Re: Way to use proxies & login to site?

2009-05-05 Thread Kushal Kumaran
On Wed, Apr 29, 2009 at 8:21 AM, inVINCable wrote: > On Apr 27, 7:40 pm, inVINCable 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 cannot figure out a solution to use p

Re: Self function

2009-05-05 Thread Steve Howell
On May 4, 11:08 pm, Steven D'Aprano 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 > are `this` or `__this__`, analogous

Re: Self function

2009-05-05 Thread Aaron Brady
On May 5, 2:50 pm, Steve Howell wrote: > On May 4, 11:08 pm, Steven D'Aprano > > 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 possibilitie

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

2009-05-05 Thread Aaron Brady
On May 5, 2:17 pm, George Oliver wrote: > On May 5, 11:59 am, Dave Angel 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 direc

Re: Self function

2009-05-05 Thread Duncan Booth
Aaron Brady 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 > ... def

Re: Code works fine except...

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

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

Re: Self function

2009-05-05 Thread bearophileHUGS
wolfram.hinde...: > It is easy to change all references of the function name, except for > those in the function body itself? That needs some explantation. I can answer this. If I have a recursive function, I may want to create a similar function, so I copy and paste it, to later modify the copied

Re: Self function

2009-05-05 Thread bearophileHUGS
Aaron Brady: > >>> def auto( f ): > > ...     def _inner( *ar, **kw ): > ...             return f( g, *ar, **kw ) > ...     g= _inner > ...     return g Looks nice, I'll try to the following variant to see if it's usable: def thisfunc(fun): """Decorator to inject a default name of a funct

Re: Error in running python -v on Mac ox 10.5.

2009-05-05 Thread Piet van Oostrum
> silverburgh (s) wrote: >s> Hi, >s> I run 'python -v' on Macos 10.5 but I get this error : >s> # can't create /System/Library/Frameworks/Python.framework/Versions/ >s> 2.5/lib/python2.5/encodings/utf_8.pyc >s> Can you please tell me how to fix it? This looks like the utf_8.py file has not

Re: Self function

2009-05-05 Thread Aaron Brady
On May 5, 3:54 pm, bearophileh...@lycos.com wrote: > Aaron Brady: > > > >>> def auto( f ): > > > ...     def _inner( *ar, **kw ): > > ...             return f( g, *ar, **kw ) > > ...     g= _inner > > ...     return g > > Looks nice, I'll try to the following variant to see if it's usable: > > def

Re: Numpy on python 2.7a

2009-05-05 Thread Robert Kern
On 2009-05-05 15:06, A. Cavallo wrote: 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). Ask on the numpy-discussion mailing list: http://www.scipy.org/Mailing_Lists -- Robert Kern "I have come to believe that the w

  1   2   >