Re: [Tutor] output sequentially

2011-07-26 Thread Peter Otten
lina wrote: > I have below file, > > I wish the output following: > > The first field 169 -170 sequential, and then the filed 2 from 1-29, > ignore the rest 4 fields, > > 169CHOL O28 1612 6.966 6.060 6.429 Read the lines from the file, sort them with a proper key function, write

[Tutor] output sequentially

2011-07-26 Thread lina
Hi, I have below file, I wish the output following: The first field 169 -170 sequential, and then the filed 2 from 1-29, ignore the rest 4 fields, thanks for any suggestions, 169CHOL H29 1611 6.963 6.155 6.395 169CHOL O28 1612 6.966 6.060 6.429 169CHOLC3 1613 7.005

Re: [Tutor] Don't understand this class/constructor call syntax

2011-07-26 Thread Steven D'Aprano
dave wrote: Is it even possible to replace the implicit self argument of the initializer by passing something else? If so, what would be the syntax. Yes, by calling an "unbound method". Consider this class: class MyClass: def func(self, x): return x+1 When you run this code,

Re: [Tutor] What's the difference between %s and %r?

2011-07-26 Thread amt
Hello! Thank you all for writing and helping me out. I now understand the difference between the two format characters. -amt ___ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: http://mail.python.org/mailman/listinfo

Re: [Tutor] Logger object not passed between modules

2011-07-26 Thread Peter Otten
Luke Thomas Mergner wrote: > I am very new to Python and programming, basically just a curious > hobbyist. I am building a learning app that hopefully will include a > wxPython GUI. Right now I am trying to understand my code better by > including print statements. Now I know that I could just

Re: [Tutor] Logger object not passed between modules

2011-07-26 Thread Walter Prins
Hi Luke, On 26 July 2011 06:58, Luke Thomas Mergner wrote: > The logger object is created within a function in the main app class. Is > this wrong? I thought that logger ensured the same object is used by both > classes. The logger.getLogger(__name__) doesn't set anything other than the > name

Re: [Tutor] Don't understand this class/constructor call syntax

2011-07-26 Thread Alan Gauld
dave wrote: Is it even possible to replace the implicit self argument of the initializer by passing something else? If so, what would be the syntax. Im not sure this is what you mean but... When you call a method on an object like: class MyClass: def aMethod(self,spam): pass anObject= M