Re: Strange interaction between timeit and recursion

2009-05-03 Thread Diez B. Roggisch
namekuseijin schrieb: Recursion is unpythonic. Do not use it. Since when? Says who? Lacking tail-recursion, it's not the choice for loops, but whatever algorithm is recursive can be written as such. Diez -- http://mail.python.org/mailman/listinfo/python-list

Re: Threaded alternatives to smtplib?

2009-05-03 Thread Diez B. Roggisch
Alex Jurkiewicz schrieb: Hi all, I'm writing a Python script to do a "mail merge" style email distribution. I create a few python threads and in each one I call `smtpserver = smtplib.SMTP(our.smtpserver.com)`. However, during the sending process, there seems to be only one connection open to o

Re: Self function

2009-05-03 Thread Chris Rebert
On Sun, May 3, 2009 at 11:29 PM, Arnaud Delobelle wrote: > bearophileh...@lycos.com writes: > >> Sometimes I rename recursive functions, or I duplicate&modify them, >> and they stop working because inside them there's one or more copy of >> their old name. >> This happens to me more than one time

Re: Self function

2009-05-03 Thread Arnaud Delobelle
bearophileh...@lycos.com writes: > Sometimes I rename recursive functions, or I duplicate&modify them, > and they stop working because inside them there's one or more copy of > their old name. > This happens to me more than one time every year. > So I have written this: > > from inspect import get

Re: yet another list comprehension question

2009-05-03 Thread namekuseijin
>>> ls = [(1,2), (3,4), (5, None), (6,7), (8, None)] >>> [(x,y) for (x,y) in ls if y] [(1, 2), (3, 4), (6, 7)] -- http://mail.python.org/mailman/listinfo/python-list

Re: Self function

2009-05-03 Thread Steve Howell
On May 3, 5:21 pm, Emile van Sebille wrote: > On 5/3/2009 3:39 PM bearophileh...@lycos.com said... > > > > > Sometimes I rename recursive functions, or I duplicate&modify them, > > and they stop working because inside them there's one or more copy of > > their old name. > > This happens to me more

Re: Strange interaction between timeit and recursion

2009-05-03 Thread Chris Rebert
On Sun, May 3, 2009 at 11:27 PM, namekuseijin wrote: > Recursion is unpythonic.  Do not use it. That's a tad extreme. I think the accepted practice is merely not to use recursion gratuitously. Cheers, Chris -- http://blog.rebertia.com -- http://mail.python.org/mailman/listinfo/python-list

Re: Strange interaction between timeit and recursion

2009-05-03 Thread namekuseijin
Recursion is unpythonic. Do not use it. -- http://mail.python.org/mailman/listinfo/python-list

Re: Using Help inside Python

2009-05-03 Thread namekuseijin
I'm from the time when I inspected python objects themselves, say: print obj.__doc__ or dir( obj ) to know the goodies... -- http://mail.python.org/mailman/listinfo/python-list

Threaded alternatives to smtplib?

2009-05-03 Thread Alex Jurkiewicz
Hi all, I'm writing a Python script to do a "mail merge" style email distribution. I create a few python threads and in each one I call `smtpserver = smtplib.SMTP(our.smtpserver.com)`. However, during the sending process, there seems to be only one connection open to our mail server at any one

Re: python docs for beginner programmer?

2009-05-03 Thread Napalmski
In article <87vdohk791@benfinney.id.au>, ben+pyt...@benfinney.id.au says... > > Deep_Feelings writes: > > > should i try them then after a month of reading i discover that they > > are - for example - not suitable for beginners OR should i ask here > > first ? :) > > You should take on the

Re: Multiprocessing.Queue - I want to end.

2009-05-03 Thread rylesny
> You may have to write the consumer loop by hand, rather than using > 'for'.  In the same-process case, you can do this. > > producer: > sentinel= object( ) > > consumer: > while True: >   item= queue.get( ) >   if item is sentinel: >     break >   etc. > > Then, each consumer is guaranteed to con

Re: smtplib send email by using gmail smtp server

2009-05-03 Thread tiefeng wu
> > I've tested with 3.0.1 on Windows XP and worked fine. Seems to be a problem > in the SSL support, but that's all I could say. > > -- > Gabriel Genellina > thanks, I'll check SSL support on my system Tiefeng Wu 2009-05-04 -- http://mail.python.org/mailman/listinfo/python-list

Re: Code works fine except...

2009-05-03 Thread John Yeung
On May 3, 11:29 pm, Chris Rebert wrote: > Probably not the cause of the problem, but where > did the magic numbers 1.072 and 1.08 come from? It is perhaps not the most direct cause of the problem, in the sense that the magic numbers could take various values and the problem would still be there.

Re: Multiprocessing.Queue - I want to end.

2009-05-03 Thread Luis Alberto Zarrabeitia Gomez
Quoting Dennis Lee Bieber : > I'm not familiar with the multiprocessing module and its queues but, > presuming it behaves similar to the threading module AND that you have > design control over the consumers (as you did in the sample) make a > minor change. > > queue.put(None) ONCE i

Re: Multiprocessing.Queue - I want to end.

2009-05-03 Thread Luis Alberto Zarrabeitia Gomez
Quoting Hendrik van Rooyen : > "Luis Zarrabeitia" wrote: > > 8< ---explanation and example of one producer, > 8< ---more consumers and one queue > > >As you can see, I'm sending one 'None' per consumer, and hoping that no > >consumer will read more than

Re: object query assigned variable name?

2009-05-03 Thread John O'Hagan
On Sat, 2 May 2009, John O'Hagan wrote: > On Fri, 1 May 2009, warpcat wrote: [...] > > Given an object: > > > > class Spam(object): > > def __init__(self): > > # stuff > > > > I'd like it to print, when instanced, something like this: > > >>> s = Spam() > > > > I’m assigned to s!

Re: Tkinter, Trouble with Message,Label widget

2009-05-03 Thread Ioannis Lalopoulos
I assume that you create the two windows through two different calls to Tkinter.Tk() but you cannot enter two mainloops (at least not in a normal way). If you want a second window use the Toplevel widget. Try the following, it does what you want: import Tkinter root = Tkinter.Tk() my_text = Tk

Re: Code works fine except...

2009-05-03 Thread John Yeung
On May 3, 10:36 pm, Ross wrote: > def round_robin(players, rounds): [snip] > > def test_round_robin(players, rounds, courts, doubles = False): >     players = range(players) >     for week in round_robin(players,rounds,courts): [snip] First things first: I take it the call to round_robin is on

Re: Code works fine except...

2009-05-03 Thread John Machin
On May 4, 12:36 pm, Ross wrote: > For the past couple weeks, I've been working on an algorithm to > schedule tennis leagues given court constraints and league > considerations (i.e. whether it's a singles or a doubles league). Here > were my requirements when I was designing this algorithm: > > -E

Re: Code works fine except...

2009-05-03 Thread Chris Rebert
On Sun, May 3, 2009 at 7:36 PM, Ross wrote: > For the past couple weeks, I've been working on an algorithm to > schedule tennis leagues given court constraints and league > considerations (i.e. whether it's a singles or a doubles league). Here > were my requirements when I was designing this algor

Re: for with decimal values?

2009-05-03 Thread alex23
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 consensus :) But it's really easy to roll your own: from deci

Code works fine except...

2009-05-03 Thread Ross
For the past couple weeks, I've been working on an algorithm to schedule tennis leagues given court constraints and league considerations (i.e. whether it's a singles or a doubles league). Here were my requirements when I was designing this algorithm: -Each player plays against a unique opponent e

Re: for with decimal values?

2009-05-03 Thread Ben Finney
Esmail writes: > 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? What feature are you referring to? Python already has fixed-point decimal values in the ‘decimal.Decimal’ type, if that's

Re: for with decimal values?

2009-05-03 Thread Esmail
Gabriel Genellina wrote: Isn't so easy. You have representation errors and rounding errors here, and they accumulate. The last number printed should be 10.4 but I get 10.5: ... 10.3 10.4 10.5 (or more precisely, 10.459) Also, after exiting a for loop, the *last* value used is reta

pythonic chew toyz (continued)

2009-05-03 Thread kirby.ur...@gmail.com
On Sun, May 3, 2009 at 5:52 PM, kirby wrote: > From: "kirby.ur...@gmail.com" > Date: Jan 14, 2:18 pm > Subject: pythonic chew toyz (a column, by K. Urner) v.1 n.1 > To: comp.lang.python > > > Selena spotted me right away as "the O'Reilly spy", me agreeing she > had an exceptionally good memory,

Re: How to walk up parent directories?

2009-05-03 Thread Ben Finney
Matthew Wilson writes: > Is there already a tool in the standard library to let me walk up from > a subdirectory to the top of my file system? Sounds like a pretty seldom-needed task, with an implementation simple using the existing standard library parts. > In other words, I'm looking for some

Re: python docs for beginner programmer?

2009-05-03 Thread Gökhan SEVER
Hey, I am a person who gets bored too quickly, too especially reading technical materials, and if the author(s) have the habit of wondering off the subject often. So far, I like Wesley Chun's Core Python book the most as a Python beginner like you. He also has video training material on the same s

Re: python docs for beginner programmer?

2009-05-03 Thread Ben Finney
Deep_Feelings writes: > should i try them then after a month of reading i discover that they > are - for example - not suitable for beginners OR should i ask here > first ? :) You should take on the task of educating yourself. The official Python docs are an excellent resource. If you're self-ad

How to walk up parent directories?

2009-05-03 Thread Matthew Wilson
Is there already a tool in the standard library to let me walk up from a subdirectory to the top of my file system? In other words, I'm looking for something like: >>> for x in walkup('/home/matt/projects'): ... print(x) /home/matt/projects /home/matt /home / I know I

Re: python docs for beginner programmer?

2009-05-03 Thread Deep_Feelings
On May 4, 3:44 am, Lawrence D'Oliveiro wrote: > In message > , > > Deep_Feelings wrote: > > Do you think python online docs are good starting point for me? > > Why not try them and see? thank you should i try them then after a month of reading i discover that they are - for example - not suitabl

Re: python docs for beginner programmer?

2009-05-03 Thread Lawrence D'Oliveiro
In message , Deep_Feelings wrote: > Do you think python online docs are good starting point for me? Why not try them and see? -- http://mail.python.org/mailman/listinfo/python-list

python docs for beginner programmer?

2009-05-03 Thread Deep_Feelings
Starting to learn python and because i don't want to read something twice (i get bored quickly) i need a source to learn python that is as comprehensive as possible. Do you think python online docs are good starting point for me? ( i experience with other programming languages ) or should i get g

Re: Doc strings in descriptors

2009-05-03 Thread Gabriel Genellina
En Sun, 03 May 2009 20:58:19 -0300, Дамјан Георгиевски escribió: I have a simple descriptor to create a cached property as shown below. ... The problem is that when I use the help() function on them, I don't get the doc string from the function that is being wrapped. ... What do I need to

Re: Self function

2009-05-03 Thread Emile van Sebille
On 5/3/2009 3:39 PM bearophileh...@lycos.com said... Sometimes I rename recursive functions, or I duplicate&modify them, and they stop working because inside them there's one or more copy of their old name. This happens to me more than one time every year. So I have written this: from inspect im

Re: for with decimal values?

2009-05-03 Thread Gabriel Genellina
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 Isn't so easy. You have representation errors

Re: Doc strings in descriptors

2009-05-03 Thread Дамјан Георгиевски
> I have a simple descriptor to create a cached property as shown below. ... > The problem is that when I use the help() function on them, I don't > get the doc string from the function that is being wrapped. ... > What do I need to do to get the doc string of the wrapped function to > apper when

Re: for with decimal values?

2009-05-03 Thread Steven D'Aprano
On Sun, 03 May 2009 13:41:49 -0700, Zentrader wrote: > 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 To match the semantics of range(), the f

Re: return functions

2009-05-03 Thread Дамјан Георгиевски
> You seem to have finally discovered that when using Apache/mod_wsgi, > Apache does a level of URL matching to filesystem based resources. didn't Paste include something like that ... > This isn't automatic in normal WSGI servers unless you use a WSGI > middleware that does the mapping for you.

Re: Using Help inside Python

2009-05-03 Thread Steven D'Aprano
On Sun, 03 May 2009 13:21:49 -0700, rose wrote: > Many Thanks to you Steven, for such a concise explanation of using the > help. May I request some examples to make it a bit more explicit. Suppose you want to get help about the max() function. Inside IDLE, at the command prompt, type: help(max)

Tkinter, Trouble with Message,Label widget

2009-05-03 Thread norseman
date can destroy old one and put up new one. ANY help is appreciated. Using: Python 2.5.2, Linux Slackware 10.2 Today: 20090503 Snippets: non functional, for clarifying only Steve -- http://mail.python.org/mailman/listinfo/python-list

Re: Using Help inside Python

2009-05-03 Thread Rhodri James
On Sun, 03 May 2009 21:21:49 +0100, rose wrote: On May 3, 8:15 pm, Steven D'Aprano wrote: On Sun, 03 May 2009 07:49:49 -0700, rose wrote: > Hi, >             I have an idea of the basics of programming language in > general. How to access help in python i.e. help followed by something or >

Self function

2009-05-03 Thread bearophileHUGS
Sometimes I rename recursive functions, or I duplicate&modify them, and they stop working because inside them there's one or more copy of their old name. This happens to me more than one time every year. So I have written this: from inspect import getframeinfo, currentframe def SOMEVERYUGLYNAME(n

Re: Is it better to use threads or fork in the following case

2009-05-03 Thread Martin P. Hellwig
grocery_stocker wrote: Let's say there is a new zip file with updated information every 30 minutes on a remote website. Now, I wanna connect to this website every 30 minutes, download the file, extract the information, and then have the program search the file search for certain items. Would it

Re: Is it better to use threads or fork in the following case

2009-05-03 Thread CTO
> In addition, the zip file format stores the directory at the end of the   > file. So you can't process it until it's completely downloaded.   > Concurrency doesn't help here. Don't think that's relevant, if I'm understanding the OP correctly. Lets say you've downloaded the file once and you're d

Re: Is it better to use threads or fork in the following case

2009-05-03 Thread Gabriel Genellina
En Sun, 03 May 2009 17:45:36 -0300, Paul Hankin escribió: On May 3, 10:29 pm, grocery_stocker wrote: On May 3, 1:16 pm, "Diez B. Roggisch" wrote: > grocery_stocker schrieb: > > Would it be better to use threads to break this up? I have one thread > > download the data and then have anothe

Re: Is it better to use threads or fork in the following case

2009-05-03 Thread grocery_stocker
On May 3, 1:40 pm, "Diez B. Roggisch" wrote: > grocery_stocker schrieb: > > > > > On May 3, 1:16 pm, "Diez B. Roggisch" wrote: > >> grocery_stocker schrieb: > > >>> Let's say there is a new zip file with updated information every 30 > >>> minutes on a remote website. Now, I wanna connect to this

Re: for with decimal values?

2009-05-03 Thread MRAB
Zentrader wrote: 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 Python stores floats in binary, and 0.1 can't be held exactly as a fractional binary numb

Re: Is it better to use threads or fork in the following case

2009-05-03 Thread Paul Hankin
On May 3, 10:29 pm, grocery_stocker wrote: > On May 3, 1:16 pm, "Diez B. Roggisch" wrote: > > > grocery_stocker schrieb: > > > > Let's say there is a new zip file with updated information every 30 > > > minutes on a remote website. Now, I wanna connect to this website > > > every 30 minutes, down

Re: Is it better to use threads or fork in the following case

2009-05-03 Thread CTO
Probably better just to check HEAD and see if its updated within the time you're looking at before any unpack. Even on a 56k that's going to be pretty fast, and you don't risk unpacking an old file while a new version is on the way. If you still want to be able to unpack the old file if there's an

Re: for with decimal values?

2009-05-03 Thread Zentrader
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 -- http://mail.python.org/mailman/listinfo/python-list

Re: Is it better to use threads or fork in the following case

2009-05-03 Thread Diez B. Roggisch
grocery_stocker schrieb: On May 3, 1:16 pm, "Diez B. Roggisch" wrote: grocery_stocker schrieb: Let's say there is a new zip file with updated information every 30 minutes on a remote website. Now, I wanna connect to this website every 30 minutes, download the file, extract the information, an

Re: Is it better to use threads or fork in the following case

2009-05-03 Thread grocery_stocker
On May 3, 1:16 pm, "Diez B. Roggisch" wrote: > grocery_stocker schrieb: > > > Let's say there is a new zip file with updated information every 30 > > minutes on a remote website. Now, I wanna connect to this website > > every 30 minutes, download the file, extract the information, and then > > hav

Re: Using Help inside Python

2009-05-03 Thread rose
On May 3, 8:15 pm, Steven D'Aprano wrote: > On Sun, 03 May 2009 07:49:49 -0700, rose wrote: > > Hi, > >             I have an idea of the basics of programming language in > > general. How to access help in python i.e. help followed by something or > > to get to know about some inbuilt module or m

Re: Is it better to use threads or fork in the following case

2009-05-03 Thread Diez B. Roggisch
grocery_stocker schrieb: Let's say there is a new zip file with updated information every 30 minutes on a remote website. Now, I wanna connect to this website every 30 minutes, download the file, extract the information, and then have the program search the file search for certain items. Would i

Is it better to use threads or fork in the following case

2009-05-03 Thread grocery_stocker
Let's say there is a new zip file with updated information every 30 minutes on a remote website. Now, I wanna connect to this website every 30 minutes, download the file, extract the information, and then have the program search the file search for certain items. Would it be better to use threads

Re: AutoComplete in C++ Editor for Python

2009-05-03 Thread Dave Angel
flam...@gmail.com wrote: Hello, I am embedding python support in my C++ application and was looking at adding "Intellisense" or "AutoComplete" support. I found a way to do it using the "dir" function, but this creates a problem. Here's why. Let's say I have the following code in my editor: impo

Re: smtplib send email by using gmail smtp server

2009-05-03 Thread Gabriel Genellina
En Sun, 03 May 2009 12:18:33 -0300, tiefeng wu escribió: I'm tring send email using smtp.gmail.com here's the code: *s = SMTP('**smtp.gmail.com* *', 25) s.set_debuglevel(1)* *s.ehlo() s.starttls() s.ehlo() s.login(mygmailaccount, mygmailpassword) s.sendmail(from_addr

Re: File handling problem.

2009-05-03 Thread SUBHABRATA BANERJEE
Dear Sir, Thanx for your prompt reply, I would be trying to work on your suggestion and get back to you as soon as possible. Best Regards, Subhabrata. On Sun, May 3, 2009 at 10:47 PM, Chris Rebert wrote: > On Sun, May 3, 2009 at 9:51 AM, SUBHABRATA BANERJEE > wrote: > > Dear Group, > > > > > >

Re: How to measure the memory cost in Python?

2009-05-03 Thread CTO
Alright, it's pretty obvious that I have a lot to learn before I'll be able to intelligently address this problem, but if somebody could point me at something that would help me figure out the terminology at least I'd really appreciate it. From what you're saying, it sounds like a combination of th

Re: File handling problem.

2009-05-03 Thread Chris Rebert
On Sun, May 3, 2009 at 9:51 AM, SUBHABRATA BANERJEE wrote: > Dear Group, > > > > I am working on a code like the following: > > > > from decimal import* > > #SAMPLE TEST PROGRAM FOR FILE > > def sample_file_test(n): > >     #FILE FOR STORING PROBABILITY VALUES > >     open_file=open("/python26/New

Reg: MFC71.DLL

2009-05-03 Thread koranthala
Hi, I had written a python 2.4 program. When I made it to an executable with py2exe, it told that the mfc71.dll is not added - so I may have to ship it separately. It also showed many other dll's which are all in windows/system32 - which again it said is not added. Now, I have two questions -

Re: How to measure the memory cost in Python?

2009-05-03 Thread Aahz
In article <7744f434-dd43-4010-ba25-90096f59d...@n7g2000prc.googlegroups.com>, CTO wrote: > >I will admit, I have *no idea* what that code is doing, but in looking >through the gc module documentation, I'm seeing the gc.get_objects >function. Would it be equivalent to what the OP is asking to tra

Re: File handling problem.

2009-05-03 Thread SUBHABRATA BANERJEE
Dear Group, I am working on a code like the following: from decimal import* #SAMPLE TEST PROGRAM FOR FILE def sample_file_test(n): #FILE FOR STORING PROBABILITY VALUES open_file=open("/python26/Newfile1.txt","r+") #OPENING OF ENGLISH CORPUS open_corp_eng=open("/python26/

Re: stuck with PyOBEX

2009-05-03 Thread David Boddie
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 mails to you keep getting returned, so I've put it here: http://www.boddie.org.uk/david/Projects/Python/PyOBEX/Software/PyOBEX-0.21.zip Please let me know if it wo

Re: Strange interaction between timeit and recursion

2009-05-03 Thread Diez B. Roggisch
Steven D'Aprano schrieb: I'm seeing a strange interaction between timeit and recursion. sys.getrecursionlimit() 1000 from timeit import Timer setup = """def test(n=1): ... if n < 999: return test(n+1) ... return None ... """ exec setup test() is None True Timer('test()', setup).r

Re: Using Help inside Python

2009-05-03 Thread Steven D'Aprano
On Sun, 03 May 2009 07:49:49 -0700, rose wrote: > Hi, > I have an idea of the basics of programming language in > general. How to access help in python i.e. help followed by something or > to get to know about some inbuilt module or method etc. how do I access > help from within the ID

smtplib send email by using gmail smtp server

2009-05-03 Thread tiefeng wu
Hi all I'm tring send email using smtp.gmail.com here's the code: *s = SMTP('**smtp.gmail.com* *', 25) s.set_debuglevel(1)* *s.ehlo() s.starttls() s.ehlo() s.login(mygmailaccount, mygmailpassword) s.sendmail(from_addr, to_addr_list, message) s.close()* I got the followin

Re: problem with money datatype based calculations in python

2009-05-03 Thread Krishnakant
On Sun, 2009-05-03 at 03:20 +, D'Arcy J.M. Cain wrote: > Sorry, I should have mentioned my bias. :-) > No problems at all. It is a very good library. I get an impression that it > is realy a mature module and a very powerful set of API. > > I would like to know if it has been tested with

Using Help inside Python

2009-05-03 Thread rose
Hi, I have an idea of the basics of programming language in general. How to access help in python i.e. help followed by something or to get to know about some inbuilt module or method etc. how do I access help from within the IDLE using the help command. Thank You. -- http://mail.pytho

Strange interaction between timeit and recursion

2009-05-03 Thread Steven D'Aprano
I'm seeing a strange interaction between timeit and recursion. >>> sys.getrecursionlimit() 1000 >>> from timeit import Timer >>> setup = """def test(n=1): ... if n < 999: return test(n+1) ... return None ... """ >>> exec setup >>> test() is None True >>> >>> Timer('test()', setup).repeat(

Re: Use of Unicode in Python 2.5 source code literals

2009-05-03 Thread Uncle Bruce
On May 3, 7:37 am, Matt Nordhoff wrote: > Uncle Bruce wrote: > -- I think I've figured it out! What I was trying to do was to enter the literal strings directly into the IDLE interpreter. The IDLE interpreter will not accept high codepoints directly. However, when I put a defined function in

Re: Need Help with str.replace & tuples

2009-05-03 Thread mikefromvt
On May 2, 6:22 pm, bearophileh...@lycos.com wrote: > mikefromvt:> I am very very unfamiliar with Python and need to update a Python > > script.  What I need to do is to replace three variables (already > > defined in the script) within a string.  The present script correctly > > replaces two of the

AutoComplete in C++ Editor for Python

2009-05-03 Thread flamz3d
Hello, I am embedding python support in my C++ application and was looking at adding "Intellisense" or "AutoComplete" support. I found a way to do it using the "dir" function, but this creates a problem. Here's why. Let's say I have the following code in my editor: import sys x = sys Now, I wou

ANN: pyscite

2009-05-03 Thread Runar Tenfjord
ANN: pyscite released Download it from: http://code.google.com/p/pyscite/ What is pyscite? Pyscite is a python module for accessing the SciTE editors Director Interface on windows. Example are included with code to integrate the aspell spell checker engine with SciTE. -- http://mail.python.or

Re: Use of Unicode in Python 2.5 source code literals

2009-05-03 Thread Matt Nordhoff
Uncle Bruce wrote: > I'm working with Python 2.5.4 and the NLTK (Natural Language > Toolkit). I'm an experienced programmer, but new to Python. > > This question arose when I tried to create a literal in my source code > for a Unicode codepoint greater than 255. (I also posted this > question in

Re: Use of Unicode in Python 2.5 source code literals

2009-05-03 Thread Steven D'Aprano
On Sun, 03 May 2009 03:43:27 -0700, Uncle Bruce wrote: > Based on some experimenting I've done, I suspect that the support for > Unicode literals in ANY encoding isn't really accurate. What seems to > happen is that there must be an 8-bit mapping between the set of Unicode > literals and what can

Use of Unicode in Python 2.5 source code literals

2009-05-03 Thread Uncle Bruce
I'm working with Python 2.5.4 and the NLTK (Natural Language Toolkit). I'm an experienced programmer, but new to Python. This question arose when I tried to create a literal in my source code for a Unicode codepoint greater than 255. (I also posted this question in the NLTK discussion group). T

Re: stuck with PyOBEX

2009-05-03 Thread alejandro
Yes! > I haven't tried to run it under Windows. I just assumed that > BluetoothSocket > would have the same API on both Linux and Windows. > > Looking around, it seems that this is something we can work around: > > http://svn.navi.cx/misc/trunk/laserprop/client/BluetoothConduit.py > > I'll send y

Re: eric not working on ubuntu 9.04

2009-05-03 Thread Peter Otten
bvidinli wrote: > any idea ? It works on my Kubuntu 9.04, but I can provoke a similar error with $ export PYTHONPATH=`pwd` $ touch email.py $ eric As a first step I recommend that you make sure that eric doesn't accidentally import modules written by you. Peter -- http://mail.python.org/mai

Re: eric not working on ubuntu 9.04

2009-05-03 Thread CTO
>   File "/usr/lib/python2.6/email/message.py", line 790, in Message >     from email.Iterators import walk Well, the module is called email.iterators (rather than email.Iterators), for starters. It looks like __all__ exports both names (which seems a little dodgy to me, but hey, y'all are the exp

Re: for with decimal values?

2009-05-03 Thread dusans
>>> import numpy as np >>> for i in np.arange(-10.5, 10.5, 0.1): ... print i ... -10.5 -10.4 -10.3 -10.2 -- http://mail.python.org/mailman/listinfo/python-list

Re: Doc strings in descriptors

2009-05-03 Thread Steven D'Aprano
On Sat, 02 May 2009 23:36:26 -0500, Kevin D. Smith wrote: > I have a simple descriptor to create a cached property as shown below. ... > What do I need to do to get the doc string of the wrapped function to > apper when using help()? Call it on the class, not the instance: >>> class Test(object

Re: for with decimal values?

2009-05-03 Thread Steven D'Aprano
On Sat, 02 May 2009 11:01:39 -0700, bearophileHUGS wrote: > Esmail: >> Is there a Python construct to allow me to do something like this: >>     for i in range(-10.5, 10.5, 0.1): > > Sometimes I use an improved version of this: > http://code.activestate.com/recipes/66472/ Care to contribute you

Re: writing consecutive data to subprocess command 'more'

2009-05-03 Thread SanPy
Hmm, it works as long as the pager command is available on the system. I created a test file to explain what I mean. You can find it here: http://gist.github.com/105880 The 'pager' command is on purpose a command that is not available on the system. It should fall back to sys.stdout in the write m

Re: yet another list comprehension question

2009-05-03 Thread ma
This isn't list comprehension, but it's something to keep in mind: b = filter(lambda x: None not in x, input_list) On Sat, May 2, 2009 at 10:25 PM, CTO wrote: > On May 2, 10:13 pm, Ross wrote: > > I'm trying to set up a simple filter using a list comprehension. If I > > have a list of tuples,