Re: python vs. grep

2008-05-06 Thread Wojciech Walczak
2008/5/6, Anton Slesarev <[EMAIL PROTECTED]>: > But I have some problem with writing performance grep analog. [...] > Python code 3-4 times slower on windows. And as I remember on linux > the same situation... > > Buffering in open even increase time. > > Is it possible to increase file readin

Re: #!/usr/bin/env python vs. #!/usr/bin/python

2008-05-06 Thread Wojciech Walczak
2008/5/6, Ben Finney <[EMAIL PROTECTED]>: > > > So why not put symlink to Python over there on all machines, if > > > we can put one (or env itself) there ? > > To avoid linking all the rest of interpreters like perl, ruby, lua > > and dozens of others. > The argument was being made from "thou

Re: #!/usr/bin/env python vs. #!/usr/bin/python

2008-05-06 Thread Wojciech Walczak
2008/5/6, Banibrata Dutta <[EMAIL PROTECTED]>: > > Use /usr/bin/env. If env is not in /usr/bin, put a link to it there. > > So why not put symlink to Python over there on all machines, if we can > put one (or env itself) there ? To avoid linking all the rest of interpreters like perl, ruby, lu

Re: Decimal vs Float comparasion

2008-05-05 Thread Wojciech Walczak
2008/5/6, Wojciech Walczak <[EMAIL PROTECTED]>: > a > 9.0 returns True because NotImplemented > 9.0 returns True. > a < 9.0 returns False because NotImplemented < 9.0 returns False. Sorry, it should rather be: Decimal('0.5') > 9

Re: Decimal vs Float comparasion

2008-05-05 Thread Wojciech Walczak
2008/5/6, Yuan HOng <[EMAIL PROTECTED]>: > It seems decimal object will always be larger than float in > comparasion, which goes against common sense: > > >>> from decimal import Decimal > >>> a = Decimal('0.5') > >>> a > 9 > False > >>> a > 9.0 > True > > It seems to me that rathe

Re: pygame music, cant read mp3?

2008-05-05 Thread Wojciech Walczak
2008/5/5, globalrev <[EMAIL PROTECTED]>: > pygame.mixer.music.load('C:/Python25/myPrograms/pygameProgs/example1.mp3') Are you sure that: os.path.exists('C:/Python25/myPrograms/pygameProgs/example1.mp3') == True? Check it with python. -- Regards, Wojtek Walczak http://www.stud.umk.pl/~wojtekwa

Re: confused about self, why not a reserved word?

2008-05-05 Thread Wojciech Walczak
2008/5/5, globalrev <[EMAIL PROTECTED]>: > class Foo(object): > def Hello(self): > print "hi" > > object is purple, ie some sort of reserved word. > > why is self in black(ie a normal word) when it has special powers. > replacing it with sel for example will cause an erro

Re: Determine socket family at runtime

2008-05-04 Thread Wojciech Walczak
2008/5/4, Giampaolo Rodola' <[EMAIL PROTECTED]>: > For now I've been able to determine the family by using: > > # self.socket = a connected socket.socket instance > ip, port = self.socket.getsockname()[0:2] > af = socket.getaddrinfo(ip, port)[0][0] > > ...but I'd like to know if some other sol