Re: [Tutor] Help with web.py error

2012-12-05 Thread eryksun
On Wed, Dec 5, 2012 at 2:13 AM, Erik Martinson wrote: > > File "/usr/lib/python2.7/sqlite3/dbapi2.py", line 63, in convert_date > return datetime.date(*map(int, val.split("-"))) > > ValueError: invalid literal for int() with base 10: '21 01:47:43' > 127.0.0.1:59850 - - [04/Dec/2012 22:47:35] "HTT

[Tutor] correct way to encode

2012-12-05 Thread Norman Khine
hello, i have this code from the google fusion table api: (zmgc)☺ python * master 9e4be39 ✗zmgc" Python 2.7.2 (default, Jan 28 2012, 14:53:22) [GCC 4.2.1 (Apple Inc. build 5666) (dot 3)] on darwin Type "help", "copyright", "credits" or "license" for more information. >>> import csv >>

Re: [Tutor] correct way to encode

2012-12-05 Thread Hugo Arts
On Wed, Dec 5, 2012 at 2:47 PM, Norman Khine wrote: > hello, i have this code from the google fusion table api: > > (zmgc)☺ python > * master 9e4be39 ✗zmgc" > Python 2.7.2 (default, Jan 28 2012, 14:53:22) > [GCC 4.2.1 (Apple Inc. build 5666) (dot 3)] on darwin > Type "help", "copyrig

[Tutor] Get/Set/Attribute Accessors in Python?

2012-12-05 Thread Malcolm Newsome
Hey Tutors, Python is/was my first language. Yet, I've recently begun learning C# for my new job. One thing I've come across in C# (and, quite frankly, am having a difficult time grasping) is Get and Set (Accessors). Since, I don't ever recall reading about this in Python, I'm wondering if they

Re: [Tutor] Get/Set/Attribute Accessors in Python?

2012-12-05 Thread Francois Dion
On Wed, Dec 5, 2012 at 10:38 AM, Malcolm Newsome wrote: > Hey Tutors, > > Python is/was my first language. Yet, I've recently begun learning C# for > my new job. My condolences. > One thing I've come across in C# (and, quite frankly, am having a difficult > time grasping) is Get and Set (Access

Re: [Tutor] Get/Set/Attribute Accessors in Python?

2012-12-05 Thread Dave Angel
On 12/05/2012 10:38 AM, Malcolm Newsome wrote: > Hey Tutors, > > Python is/was my first language. Yet, I've recently begun learning C# for > my new job. > > One thing I've come across in C# (and, quite frankly, am having a difficult > time grasping) is Get and Set (Accessors). > > Since, I don't e

Re: [Tutor] Get/Set/Attribute Accessors in Python?

2012-12-05 Thread Steven D'Aprano
On 06/12/12 02:38, Malcolm Newsome wrote: Hey Tutors, Python is/was my first language. Yet, I've recently begun learning C# for my new job. One thing I've come across in C# (and, quite frankly, am having a difficult time grasping) is Get and Set (Accessors). Since, I don't ever recall reading

[Tutor] Unexpected results with obj.method().method()

2012-12-05 Thread C M Caine
Dear all, I've written a class State that subclasses tuple. The class has a method move_state that takes a move and returns a new state object representing the new state of the game. I would expect S1 and S3 to be equal on the last line here, but they are not. >>> import game >>> S = game.State(

Re: [Tutor] Unexpected results with obj.method().method()

2012-12-05 Thread C M Caine
I edited the output of Lines 109-111 from my source code out of the interpreter transcripts above, by the by. On 5 December 2012 18:11, C M Caine wrote: > Dear all, > > I've written a class State that subclasses tuple. The class has a method > move_state that takes a move and returns a new stat

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

2012-12-05 Thread Prasad, Ramit
Steven D'Aprano wrote: > > On Mon, Dec 03, 2012 at 05:56:30PM -0600, Luke Paireepinart wrote: > > > I just wanted to make the observation that, at least in gmail, the default > > behavior is to hide the entire quoted text behind an innocuous "..." > > button. > > Good lord, the more I hear about

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

2012-12-05 Thread Dave Angel
On 12/05/2012 03:50 PM, Prasad, Ramit wrote: > >> >> Not to mention that as social conventions regarding email have moved >> on--e.g. top posting--for the majority of email users A bug that somehow convinced people that it was "normal." So other implementers copied the bug. -- DaveA __

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

2012-12-05 Thread Alan Gauld
On 05/12/12 20:50, Prasad, Ramit wrote: Maybe I am in the minority, but the only people I know who regularly bottom/in-line post are regularly on mailing lists. This is a bad practice picked up from group-ware tools from the 80s/90s which unfortunately called themselves email tools, but didn'

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

2012-12-05 Thread Dave Angel
On 12/05/2012 04:22 PM, Alan Gauld wrote: > > > > PPS. > There is one advantage to lazy top posting. When I return from > vacation I sort by subject and only open the most recent in a thread. > That way I can read up from the bottom and get all the others in one > go. I then just delete the rest u

Re: [Tutor] correct way to encode

2012-12-05 Thread Norman Khine
On Wed, Dec 5, 2012 at 3:24 PM, Hugo Arts wrote: > On Wed, Dec 5, 2012 at 2:47 PM, Norman Khine wrote: >> >> hello, i have this code from the google fusion table api: >> >> (zmgc)☺ python >> * master 9e4be39 ✗zmgc" >> Python 2.7.2 (default, Jan 28 2012, 14:53:22) >> [GCC 4.2.1 (Apple

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

2012-12-05 Thread Alan Gauld
On 05/12/12 21:31, Dave Angel wrote: That way I can read up from the bottom and get all the others in one go. I then just delete the rest unread... Thanks to that trick I was For any email exchange that involves more than two people, you can easily lose content that way. Less common, if someo

[Tutor] Regular expressions question

2012-12-05 Thread Ed Owens
>>> str(string) '[\nUpdated: Dec 5, 2012, 5:08pm EST\n]' >>> m = re.search('":\b(\w+\s+\d+,\s+\d+,\s+\d+:\d+.m\s+\w+)<', str(string)) >>> print m None >>> I'm sort of embarrassed to ask this, but I've been staring at this regular expression for hours and can't see why it doesn't work. I'm tr

Re: [Tutor] Regular expressions question

2012-12-05 Thread Brett Ritter
On Wed, Dec 5, 2012 at 4:13 PM, Ed Owens wrote: > >>> str(string) > '[\nUpdated: Dec 5, 2012, 5:08pm EST\n]' > >>> m = re.search('":\b(\w+\s+\d+,\s+\**d+,\s+\d+:\d+.m\s+\w+)<', > str(string)) > >>> print m > None > It starts with ": which doesn't appear in your string. -- Brett Ritter / SwiftO

Re: [Tutor] Unexpected results with obj.method().method()

2012-12-05 Thread Oscar Benjamin
On 5 December 2012 18:11, C M Caine wrote: > Dear all, > > I've written a class State that subclasses tuple. The class has a method > move_state that takes a move and returns a new state object representing the > new state of the game. > > I would expect S1 and S3 to be equal on the last line here

Re: [Tutor] Regular expressions question

2012-12-05 Thread Ed Owens
On 12/5/12 7:24 PM, Brett Ritter wrote: On Wed, Dec 5, 2012 at 4:13 PM, Ed Owens > wrote: >>> str(string) '[\nUpdated: Dec 5, 2012, 5:08pm EST\n]' >>> m = re.search('":\b(\w+\s+\d+,\s+\d+,\s+\d+:\d+.m\s+\w+)<', str(string)) >>> print m None I

Re: [Tutor] Regular expressions question

2012-12-05 Thread Alan Gauld
On 06/12/12 00:13, Ed Owens wrote: >>> str(string) '[\nUpdated: Dec 5, 2012, 5:08pm EST\n]' >>> m = re.search('":\b(\w+\s+\d+,\s+\d+,\s+\d+:\d+.m\s+\w+)<', str(string)) >>> print m None >>> I'm sort of embarrassed to ask this, but I've been staring at this regular expression for hours and ca

Re: [Tutor] Regular expressions question

2012-12-05 Thread Alan Gauld
On 06/12/12 00:24, Brett Ritter wrote: '[\nUpdated: Dec 5, 2012, 5:08pm EST\n]' >>> m = re.search('":\b(\w+\s+\d+,\s+\__d+,\s+\d+:\d+.m\s+\w+)<', It starts with ": which doesn't appear in your string. At the end of Updated: -- Alan G Author of the Learn to Program web site http://w

Re: [Tutor] Regular expressions question

2012-12-05 Thread Brett Ritter
On Wed, Dec 5, 2012 at 5:04 PM, Ed Owens wrote: > >>> m = re.search(':\b(\w+\s+\d+,\s+\d+,\s+\d+:\d+.m\s+\w+)<', str(string)) > >>> print m > None > >>> > Okay, without the double-quote (it wasn't the colon that I was worried about, it was the double-quote), I believe the issue now is that you h

Re: [Tutor] Unexpected results with obj.method().method()

2012-12-05 Thread eryksun
On Wed, Dec 5, 2012 at 1:11 PM, C M Caine wrote: > > The full code is on pastebin http://pastebin.com/tUh0W5Se > import game S = game.State() S1 = S.move_state(1).move_state("SWAP") S2 = S.move_state(1) S3 = S2.move_state("SWAP") S1 == S3 > False In lines 156-160 you

Re: [Tutor] Regular expressions question

2012-12-05 Thread eryksun
On Wed, Dec 5, 2012 at 7:13 PM, Ed Owens wrote: str(string) > '[\nUpdated: > Dec 5, 2012, 5:08pm EST\n]' m = re.search('":\b(\w+\s+\d+,\s+\d+,\s+\d+:\d+.m\s+\w+)<', str(string)) print m > None You need a raw string for the boundary marker \b (i.e the boundary between \w and \W), el

Re: [Tutor] Get/Set/Attribute Accessors in Python?

2012-12-05 Thread Malcolm Newsome
Thanks gentlemen! Your answers were very thorough and helpful. I'll play with this some. Malcolm Newsome ___ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: http://mail.python.org/mailman/listinfo/tutor

Re: [Tutor] Get/Set/Attribute Accessors in Python?

2012-12-05 Thread Mark Lawrence
On 05/12/2012 16:58, Steven D'Aprano wrote: And here is how it should be written in Python: class Example(object): def __init__(self, value): self.x = value instance = Example(42) print instance.x # gives 42 instance.setx(23) And introduce error handling while we're at it?

Re: [Tutor] Get/Set/Attribute Accessors in Python?

2012-12-05 Thread eryksun
On Wed, Dec 5, 2012 at 10:38 AM, Malcolm Newsome wrote: > > One thing I've come across in C# (and, quite frankly, am having a difficult > time grasping) is Get and Set (Accessors). > > Since, I don't ever recall reading about this in Python, I'm wondering if > they exist. Python uses what it call