unexpected regexp behaviour using 'A|B|C.....'

2011-07-28 Thread AlienBaby
When using re patterns of the form 'A|B|C|...' the docs seem to suggest that once any of A,B,C.. match, it is captured and no further patterns are tried. But I am seeing, st=' Id NameProv Type CopyOf BsId Rd -Detailed_State-Adm Snp Usr VSize' p='T

Re: PEP 8 and extraneous whitespace

2011-07-26 Thread AlienBaby
> (on limiting line lengths).. I didn't see this mentioned; I have a hard time keeping python code limited to 80 char line lengths _because_ indentation is significant, and can end up consuming quite a lot of linespace itself. Couple that with a liking for long_memorable_explanatory_names, and a

using an instance of Object as an empty class

2011-06-29 Thread AlienBaby
Hi, I'm just wondering why something is so, and whats going on under the hood. Now and again I use something like class empty(object): pass simply so I can make an instance, and set some attributes on it. a=empty() a.whatever=something Poking around with this, I assumed I could instead say

Re: PyPad 2.7.1 Update 4 (Python on iPad and iPhone)

2011-06-28 Thread AlienBaby
On Jun 23, 2:07 pm, Jon Dowdall wrote: > Hi All, > > I'm pleased to announce that PyPad (Python environment for iOS) 2.7.1 > Update 4 is now available in the iTunes App Store. New in this version > is the ability to create custom modules. Modules can be independent or > can include other user modu

Re: Dictionaries and incrementing keys

2011-06-14 Thread AlienBaby
On Jun 14, 12:16 pm, Peter Otten <__pete...@web.de> wrote: > Steve Crook wrote: > > I've always done key creation/incrementation using: > > > if key in dict: > >     dict[key] += 1 > > else: > >     dict[key] = 1 > > Your way is usually faster than > > > dict[key] = dict.get(key, 0) + 1 > > > Whils

Re: Convert AWK regex to Python

2011-05-17 Thread AlienBaby
On May 17, 11:07 am, J wrote: > Hello, > > I have managed to get my script finished in the end by taking bits from > everyone who answered.  Thank you so much.  the finished query string looks > like this (still not the best but it gets the job done.  Once I learn to code > more with Python I w

Re: locale settings and date parsing under windows

2011-02-03 Thread AlienBaby
On Feb 3, 12:13 pm, "Martin P. Hellwig" wrote: > On 02/03/11 10:59, AlienBaby wrote: > > > > > > > On Feb 3, 10:22 am, AlienBaby  wrote: > >> Hi, > > >> I'm attempting to convert some date-time strings from a text file >

Re: locale settings and date parsing under windows

2011-02-03 Thread AlienBaby
On Feb 3, 10:22 am, AlienBaby wrote: > Hi, > > I'm attempting to convert some date-time strings from a text file > under windows into a datetime object as returned by strptime() > > However, the strings can represent dates in various formats based on > the country of ori

locale settings and date parsing under windows

2011-02-03 Thread AlienBaby
Hi, I'm attempting to convert some date-time strings from a text file under windows into a datetime object as returned by strptime() However, the strings can represent dates in various formats based on the country of origin, for example shortened month names etc.. are different between countries.

Re: Changing Locale for datetime.strptime conversions

2010-07-06 Thread AlienBaby
I'm still having a bit of trouble, for example trying to set the locale to Denmark locale.setlocale(locale.LC_ALL, locale.normalize('da_DK')) returns with locale.setlocale(locale.LC_ALL, locale.normalize('da_DK')) File "C:\Python26\lib\locale.py", line 494, in setlocale return _setl

Re: Changing Locale for datetime.strptime conversions

2010-07-06 Thread AlienBaby
On 6 July, 10:55, AlienBaby wrote: > Hi, > > I'm using datetime.strptime(string,format) to convert dates parsed > from a file into datetime objects. > > However, the files come from various places around the world, and > strptime fails when non-english month names are

Changing Locale for datetime.strptime conversions

2010-07-06 Thread AlienBaby
Hi, I'm using datetime.strptime(string,format) to convert dates parsed from a file into datetime objects. However, the files come from various places around the world, and strptime fails when non-english month names are used. strptime says it converts month names using the current locales versio

Re: PyQt signals/slots dialogs question

2010-06-07 Thread AlienBaby
On Jun 7, 5:21 pm, AlienBaby wrote: > My real aim here is to learn pyqt, so I would rather not the the > QWizard process until I understand myself whats going on behind the > scenes. Perhaps I posted to early, but a little more perserverance and I have managed to unthaw the brain

Re: PyQt signals/slots dialogs question

2010-06-07 Thread AlienBaby
My real aim here is to learn pyqt, so I would rather not the the QWizard process until I understand myself whats going on behind the scenes. -- http://mail.python.org/mailman/listinfo/python-list

Re: PyQt signals/slots dialogs question

2010-06-07 Thread AlienBaby
On Jun 7, 4:37 pm, Phil Thompson wrote: > On Mon, 7 Jun 2010 08:22:07 -0700 (PDT), AlienBaby > > wrote: > > > > > > > Hi, > > > I'm just starting to get to grips with PyQt, and I'm having a bit of > > trouble connecting slots / signals, or

Re: PyQt signals/slots dialogs question

2010-06-07 Thread AlienBaby
I've made a little progress; This appears to setup a connection that fires when the welcomeNext button in the Welcome dialog is clicked; self.Welcome.welcomeNext.connect(self.Welcome.welcomeNext,QtCore.SIGNAL("clicked()"),self.WelcomeNext) In the StartQT4 class I now have the WelcomeNext method

PyQt signals/slots dialogs question

2010-06-07 Thread AlienBaby
Hi, I'm just starting to get to grips with PyQt, and I'm having a bit of trouble connecting slots / signals, or understanding how I should do so to achieve what I am after. I am trying to write an application that will display a sequence of dialogs, with back / next / cancel buttons to step throu

Re: default value in list comprehension

2010-04-19 Thread AlienBaby
On Apr 19, 1:23 pm, eb303 wrote: > On Apr 19, 2:20 pm, AlienBaby wrote: > > > > > > > Hi, > > > just a quick one, > > > Is it possible to achieve a default value in a list comprehension > > where the if-clause is false? > > > Ie, someth

default value in list comprehension

2010-04-19 Thread AlienBaby
Hi, just a quick one, Is it possible to achieve a default value in a list comprehension where the if-clause is false? Ie, something similar to: [ a for a in b if something(a) else 'default' ] the idea being that, rather than skip a value if the if-clause is false, to place a default value at t

Re: Simplify Python

2010-04-07 Thread AlienBaby
On 6 Apr, 20:04, ja1lbr3ak wrote: > I'm trying to teach myself Python, and so have been simplifying a > calculator program that I wrote. The original was 77 lines for the > same functionality. Problem is, I've hit a wall. Can anyone help? > > loop = input("Enter 1 for the calculator, 2 for the Fib

Re: Recommend Commercial graphing library

2010-04-06 Thread AlienBaby
I am just looking at the PSF license now as it goes. It does appear that we should be able to continue using matplotlib. - the restrictions on open-source that have been imposed specifically state it is fine to use the python language, and if matplotlib has the same license I personally can't see a

Re: Recommend Commercial graphing library

2010-04-06 Thread AlienBaby
On Apr 6, 4:24 pm, Jean-Michel Pichavant wrote: > Pablo Recio Quijano wrote: > > Why must be commercial, when there is open and free alternatives? Like > > GNU Plot. > > Gnuplot is ugly. I'm using it because I don't care if it's ugly but it > clearly lacks of look & feel for presentations, as requ

Recommend Commercial graphing library

2010-04-06 Thread AlienBaby
Hi, I'm on the hunt for a good quality commercially licensed graphing / plotting library and wondered if anyone here had any recomendations. The work to be done is less scientific, more presentational, (I'm not going to be dealing with heatmaps / vectors etc.., just the usual bar / line / bubble /

Simple image manipulation question

2009-01-19 Thread AlienBaby
Hi, Could anyone point me toward the right modules etc.. that would help with; loading an image file rendering some text onto that image saveing the image file I've looked into Tkinter, but that seems to require working with canvases etc.., but I do not need to actually display the image, just