Re: Do any of you recommend Python as a first programming language?

2008-03-22 Thread Brian Lane
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 Jeff Schwab wrote: > jmDesktop wrote: >> For students 9th - 12th grade, with at least Algebra I. Do you think >> Python is a good first programming language for someone with zero >> programming experience? Using Linux and Python for first exposure to

Re: re.search (works)|(doesn't work) depending on for loop order

2008-03-22 Thread Brian Lane
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 sgharvey wrote: > ... and by works, I mean works like I expect it to. > > I'm writing my own cheesy config.ini parser because ConfigParser > doesn't preserve case or order of sections, or order of options w/in > sections. > > What's confusing me is t

Re: Testing for an empty dictionary in Python

2008-03-23 Thread Brian Lane
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 John Nagle wrote: >What's the cheapest way to test for an empty dictionary in Python? > > if len(dict.keys() > 0) : > > is expensive for large dictionaries, and makes loops O(N^2). > > John Nagle if d

Re: Inheritance question

2008-03-25 Thread Brian Lane
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 Gerard Flanagan wrote: > Use the child class when calling super: > > -- > class Foo(object): > def __init__(self): > self.id = 1 > > def getid(self): > return self.id > > class FooSon(Foo)