Re: hundreds of seconds?

2006-10-11 Thread neoedmund
python's time is as old as glibc's time(). A more clear interface as Java should be implements! though i'm not has the ability to do this. maybe some "volenties" could do out the favor. On Oct 11, 10:38 pm, [EMAIL PROTECTED] wrote: > Hi all > > How can I access partial seconds on the system cloc

python's OOP question

2006-10-15 Thread neoedmund
There's a program, it's result is "unexpected aaa", i want it to be "expected aaa". how to make it work? [code] class C1(object): def v(self, o): return "expected "+o class C2(object): def v(self, o): return "unexpected "+o def m(self):

Re: python's OOP question

2006-10-15 Thread neoedmund
thank you, Kay. But i need a "dynamic" way. Say i have a existing class, and add some method from other class into it. Kay Schluehr wrote: > neoedmund wrote: > > There's a program, it's result is "unexpected aaa", i want it to be > > "

Re: python's OOP question

2006-10-15 Thread neoedmund
I'm trying to achieve a higher level of "reusability". Maybe it cannot be done in python? Can anybody help me? Ben Finney wrote: > "neoedmund" <[EMAIL PROTECTED]> writes: > > > There's a program, it's result is "unexpected aaa

Re: python's OOP question

2006-10-15 Thread neoedmund
nheritance? Ben Finney wrote: > [Please don't top-post above the text to which you're replying.] > > "neoedmund" <[EMAIL PROTECTED]> writes: > > > I'm trying to achieve a higher level of "reusability". Maybe it > > cannot be done

Re: python's OOP question

2006-10-15 Thread neoedmund
I found a dynamic way to inherite classes: def MixIn(pyClass, mixInClass): if mixInClass not in pyClass.__bases__: pyClass.__bases__ += (mixInClass,) def test1(): o = C3() MixIn(C3,C1) MixIn(C3,C2) o.m() "expected aaa" neoedmund wrote: &

Re: python's OOP question

2006-10-15 Thread neoedmund
Oh, How great is the solution! ( though i don't know how it works. ) Thank you George. George Sakkis wrote: > neoedmund wrote: > > > python use multiple inheritance. > > but "inheritance" means you must inherite all methods from super type. > > now i jus

Re: python's OOP question

2006-10-16 Thread neoedmund
Bruno Desthuilliers wrote: > neoedmund wrote: > (*PLEASE* stop top-posting - corrected) > > > > Ben Finney wrote: > >> [Please don't top-post above the text to which you're replying.] > >> > >> "neoedmund" <[EMAIL PROTECTED]>

Re: python's OOP question

2006-10-16 Thread neoedmund
On Oct 16, 9:01 pm, Bruno Desthuilliers <[EMAIL PROTECTED]> wrote: > neoedmund wrote: > > Bruno Desthuilliers wrote: > >> neoedmund wrote: > >> (*PLEASE* stop top-posting - corrected) > >>> Ben Finney wrote: > >>>> [P

Re: I would like write some data recovery software

2006-10-17 Thread neoedmund
gel wrote: > I would like to write some data recovery software as a learning thing. > The sort of thing that you would use to recover data from a currupt HDD > or floppy etc. I would like to be pointed in the right direction as > far as modules to use and suggested approaches. what kind of recov

Re: python's OOP question

2006-10-18 Thread neoedmund
Bruno Desthuilliers wrote: > neoedmund wrote: > (snip) > > So I can reuse a method freely only if it's worth reusing. > > For the word "inheritance", in some aspect, meanings reuse the super > > class, with the condition: must reuse everything fr

Re: python's OOP question

2006-10-18 Thread neoedmund
Bruno Desthuilliers wrote: > neoedmund wrote: > (snip) > > So I can reuse a method freely only if it's worth reusing. > > For the word "inheritance", in some aspect, meanings reuse the super > > class, with the condition: must reuse everything fr

how to get the os file icon for a given content-type?

2006-08-28 Thread neoedmund
any simple method? -- http://mail.python.org/mailman/listinfo/python-list

Re: how to get the os file icon for a given content-type?

2006-08-28 Thread neoedmund
So what? Java 5.0 has the method, why python has not? Bruno Desthuilliers wrote: > neoedmund wrote: > Please repeat the whole question in the message body > > =>how to get the os file icon for a given content-type? > > any simple method? > > This is specific to your OS

Re: A Sort Optimization Technique: decorate-sort-dedecorate

2006-08-30 Thread neoedmund
yeah, java also have 2 interface, Comparator and Comparable, which equal to python's compareTo() and __cmp__() Marc 'BlackJack' Rintsch wrote: > In <[EMAIL PROTECTED]>, Tom Cole wrote: > > > In Java, classes can implement the Comparable interface. This interface > > contains only one method, a com

Re: The lib email parse problem...

2006-08-30 Thread neoedmund
myself wrote a multipart parser in java(i customise it because i need get information of "upload progress"). and i think it's also easy to implement in python, i've not have time done it, or i'll post it. but if you're no other special needs, just use email lib, it's quick to program and if you rea

help with unicode email parse

2006-09-07 Thread neoedmund
i want to get the subject from email and construct a filename with the subject. but tried a lot, always got error like this: UnicodeDecodeError: 'ascii' codec can't decode byte 0xe9 in position 4: ordinal not in range(128) msg = email.message_from_string( text ) title = decode_hea

Re: help with unicode email parse

2006-09-07 Thread neoedmund
;ascii' codec can't decode byte 0xe6 in position 0: ordinal not in range(128) So "str"%(param) not accept unicode, only accept byte array? John Machin wrote: > neoedmund wrote: > > i want to get the subject from email and construct a filename with the > > s

what is java's System.currentTimeMillis() in python

2006-09-07 Thread neoedmund
/** * Returns the current time in milliseconds. Note that * while the unit of time of the return value is a millisecond, * the granularity of the value depends on the underlying * operating system and may be larger. For example, many * operating systems measure time

Re: help with unicode email parse

2006-09-07 Thread neoedmund
nt s return unicode( s ) #print repr( getStamp() ) def test(): subject = decode_header( "=?UTF-8?B?5rWL6K+V?=" ) print "s1=", repr( subject ) t1 = subject[0][0] print "t1=", repr( t1 ) fn = "%s/%s-%s.mail"%( &

Re: I'm looking for an intelligent date conversion module

2006-12-16 Thread neoedmund
I'm more familiar with java. maybe java.util.Calendar can be port to python? i donnt know. mthorley のメッセージ: > Greetings, I'm looking for a python module that will take a datetime > obj and convert it into relative time in english. > For example: 10 minutes ago, 1 Hour ago, Yesterday, A few day a

newbie question: any better way to write this code?

2006-12-27 Thread neoedmund
i want to let a byte array to be xor with some value. but code show below i wrote seems not so .. good..., any better way to write such function? thanks. [code] def xor(buf): bout=[] for i in range(len(buf)): x = ord(buf[i]) x ^= 123 b

Re: unexpected behavior: did i create a pointer?

2007-09-10 Thread neoedmund
On Sep 7, 4:07 pm, gu <[EMAIL PROTECTED]> wrote: > hi to all! > after two days debugging my code, i've come to the point that the > problem was caused by an unexpected behaviour of python. or by lack of > some information about the program, of course! i've stripped down the > code to reproduce the

confusing UnboundLocalError behaive

2009-02-23 Thread neoedmund
see the 3 small piece of code, i cannot understand why it result as this. 1. def test(): abc="111" def m1(): print(abc) m1() test() Output: 111 2. def test(): abc="111" def m1(): print(abc) abc+="222"

newbie question: how to run a python file if it is in a package

2008-09-05 Thread neoedmund
for example: X.py is in aaa.bbb and it has a line like "import aaa.bbb.Y" how can I run X.py avoiding it saying such like "ImportError: No module named aaa.bbb"? Is all runnable script must be in the default package? thanks. -- http://mail.python.org/mailman/listinfo/python-list

Re: newbie question: how to run a python file if it is in a package

2008-09-05 Thread neoedmund
On Sep 5, 8:12 pm, "Diez B. Roggisch" <[EMAIL PROTECTED]> wrote: > neoedmund schrieb: > > > for example: > > > X.py is in aaa.bbb and it has a line like "import aaa.bbb.Y" > > how can I run X.py avoiding it saying such like "ImportError: