Re: [Tutor] regex: matching unicode

2012-12-23 Thread Albert-Jan Roskam
>>Is the code below the only/shortest way to match unicode characters? I would >>like to match whatever is defined as a character in the unicode reference >>database. So letters in the broadest sense of the word, but not digits, >>underscore or whitespace. Until just now, I was convinced that th

Re: [Tutor] Limitation of int() in converting strings

2012-12-23 Thread eryksun
On Sat, Dec 22, 2012 at 12:57 PM, Oscar Benjamin wrote: >>> >>> def make_int(obj): >>> '''Coerce str, float and int to int without rounding error >>> Accepts strings like '4.0' but not '4.1' >>> ''' >>> fnum = float('%s' % obj) >>> inum = int(fnum) >>> assert inum ==

Re: [Tutor] For Loop Question

2012-12-23 Thread Dave Angel
On 12/23/2012 09:02 PM, Alan Gauld wrote: > On 24/12/12 01:16, Mitya Sirenef wrote: >> On 12/23/2012 08:03 PM, Tom Tucker wrote: >>> >>> >>> Python Gurus, >>> I got a question for ya. Below I have three instance variables >>> (self.A, self.B, etc). How can I use the below >>> for loop for A, B, C

Re: [Tutor] regex: matching unicode

2012-12-23 Thread eryksun
On Sat, Dec 22, 2012 at 11:12 PM, Steven D'Aprano wrote: > > No. You could install a more Unicode-aware regex engine, and use it instead > of Python's re module, where Unicode support is at best only partial. > > Try this one: > > http://pypi.python.org/pypi/regex Looking over the old docs, I cou

Re: [Tutor] For Loop Question

2012-12-23 Thread Alan Gauld
On 24/12/12 01:16, Mitya Sirenef wrote: On 12/23/2012 08:03 PM, Tom Tucker wrote: Python Gurus, I got a question for ya. Below I have three instance variables (self.A, self.B, etc). How can I use the below for loop for A, B, C to also call those instance variables? Your example is not ent

Re: [Tutor] For Loop Question

2012-12-23 Thread Mitya Sirenef
On 12/23/2012 08:03 PM, Tom Tucker wrote: Python Gurus, I got a question for ya. Below I have three instance variables (self.A, self.B, etc). How can I use the below for loop for A, B, C to also call those instance variables? Example ### . . self.A = 1 self.

[Tutor] For Loop Question

2012-12-23 Thread Tom Tucker
Python Gurus, I got a question for ya. Below I have three instance variables (self.A, self.B, etc). How can I use the below for loop for A, B, C to also call those instance variables? Example ### . . self.A = 1 self.B= 2 self.C= 3 myDict = {'A': 1, 'B':

Re: [Tutor] Tutor Digest, Vol 106, Issue 60

2012-12-23 Thread Farrukh Ali
Thank you so so much Sir. Now i got u very well and have command on this concepty... Regards -- Message: 2 Date: Sat, 22 Dec 2012 17:52:06 -0500 From: Dave Angel To: tutor@python.org Subject: Re: [Tutor] check it for me Message-ID: <50d63996.9080...@davea.name

Re: [Tutor] List Comprehension Syntax

2012-12-23 Thread Malcolm Newsome
> Message: 4 > Date: Sun, 23 Dec 2012 02:48:42 -0500 > From: Mario Cacciatore > To: "tutor@python.org" > Subject: [Tutor] List Comprehension Syntax > Message-ID: <50d6b74d.031d650a.3497.a...@mx.google.com> > Content-Type: text/plain; charset="windows-1252" > > Hey everyone, > > I am having a

Re: [Tutor] List Comprehension Syntax

2012-12-23 Thread Steven D'Aprano
On 23/12/12 18:48, Mario Cacciatore wrote: Hey everyone, I am having a very hard time understanding the list comprehension syntax. I've followed the docs and could use some guidance from the fine folks here to supplement my findings. If someone wouldn't mind replying back with an example or two,

Re: [Tutor] List Comprehension Syntax

2012-12-23 Thread Peter Otten
Mario Cacciatore wrote: > Hey everyone, > > I am having a very hard time understanding the list comprehension syntax. > I've followed the docs and could use some guidance from the fine folks > here to supplement my findings. If someone wouldn't mind replying back > with an example or two, with so

Re: [Tutor] List Comprehension Syntax

2012-12-23 Thread Alan Gauld
On 23/12/12 07:48, Mario Cacciatore wrote: I am having a very hard time understanding the list comprehension syntax. I've followed the docs and could use some guidance from the fine folks here to supplement my findings. If someone wouldn't mind replying back with an example or two, with some exp

Re: [Tutor] List Comprehension Syntax

2012-12-23 Thread Mitya Sirenef
On 12/23/2012 02:48 AM, Mario Cacciatore wrote: Hey everyone, > > I am having a very hard time understanding the list comprehension syntax. I've followed the docs and could use some guidance from the fine folks here to supplement my findings. If someone wouldn't mind replying back with an exa