Re: Help Documenting Python Syntax

2010-11-10 Thread Lawrence D'Oliveiro
In message , Grant Edwards wrote: > My question is why bother with 2.5? In mitigation, your honour, let me plead that the latest Debian Stable still ships with that version. -- http://mail.python.org/mailman/listinfo/python-list

Re: Help Documenting Python Syntax

2010-11-10 Thread RJB
On Nov 9, 8:14 am, Grant Edwards wrote: > On 2010-11-09, Terry Reedy wrote: > > > On 11/9/2010 10:26 AM, RJB wrote: > >> I have been trying to redevelop a syntax page for Python at > >>      http://cse.csusb.edu/dick/samples/python.syntax.html > > > Page does not load correctly; had to hit refres

Re: How to test if a module exists?

2010-11-10 Thread Mark Wooding
r0g writes: > You use your main address on USENET rather than a junk one!? Obfuscated or > not that's either brave or foolhardy! I use my real email address. I also have an aggressive spam filter. But I don't think that much of my comes from Usenet harvesters any more, to be honest. -- [mdw] -

Re: DTD Parsing

2010-11-10 Thread r0g
On 10/11/10 07:36, Ian Kelly wrote: On 11/9/2010 11:14 PM, r0g wrote: Me too when possible, TBH if I only needed strings and there was no pressing security issue I'd just do this... config = {} for line in (open("config.txt", 'r')): if len(line) > 0 and line[0] <> "#": param, value = line.rstri

Re: Am I The Only One Who Keeps Reading ?Numpy? as ?Numpty??

2010-11-10 Thread Mark Wooding
Lou Pecora writes: > Bigger question: How do you pronouce it? Rhymes with `grumpy'. -- [mdw] -- http://mail.python.org/mailman/listinfo/python-list

subprocess.Popen deadlocks

2010-11-10 Thread eraserix
Hi >From time to time I observe a deadlock in subprocess.Popen. I see the childprocess beeing and if I attach gdb to the stuck python script, I can see it waiting on line 1128 in subprocess.py ( data = _eintr_retry_call(os.read, errpipe_read, 1048576) ). Any ideas of whats going on? I'm on linux

Re: How to test if a module exists?

2010-11-10 Thread r0g
On 10/11/10 09:50, Lawrence D'Oliveiro wrote: In message, Jon Dufresne wrote: On Mon, Nov 8, 2010 at 11:35 PM, Lawrence D'Oliveiro ... I see that you published my unobfuscated e-mail address on USENET for all to see. I obfuscated it for a reason, to keep the spammers away. I'm assuming this w

Re: subclassing str

2010-11-10 Thread Mark Wooding
Lawrence D'Oliveiro writes: > In message <87lj52kwln.fsf@metalzone.distorted.org.uk>, Mark Wooding > wrote: > > > One option is to implement a subclass which implements the additional > > protocol. > > This is why I think object orientation ruins your ability to think > properly. For “proto

Re: multiple discontinued ranges

2010-11-10 Thread Paul Rubin
xoff writes: > I was wondering what the best method was in Python programming for 2 > discontinued ranges. e.g. I want to use the range 3 to 7 and 17 to 23. you could use itertools.chain: from itertools import chain for i in chain(range(3,7), range(17,23)): ... I'm assuming you're usi

Re: subclassing str

2010-11-10 Thread Lawrence D'Oliveiro
In message <87lj52kwln.fsf@metalzone.distorted.org.uk>, Mark Wooding wrote: > One option is to implement a subclass which implements the additional > protocol. This is why I think object orientation ruins your ability to think properly. For “protocol” read “function”. If you want to impleme

How to convert the date object 2010-11-10 14:52:35.026000 to integer?

2010-11-10 Thread Zeynel
mDATE = "2010-11-10 14:52:35.026000" (Not sure if this is string or something else.) I would like to convert mDATE to integer to add, multiply etc. For instance, if I try to convert mDATE to seconds td = mDATE.seconds I get the error td = result.mDATE.seconds AttributeError: 'datetime.dat

[OT] Usenet and email address exposure (was: How to test if a module exists?)

2010-11-10 Thread Ben Finney
r0g writes: > You use your main address on USENET rather than a junk one!? Yes. The amount of time spent keeping my spam filter well-trained is far smaller than the amount I'd lose faffing around with countless throwaway email addresses. I have to expose my address on the internet anyway for it

Re: Deditor 0.2.2

2010-11-10 Thread Kruptein
On Nov 10, 12:49 pm, TheSeeker wrote: > On Nov 9, 10:04 am, Kruptein wrote: > > > > > > > On Nov 8, 3:01 pm, Jean-Michel Pichavant > > wrote: > > > > TheSeeker wrote: > > > > On Nov 6, 7:06 am, Kruptein wrote: > > > > >> Hey, > > > > >> I released version 0.2.2 of my pythonic text-editor  Dedit

Re: How to convert the date object 2010-11-10 14:52:35.026000 to integer?

2010-11-10 Thread rantingrick
On Nov 10, 9:40 am, Zeynel wrote: > mDATE = "2010-11-10 14:52:35.026000" > > (Not sure if this is string or something else.) > > I would like to convert mDATE to integer to add, multiply etc. > > For instance, if I try to convert mDATE to seconds > > td = mDATE.seconds > > I get the error > >    

Re: DTD Parsing

2010-11-10 Thread Asun Friere
On Nov 10, 6:36 pm, Ian Kelly wrote: > That's five whole lines of code.  Why go to all that trouble when you > can just do this: > > import config > > I kid, but only partially.   For myself, generally because I only become aware of the module, or the module is only written after I written some

Re: Commercial or Famous Applicattions.?

2010-11-10 Thread Martin Gregorie
On Wed, 10 Nov 2010 13:59:02 +, Nobody wrote: > On Wed, 10 Nov 2010 13:07:58 +, Martin Gregorie wrote: > >> FWIW the thing that really irritated me about fetchmail is the way it >> only deletes messages at the end of a session and never cleans up after >> itself. If a session gets timed o

Re: How to read the Python tutorial?

2010-11-10 Thread Zeynel
On Nov 10, 10:51 am, rantingrick wrote: > Wait a minute i am confused...? Does Python have a "text" object that > magically turns into a datetime object? > > >>> mDATE = 2010-11-10 14:35:22.863000 > > SyntaxError: invalid syntax This is the reason I am asking the question. I am confused about wh

Development Vs Release

2010-11-10 Thread Sven
Hi, When developing tools I often also work on a module that I need to import into that tool. Once the work is complete both (or more) files go to a release location on the network. The question I have is: what is the easiest way to adjust the import path depending on whether it's a release

Re: multiple discontinued ranges

2010-11-10 Thread Peter Otten
xoff wrote: > I was wondering what the best method was in Python programming for 2 > discontinued ranges. e.g. I want to use the range 3 to 7 and 17 to 23. > Am I obliged to use 2 for loops defining the 2 ranges like this: > > for i in range (3,7): > do bla > for i in range (7,17): > do bla >

Re: multiple discontinued ranges

2010-11-10 Thread xoff
On 10 nov, 18:13, Paul Rudin wrote: > xoff writes: > > I was wondering what the best method was in Python programming for 2 > > discontinued ranges. e.g. I want to use the range 3 to 7 and 17 to 23. > > Am I obliged to use 2 for loops defining the 2 ranges like this: > > > for i in range (3,7): >

Re: multiple discontinued ranges

2010-11-10 Thread xoff
On 10 nov, 18:15, Paul Rubin wrote: > you could use itertools.chain: > >   from itertools import chain > >   for i in chain(range(3,7), range(17,23)): >     ... > > I'm assuming you're using python 3.  In python 2 each of those ranges > expands immediately to a list, so on the one hand they're con

Curses Programming

2010-11-10 Thread alexander
Hi, all Here is the test. Plz help. / ***/ If you use the new image search of Google, you will find that the result images are layouted

Re: Class extension confusion :(

2010-11-10 Thread Peter Otten
r0g wrote: > I have a subclass of BaseHHTPRequestHandler which uses a dictonary > "paths" and a function "api_call" which are defined in the main > namespace of the module. I'd rather I was able to pass these object to > the constructor and store them as data attributes "self.paths" and > "self.ap

Re: How to test if a module exists?

2010-11-10 Thread Lawrence D'Oliveiro
In message , Jon Dufresne wrote: > On Mon, Nov 8, 2010 at 11:35 PM, Lawrence D'Oliveiro ... I see that you published my unobfuscated e-mail address on USENET for all to see. I obfuscated it for a reason, to keep the spammers away. I'm assuming this was a momentary lapse of judgement, for which I

Re: Am I The Only One Who Keeps Reading “Numpy” as “Numpty”?

2010-11-10 Thread rantingrick
On Nov 10, 12:53 am, Lawrence D'Oliveiro wrote: > Sorry... Was humpty dumpty your favorite nursery rhyme? And it's "Num-pee" for me. If the "py" is appended i use "x-pee" and if it is pre i use "pie- x". -- http://mail.python.org/mailman/listinfo/python-list

Re: Commercial or Famous Applicattions.?

2010-11-10 Thread Nobody
On Wed, 10 Nov 2010 13:07:58 +, Martin Gregorie wrote: > FWIW the thing that really irritated me about fetchmail is the way it > only deletes messages at the end of a session and never cleans up after > itself. If a session gets timed out or otherwise interrupted the messages > that were re

Big opportunity.

2010-11-10 Thread gaurav
Complete resource for free or paid Work at home jobs online/offline. http://rojgars1.webs.com/gov.htmhttp://rojgars.webs.com/bankingjobs.htm Get start earning at your Management work. Great career in Management Visit: http://managementjobs.webs.com/pm.htm & http://topcareer.webs.com/humanreso

Re: multiple discontinued ranges

2010-11-10 Thread Nobody
On Wed, 10 Nov 2010 09:34:14 -0800, xoff wrote: > I am curious, why wouldn't you advise something like this: > for i in chain(range(3,7) + range(17,23)): Because it constructs all three lists (both of the individual ranges and their concatenation) in memory. For a trivial example, that isn't a pr

Re: How to read the Python tutorial?

2010-11-10 Thread rantingrick
On Nov 10, 9:13 am, Zeynel wrote: > For instance, when the tutorial > hashttp://docs.python.org/release/2.6/library/datetime.html > > class datetime.datetime > A combination of a date and a time. Attributes: year, month, day, > hour, minute, second, microsecond, and tzinfo. > > What does this mea

Re: Silly newbie question - Caret character (^)

2010-11-10 Thread Terry Reedy
On 11/9/2010 7:13 PM, Seebs wrote: On 2010-11-09, Terry Reedy wrote: I've been wondering why C programmers keep writing code susceptible to buffer overruns ;=). Because we're dumb! (Actually, in my defense, my code almost never, if ever, has buffer overruns. I do in some rare cases have tru

Re: A way to get setup.py to create links instead of copy

2010-11-10 Thread Geoff Bache
On Nov 9, 6:33 pm, Steve Holden wrote: > On 11/9/2010 4:18 AM, Geoff Bache wrote: > > > Hi all, > > > One of the things I've always loved about Python (having come from > > compiled languages) was the lack of an extra step between changing my > > code and running it. > > > On my current project, h

Re: How to test if a module exists?

2010-11-10 Thread Martin Gregorie
On Wed, 10 Nov 2010 12:04:01 +, Mark Wooding wrote: > Lawrence D'Oliveiro writes: > >> I see that you published my unobfuscated e-mail address on USENET for >> all to see. I obfuscated it for a reason, to keep the spammers away. >> I'm assuming this was a momentary lapse of judgement, for wh

Re: Am I The Only One Who Keeps Reading ?Numpy? as ?Numpty??

2010-11-10 Thread Lou Pecora
In article <2010111007444115344-nom...@thisaddresscom>, Sven wrote: > On 2010-11-10 01:53:58 -0500, Lawrence D'Oliveiro said: > > > Sorry... > > no. Yes, except for one other, above. :-) Bigger question: How do you pronouce it? Some say "num pee". Not the greatest image to English spea

Re: DTD Parsing

2010-11-10 Thread Asun Friere
On Nov 10, 5:00 pm, Stefan Behnel wrote: > Give lxml.objectify a try. It doesn't use DTDs, but does what you want. Yes I should take the time to familiarise myself with the lxml API in general. I mostly use libxml2 and libxslt nowadays. For simple stuff (like this) I use a StateParser which is

Real profiles and real moms are alone

2010-11-10 Thread preyanthes...@ymail.com
Real profiles and real moms are alone http://urlrunt.me?c92 -- http://mail.python.org/mailman/listinfo/python-list

Re: multiple discontinued ranges

2010-11-10 Thread Mel
xoff wrote: > I was wondering what the best method was in Python programming for 2 > discontinued ranges. e.g. I want to use the range 3 to 7 and 17 to 23. > Am I obliged to use 2 for loops defining the 2 ranges like this: > > for i in range (3,7): > do bla > for i in range (7,17): > do bla >

Feed subscription IM bot

2010-11-10 Thread alexander
Hi, Can anyone help on this? / / The project should either be hosted online and usable from there, or can be run locally. Complete ource code should be delivered along with

Re: Learning Pyhton - Functional Programming - How intersect/difference two dict with dict/values? fast!

2010-11-10 Thread Lawrence D'Oliveiro
In message , Terry Reedy wrote: > To echo John Nagle's point, if you want non-masochist volunteers to read > your code, write something readable like: > > dict1 = {'ab': [[1,2,3,'d3','d4',5], 12], > 'ac': [[1,3,'78a','79b'], 54], > 'ad': [[56,57,58,59], 34], > 'ax':

Re: Am I The Only One Who Keeps Reading ?Numpy? as ?Numpty??

2010-11-10 Thread Sven
On 2010-11-10 01:53:58 -0500, Lawrence D'Oliveiro said: Sorry... no. -- ./Sven -- http://mail.python.org/mailman/listinfo/python-list

Re: Am I The Only One Who Keeps Reading ?Numpy? as ?Numpty??

2010-11-10 Thread Grant Edwards
On 2010-11-10, Mark Wooding wrote: > Lou Pecora writes: >> Bigger question: How do you pronouce it? > > Rhymes with `grumpy'. Num-Pie -- Grant Edwards grant.b.edwardsYow! Boys, you have ALL at been selected to LEAVE th'

Re: Allowing comments after the line continuation backslash

2010-11-10 Thread Mark Wooding
Lawrence D'Oliveiro writes: > In message <878w12kt5x.fsf@metalzone.distorted.org.uk>, Mark Wooding > wrote: > > 2. The MainWindow class only has the `Window' attribute described in > > its definition. Apparently there are other attributes as well (the > > ColorMumbleList family

Re: Commercial or Famous Applicattions.?

2010-11-10 Thread Martin Gregorie
On Wed, 10 Nov 2010 17:01:05 +1300, Lawrence D'Oliveiro wrote: > In message , Martin Gregorie wrote: > >> ...and don't forget getmail, a better behaved replacement for >> fetchmail. > > I was just looking this up in the Getmail FAQ, since I didn’t know about > the issues with Fetchmail. > FWIW

Re: Learning Pyhton - Functional Programming - How intersect/difference two dict with dict/values? fast!

2010-11-10 Thread Paul Rudin
Lawrence D'Oliveiro writes: > In message , Terry Reedy > wrote: > >> To echo John Nagle's point, if you want non-masochist volunteers to read >> your code, write something readable like: >> >> dict1 = {'ab': [[1,2,3,'d3','d4',5], 12], >> 'ac': [[1,3,'78a','79b'], 54], >> 'ad

Re: Deditor 0.2.2

2010-11-10 Thread TheSeeker
On Nov 9, 10:04 am, Kruptein wrote: > On Nov 8, 3:01 pm, Jean-Michel Pichavant > wrote: > > > > > > > > > > > TheSeeker wrote: > > > On Nov 6, 7:06 am, Kruptein wrote: > > > >> Hey, > > > >> I released version 0.2.2 of my pythonic text-editor  Deditor. > > >> It adds the use of projects, a proje

Re: How to read the Python tutorial?

2010-11-10 Thread rantingrick
On Nov 10, 10:05 am, Zeynel wrote: > AttributeError: 'datetime.datetime' object has no attribute 'seconds' First of all put some scaffolding in this code. What is scaffolding. Basically some debug print statements so you can follow the trail of errors. You need to learn how to debug code and be

A matter of queues, tasks and multiprocessing

2010-11-10 Thread Emanuele D'Arrigo
Greetings everybody, I've tried to come up with this message for a couple of weeks now and it doesn't look like I'm getting any clearer in my thoughts so I decided that it's probably best to take the plunge and ask you guys to kindly throw me a rope... What I'm trying to come up with is some kind

Re: How to test if a module exists?

2010-11-10 Thread Mark Wooding
Lawrence D'Oliveiro writes: > I see that you published my unobfuscated e-mail address on USENET for all to > see. I obfuscated it for a reason, to keep the spammers away. I'm assuming > this was a momentary lapse of judgement, for which I expect an apology. > Otherwise, it becomes grounds for an

Re: multiple discontinued ranges

2010-11-10 Thread Paul Rudin
xoff writes: > I was wondering what the best method was in Python programming for 2 > discontinued ranges. e.g. I want to use the range 3 to 7 and 17 to 23. > Am I obliged to use 2 for loops defining the 2 ranges like this: > > for i in range (3,7): > do bla > for i in range (7,17): > do bla >

How to read the Python tutorial?

2010-11-10 Thread Zeynel
For instance, when the tutorial has http://docs.python.org/release/2.6/library/datetime.html class datetime.datetime A combination of a date and a time. Attributes: year, month, day, hour, minute, second, microsecond, and tzinfo. What does this mean? How do I use it? For instance, I have a Date

multiple discontinued ranges

2010-11-10 Thread xoff
I was wondering what the best method was in Python programming for 2 discontinued ranges. e.g. I want to use the range 3 to 7 and 17 to 23. Am I obliged to use 2 for loops defining the 2 ranges like this: for i in range (3,7): do bla for i in range (7,17): do bla or is there a more clever way t

Re: An easier way to do this? (spoiler if you're using pyschools for fun)

2010-11-10 Thread Matteo Landi
I agree with Peter: * iterate over the list directly * use %10 instead of string conversion + slice (*) use genexps Good luck, Matteo On Tue, Nov 9, 2010 at 8:18 PM, Terry Reedy wrote: > On 11/9/2010 2:00 PM, Matty Sarro wrote: > >> I'm working on one of the puzzles on pyschools.com >>

Enumeration of strings and export of the constants

2010-11-10 Thread lnenov
Hi, I need to enumerate a couple hundred strings to constants and export them to another module(s) globals. In the mean time I want to keep my module's namespace as clear as I can and I don't want to use "import *" later. Here is the code I intend to use: test.py 1 class Apinamespace()

Re: Learning Pyhton - Functional Programming - How intersect/difference two dict with dict/values? fast!

2010-11-10 Thread macm
Hi Folks I am studing yet (with fever, grasp and headache). I know I can do better, but first I should learn more about "dictionary comprehension syntax" in python 2.65 >>> dict1 = {'ab':[[1,2,3,'d3','d4',5],12],'ac':[[1,3,'78a','79b'],54],'ad': >>> [[56,57,58,59],34], 'ax': [[56,57,58,59],34]

Re: Class extension confusion :(

2010-11-10 Thread Teenan
If memory serves, the following should work fine, as long as your happy for these vars to have the same value for all instances of the RequestHandler (static) MyHandler = PlainAJAXRequestHandler MyHandler.paths = my_paths_var webServer = HTTPServer( server_address, MyHandler) An alternative I've

Re: Allowing comments after the line continuation backslash

2010-11-10 Thread Robert Kern
On 11/10/10 12:26 AM, Lawrence D'Oliveiro wrote: In message, Robert Kern wrote: For me, putting the brackets on their own lines (and using a trailing comma) has little to do with increasing readability. It's for making editing easier. Keeping all of the items consistent means that in order to a

Re: DTD Parsing

2010-11-10 Thread Felipe Bastos Nunes
I'll look at the options. But anyway, only to give an example of the configs I told, the ShoX project (at sourceforge.net) has xml as config files. I'm not talking about common users to edit the xmls, it's about the developer edit them :-) I'm working in a python wireless sensor network simulator,

Re: A matter of queues, tasks and multiprocessing

2010-11-10 Thread danmcle...@yahoo.com
If you are using Python 2.6 or greater, look into the multiprocessing module. It may contain 90% of what you need. -- http://mail.python.org/mailman/listinfo/python-list

Re: http error 301 for urlopen

2010-11-10 Thread Hans-Peter Jansen
On Tuesday 09 November 2010, 03:10:24 Lawrence D'Oliveiro wrote: > In message <4cd7987e$0$1674$742ec...@news.sonic.net>, John Nagle wrote: > >It's the New York Times' paywall. They're trying to set a > > cookie, and will redirect the URL until you store and return the > > cookie. > > And if t

Re: Feed subscription IM bot

2010-11-10 Thread Chris Rebert
On Wed, Nov 10, 2010 at 6:49 AM, alexander wrote: > Hi, > >   Can anyone help on this? http://stackoverflow.com/questions/1901828/best-python-xmpp-jabber-client-library http://www.djangoproject.com/ Come back when you have a much less nebulous question. And try googling first next time. Regards

Is Eval *always* Evil?

2010-11-10 Thread Simon Mullis
Hi All, I'm writing a Django App to webify a Python script I wrote that parses some big XML docs and summarizes certain data contained within. This app will be used by a closed group of people, all with their own login credentials to the system (backed off to the corp SSO system). I've already got

Re: How to test if a module exists?

2010-11-10 Thread Robert Kern
On 11/10/10 3:50 AM, Lawrence D'Oliveiro wrote: In message, Jon Dufresne wrote: On Mon, Nov 8, 2010 at 11:35 PM, Lawrence D'Oliveiro ... I see that you published my unobfuscated e-mail address on USENET for all to see. I obfuscated it for a reason, to keep the spammers away. I'm assuming this

Questions: While And List Comprehension

2010-11-10 Thread Felipe Vinturini
Hi Folks, I am quite new to python and I don't have a lot of experience with it yet. I have two simple questions: 1. Is there a way to limit the number of times a list comprehension will execute? E.g. I want to read from input only 5 values, so I would like something like (the values between # #

Re: ANN: PyGUI 2.3

2010-11-10 Thread Bill Janssen
Gregory Ewing wrote: > Daniel Fetchinson wrote: > > > Any reason your project is not easy_installable? > > Mainly because I'm not a setuptools user and haven't been > motivated to learn how to do this so far. Applause!! Bill -- http://mail.python.org/mailman/listinfo/python-list

Re: How to read the Python tutorial?

2010-11-10 Thread Emile van Sebille
On 11/10/2010 8:19 AM rantingrick said... I would start at the loop and figure out what is going on from there with some print statements and the functions i showed you. Debugging is a large part of any programming project. We all do it everyday. So the sooner you learn the better. If you have a

Re: multiple discontinued ranges

2010-11-10 Thread Emile van Sebille
On 11/10/2010 9:34 AM xoff said... On 10 nov, 18:15, Paul Rubin wrote: potentially lots of storage (you should use xrange instead). On the other hand you could just concatenate the lists with +, but I wouldn't advise that. I am curious, why wouldn't you advise something like this: for i in c

Re: DTD Parsing

2010-11-10 Thread Ian
On Nov 10, 1:05 am, r0g wrote: > > That's five whole lines of code. Why go to all that trouble when you can > > just do this: > > > import config > > Heh, mainly because I figure the config module will have a lot more > options than I have use for right now and therefore the docs will take > me lo

Re: Learning Pyhton - Functional Programming - How intersect/difference two dict with dict/values? fast!

2010-11-10 Thread macm
... and this works! >>> def intersect(s1, s2): ... d = {} ... e = {} ... r1 = filter(s1.has_key, s2.keys()) ... for x in r1: ... d[x]= filter(lambda z:z in s1[x][0],s2[x][0]) ... if len(d[x]) > 0: ... e[x] = d[x] ... return e ... >>> intersect(dict1,

Re: Feed subscription IM bot

2010-11-10 Thread Emile van Sebille
On 11/10/2010 6:49 AM alexander said... Hi, Can anyone help on this? / Probably most of us, but as it's obviously homework, and expected to take you 1-2 hours for the level class you're taking, and that it's now six hours later, why not post where you're at and we can help you wrap

Re: Deditor 0.2.2

2010-11-10 Thread TheSeeker
On Nov 10, 7:51 am, Kruptein wrote: > On Nov 10, 12:49 pm, TheSeeker wrote: > > > > > > > > > > > On Nov 9, 10:04 am, Kruptein wrote: > > > > On Nov 8, 3:01 pm, Jean-Michel Pichavant > > > wrote: > > > > > TheSeeker wrote: > > > > > On Nov 6, 7:06 am, Kruptein wrote: > > > > > >> Hey, > > > >

Re: How to read the Python tutorial?

2010-11-10 Thread MRAB
On 10/11/2010 15:13, Zeynel wrote: For instance, when the tutorial has http://docs.python.org/release/2.6/library/datetime.html class datetime.datetime A combination of a date and a time. Attributes: year, month, day, hour, minute, second, microsecond, and tzinfo. What does this mean? How do I

Re: multiple discontinued ranges

2010-11-10 Thread MRAB
On 10/11/2010 17:34, xoff wrote: On 10 nov, 18:15, Paul Rubin wrote: you could use itertools.chain: from itertools import chain for i in chain(range(3,7), range(17,23)): ... I'm assuming you're using python 3. In python 2 each of those ranges expands immediately to a list, so on

Re: How to test if a module exists?

2010-11-10 Thread Ethan Furman
Lawrence D'Oliveiro wrote: In message , Jon Dufresne wrote: On Mon, Nov 8, 2010 at 11:35 PM, Lawrence D'Oliveiro ... I see that you published my unobfuscated e-mail address on USENET for all to see. I obfuscated it for a reason, to keep the spammers away. I'm assuming this was a momentary la

Re: How to read the Python tutorial?

2010-11-10 Thread Terry Reedy
On 11/10/2010 10:13 AM, Zeynel wrote: For instance, when the tutorial has http://docs.python.org/release/2.6/library/datetime.html class datetime.datetime A combination of a date and a time. Attributes: year, month, day, hour, minute, second, microsecond, and tzinfo. Note 'second' singular, a

Re: Curses Programming

2010-11-10 Thread Chris Rebert
On Wed, Nov 10, 2010 at 6:42 AM, alexander wrote: > Subject: Curses Programming This has nothing whatsoever to do with the (n)curses library or even console programming. Lying in your subject line does not help gain you goodwill. > Hi, all > >     Here is the test. Plz help. If you want ho

Re: Enumeration of strings and export of the constants

2010-11-10 Thread Emile van Sebille
On 11/10/2010 5:12 AM lnenov said... Hi, I need to enumerate a couple hundred strings to constants and export them to another module(s) globals. Do they really need to be globals? Why not a constants in an object/container that would neither pollute the global namespace nor risk being shado

Re: multiple discontinued ranges

2010-11-10 Thread Paul Rubin
xoff writes: > I am curious, why wouldn't you advise something like this: > for i in chain(range(3,7) + range(17,23)): First of all, the outer chain does nothing. Second, concatenating the two lists creates a new list, consuming storage and taking time copying all the elements. Third, if there

Re: Silly newbie question - Caret character (^)

2010-11-10 Thread Seebs
On 2010-11-10, Terry Reedy wrote: > I was referring to Schildt using gets() all the time and thereby > teaching new C generations to do he same. Ahh, yes. I am told that the current plan is to kill it in C1X. I would shed no tears. -s -- Copyright 2010, all wrongs reversed. Peter Seebach /

Re: ANN: PyQt v4.8.1 Released

2010-11-10 Thread Hans-Peter Jansen
Am Monday 08 November 2010 02:26:51 schrieb Robert Kern: > On 2010-11-07 18:53 , Lawrence D'Oliveiro wrote: > > In message, Robert > > Kern > > > > wrote: > >> Everyone here knew exactly what he meant. > > > > But if you don’t banana the right tomato, everybody could be grapefruit, > > right? > > >

Embedded python issue with gtk

2010-11-10 Thread Oliver Marks
I have already emailed about this issue, but have still not got any where. I have reduced the plugin down to its bare minimum it simple loads the the python interpreter and imports gtk library. If i do this outside the embedded python it imports and i can use the gtk library, so why does it not w

Re: How to read the Python tutorial?

2010-11-10 Thread Ian
On Nov 10, 8:13 am, Zeynel wrote: > But when I try > > datetime.datetime.mDATE.toordinal()) > > I get AttributeError. Others have already explained why "mDATE.seconds" does not work, but I wanted to touch on this as well. The above fails because "mDATE" is not an attribute of the "datetime.datet

Re: How to test if a module exists?

2010-11-10 Thread Robert Kern
On 11/10/10 2:27 PM, Robert Kern wrote: On 11/10/10 3:50 AM, Lawrence D'Oliveiro wrote: In message, Jon Dufresne wrote: On Mon, Nov 8, 2010 at 11:35 PM, Lawrence D'Oliveiro ... I see that you published my unobfuscated e-mail address on USENET for all to see. I obfuscated it for a reason, to

Re: Is Eval *always* Evil?

2010-11-10 Thread Hrvoje Niksic
Simon Mullis writes: > If "eval" is not the way forward, are there any suggestions for > another way to do this? ast.literal_eval might be the thing for you. -- http://mail.python.org/mailman/listinfo/python-list

Looping through files in a directory

2010-11-10 Thread Matty Sarro
Short story - I have a few thousand files in a directory I need to parse through. Is there a simple way to loop through files? I'd like to avoid writing a python script that can parse 1 file, and have to call it a few thousand times from a bash script. Any input or pointers to functions that'd help

Re: DTD Parsing

2010-11-10 Thread Stefan Behnel
Felipe Bastos Nunes, 10.11.2010 13:34: Does any, libxml2 or lxml, collect children like jdom does in java? List children = myRoot.getChildren(); Bah, that's *so* Java. ;) ElementTree and lxml.etree do it like this: children = list(myRoot) lxml also supports XPath and lots of other

Re: Questions: While And List Comprehension

2010-11-10 Thread Emile van Sebille
On 11/10/2010 4:36 AM Felipe Vinturini said... Hi Folks, I am quite new to python and I don't have a lot of experience with it yet. I have two simple questions: 1. Is there a way to limit the number of times a list comprehension will execute? E.g. I want to read from input only 5 values, so I

Re: Curses Programming

2010-11-10 Thread James Mills
On Thu, Nov 11, 2010 at 12:42 AM, alexander wrote: > Could any give a hand? Assignment ? Homework ? cheers James -- -- James Mills -- -- "Problems are solved by method" -- http://mail.python.org/mailman/listinfo/python-list

Re: Questions: While And List Comprehension

2010-11-10 Thread James Mills
On Wed, Nov 10, 2010 at 10:36 PM, Felipe Vinturini wrote: > 1. Is there a way to limit the number of times a list comprehension will > execute? E.g. I want to read from input only 5 values, so I would like > something like (the values between # # are what I want): > ===

Re: Development Vs Release

2010-11-10 Thread Lawrence D'Oliveiro
In message <201011100749474192-nom...@thisaddresscom>, Sven wrote: > I don't like the idea of flags inside the code as they can often get > missed when developers release their code, ending up with released > versions that import modules from the developer's working directory. I have used a flag,

Re: Is Eval *always* Evil?

2010-11-10 Thread Christian Heimes
Am 10.11.2010 18:56, schrieb Simon Mullis: Yes, eval is evil, may lead to security issues and it's unnecessary slow, too. > # In the meantime - and as a proof of concept - I'm using a dict instead. > > xpathlib = { > "houses": r'[ y.tag for y in x.xpath("//houses/*") ]', >

Re: DTD Parsing

2010-11-10 Thread Christian Heimes
Am 10.11.2010 04:36, schrieb Asun Friere: > Yes but configuration files are not necessarily meant to be edited by > humans either! Yeah, you are right. I'm sorry but every time I read XML and configuration in one sentence, I see the horror of TomCat or Shibboleth XML configs popping up. -- http:

Re: Enumeration of strings and export of the constants

2010-11-10 Thread Ian
On Nov 10, 6:12 am, lnenov wrote: > Is there a better and more common way to do this? from itertools import count, izip class APINamespace(object): def __init__(self): self._named_values = [] def enumerate(self, names, start=0, step=1): self._named_values.extend(izip(na

Re: Looping through files in a directory

2010-11-10 Thread James Mills
On Thu, Nov 11, 2010 at 8:46 AM, Matty Sarro wrote: > Short story - I have a few thousand files in a directory I need to parse > through. Is there a simple way to loop through files? I'd like to avoid > writing a python script that can parse 1 file, and have to call it a few > thousand times from

Re: Looping through files in a directory

2010-11-10 Thread Steve Holden
On 11/10/2010 5:46 PM, Matty Sarro wrote: > Short story - I have a few thousand files in a directory I need to parse > through. Is there a simple way to loop through files? I'd like to avoid > writing a python script that can parse 1 file, and have to call it a few > thousand times from a bash scri

Re: How to test if a module exists?

2010-11-10 Thread Steve Holden
On 11/10/2010 4:50 AM, Lawrence D'Oliveiro wrote: > In message , Jon > Dufresne wrote: > >> On Mon, Nov 8, 2010 at 11:35 PM, Lawrence D'Oliveiro ... > > I see that you published my unobfuscated e-mail address on USENET for all to > see. I obfuscated it for a reason, to keep the spammers away. I'

Re: Am I The Only One Who Keeps Reading “Numpy ” as “Numpty”?

2010-11-10 Thread Arnaud Delobelle
rantingrick writes: >[...] it's "Num-pee" for me. If the "py" is appended i use "x-pee" and >if it is pre i use "pie- x". So pypy is "pie-pee", not "pie-pie" or "pee-pee". With that edifying thought, I'm off to bed. -- Arnaud -- http://mail.python.org/mailman/listinfo/python-list

Re: Questions: While And List Comprehension

2010-11-10 Thread James Mills
On Thu, Nov 11, 2010 at 8:56 AM, Emile van Sebille wrote: > Easiest would be print [ v for v in sys.stdin.readlines()[:5] ] but that > still reads the entire sys.stdin (whatever it may be...) Here's a way of doing the same thing without consuming the entire stream (sys.stdin): #!/usr/bin/env pyt

Re: Looping through files in a directory

2010-11-10 Thread Chris Rebert
On Wed, Nov 10, 2010 at 2:46 PM, Matty Sarro wrote: > Short story - I have a few thousand files in a directory I need to parse > through. Is there a simple way to loop through files? I'd like to avoid > writing a python script that can parse 1 file, and have to call it a few > thousand times from

Re: Looping through files in a directory

2010-11-10 Thread Emile van Sebille
On 11/10/2010 2:46 PM Matty Sarro said... Short story - I have a few thousand files in a directory I need to parse through. Is there a simple way to loop through files? I'd like to avoid writing a python script that can parse 1 file, and have to call it a few thousand times from a bash script. An

Re: Questions: While And List Comprehension

2010-11-10 Thread Steve Holden
On 11/10/2010 6:01 PM, James Mills wrote: > On Wed, Nov 10, 2010 at 10:36 PM, Felipe Vinturini > wrote: >> 1. Is there a way to limit the number of times a list comprehension will >> execute? E.g. I want to read from input only 5 values, so I would like >> something like (the values between # # ar

Re: Commercial or Famous Applicattions.?

2010-11-10 Thread alex23
Martin Gregorie wrote: > Now, if ESR had fixed fetchmail [...] Did you try submitting patches? -- http://mail.python.org/mailman/listinfo/python-list

  1   2   >