Re: How to display unicode with the CGI module?

2007-11-24 Thread Marc 'BlackJack' Rintsch
On Sat, 24 Nov 2007 15:58:56 -0800, coldpizza wrote: > The problem I am having is that I get an error while trying to display > Unicode UTF-8 characters via a Python CGI script. > > The error goes like this: "UnicodeEncodeError: 'ascii' codec can't > encode character u'\u026a' in position 12: ord

Running unmodified CGI scripts persistently under mod_wsgi.

2007-11-24 Thread Graham Dumpleton
On Nov 23, 8:49 am, Graham Dumpleton <[EMAIL PROTECTED]> wrote: > On Nov 23, 4:00 am, Istvan Albert <[EMAIL PROTECTED]> wrote: > > > > > On Nov 21, 12:15 am, Graham Dumpleton <[EMAIL PROTECTED]> > > wrote: > > > > I would say that that is now debatable. Overall mod_wsgi is probably a > > > better p

Re: Disk Space Script

2007-11-24 Thread MonkeeSage
On Nov 24, 11:46 am, "[EMAIL PROTECTED]" <[EMAIL PROTECTED]> wrote: > I would like to write a script in Python to email me when disk space > gets below a certain value. OK, I'll give you the easy way using your example and popen, and then a more complex example that doesn't rely on df/grep/awk an

Hi I am anuusha 21years of student... find your love r here www.loverguru.blogspot.com

2007-11-24 Thread anuusha122
Hi I am anuusha 21years of student... find your lover here www.loverguru.blogspot.com -- http://mail.python.org/mailman/listinfo/python-list

Re: Catching a segfault in a Python library

2007-11-24 Thread Donn Ingle
MrJean1 wrote: > Try catching SIGSEGV using the Python signal module > > An example (for SIGALRM) is on the next page > > However, it may not work since a SIGSEGV fault is pretty much the end > of everything T

Re: Catching a segfault in a Python library

2007-11-24 Thread Donn Ingle
Paul Rubin wrote: > then maybe your trap-and-restart approach can keep things usable for a > while. Trap and restart gracefully is the road I want to take. If my app (FP) chokes on a font (it will have made a note before doing what kills it, because I know the 'danger' areas ) and then will die. Th

Re: OPLC purchase period extended

2007-11-24 Thread Aahz
In article <[EMAIL PROTECTED]>, David Boddie <[EMAIL PROTECTED]> wrote: >On Sat Nov 24 19:30:03 CET 2007, Grant Edwards wrote: >> >> The XO laptop comes with a built-in Python IDE, so everybody on >> c.l.p ought to have one... > >A nice idea in theory, but... > > 2. XO laptops will be shipped onl

Re: How can I create customized classes that have similar properties as 'str'?

2007-11-24 Thread George Sakkis
On Nov 24, 7:42 pm, Steven D'Aprano > > To the OP: yes, your use case is quite valid; the keyword you are > > looking for is "memoize". You can find around a dozen of recipes in the > > Cookbook and posted in this list; here's one starting point: > >http://aspn.activestate.com/ASPN/Cookbook/Python

Re: OPLC purchase period extended

2007-11-24 Thread Aahz
In article <[EMAIL PROTECTED]>, Grant Edwards <[EMAIL PROTECTED]> wrote: > >The most imporant thing is that the "control" key is to the left of the >"A" keay where god intened. Not too surprising when you realized the >design was headed by folks from the media lab at MIT. MIT requires >everybody

Re: the annoying, verbose self

2007-11-24 Thread Paul McGuire
For these localized initialization blocks, I don't see anything wrong with: _ = self _.var1 = 5 _.var2 = "a value" _.var3 = stuff _.var4 = [2,54,7,7] _.var5 = "dingaling" _.var6 = 6.4 _.var7 = 1 _.var8 = False _.var9 = True Or if you wanted to simulate something like using or with: for _ in [sel

Re: OPLC purchase period extended

2007-11-24 Thread David Boddie
On Sat Nov 24 19:30:03 CET 2007, Grant Edwards wrote: > The XO laptop comes with a built-in Python IDE, so everybody on > c.l.p ought to have one... A nice idea in theory, but... 2. XO laptops will be shipped only to G1G1 participants and only to the street addresses they provide for themsel

Re: How can I create customized classes that have similar properties as 'str'?

2007-11-24 Thread Hrvoje Niksic
Steven D'Aprano <[EMAIL PROTECTED]> writes: > On Sun, 25 Nov 2007 01:38:51 +0100, Hrvoje Niksic wrote: > >> samwyse <[EMAIL PROTECTED]> writes: >> >>> create a hash that maps your keys to themselves, then use the values of >>> that hash as your keys. >> >> The "atom" function you describe alread

Re: How can I create customized classes that have similar properties as 'str'?

2007-11-24 Thread Steven D'Aprano
On Sun, 25 Nov 2007 01:38:51 +0100, Hrvoje Niksic wrote: > samwyse <[EMAIL PROTECTED]> writes: > >> create a hash that maps your keys to themselves, then use the values of >> that hash as your keys. > > The "atom" function you describe already exists under the name "intern". Not really. intern(

Re: OPLC purchase period extended

2007-11-24 Thread Grant Edwards
>>I've ordered mine, but I still haven't gotten an answer on how to sign >>up for the year of free T-Mobile WiFi access that's included in the >>offer. The T-Mobile site says you need a PIN from your "confirmation >>letter". I never I've gotten neither a confirmation letter nor a >>response to th

Re: How can I create customized classes that have similar properties as 'str'?

2007-11-24 Thread Hrvoje Niksic
samwyse <[EMAIL PROTECTED]> writes: > create a hash that maps your keys to themselves, then use the values > of that hash as your keys. The "atom" function you describe already exists under the name "intern". -- http://mail.python.org/mailman/listinfo/python-list

Re: How can I create customized classes that have similar properties as 'str'?

2007-11-24 Thread Steven D'Aprano
On Sat, 24 Nov 2007 14:58:50 -0800, George Sakkis wrote: > On Nov 24, 4:59 pm, Steven D'Aprano > > <[EMAIL PROTECTED]> wrote: >> On Sat, 24 Nov 2007 03:44:59 -0800, Licheng Fang wrote: >> > On Nov 24, 7:05 pm, Bjoern Schliessmann > > [EMAIL PROTECTED]> wrote: >> >> Licheng Fang wrote: >> >> > I f

How to display unicode with the CGI module?

2007-11-24 Thread coldpizza
Hi! I am using the built-in Python web server (CGIHTTPServer) to serve pages via CGI. The problem I am having is that I get an error while trying to display Unicode UTF-8 characters via a Python CGI script. The error goes like this: "UnicodeEncodeError: 'ascii' codec can't encode character u'\u02

Re: the annoying, verbose self

2007-11-24 Thread greg
samwyse wrote: > Later, I inevitably decide to encapsulate it inside a class, which > means lots of source changes to change my function into a method You'd be better off changing your design habits to make things into classes from the beginning if you suspect you may want it that way later. -- G

Re: the annoying, verbose self

2007-11-24 Thread greg
Patrick Mullen wrote: > Sometimes I actually use a dictionary, but typing all of the quotes > for the keys gets old. If the keys are all identifiers, you can use keyword args to the dict constructor. So you could write self.__dict__.update(dict(var1 = 5, var2 = "a value", var3 = stuff))

Re: the annoying, verbose self

2007-11-24 Thread greg
samwyse wrote: > so you might instead > add 'as' clauses as an alternate way to reduce confusion: > using myclass.new() as p: > > p.do_something() > p.something_else() or even p = myclass.new() p.do_something() p.something_else() Doesn't even need any new syntax. :

Re: Disk Space Script

2007-11-24 Thread Erik Max Francis
[EMAIL PROTECTED] wrote: > I would like to write a script in Python to email me when disk space > gets below a certain value. > > My first question (I'm sure of many) is how do get this output into a > dictionary or list to index the values? Read it in line by line with os.popen, or one of the m

Re: How can I create customized classes that have similar properties as 'str'?

2007-11-24 Thread Bjoern Schliessmann
Steven D'Aprano wrote: > No advantage? That's for sure. There is no is_ attribute of > generic classes, and even if there was, it would have no special > meaning. Argl, I confused the operator module's attributes with objects ;) Regards, Björn -- BOFH excuse #378: Operators killed by year

Re: How can I create customized classes that have similar properties as 'str'?

2007-11-24 Thread George Sakkis
On Nov 24, 4:59 pm, Steven D'Aprano <[EMAIL PROTECTED]> wrote: > On Sat, 24 Nov 2007 03:44:59 -0800, Licheng Fang wrote: > > On Nov 24, 7:05 pm, Bjoern Schliessmann > [EMAIL PROTECTED]> wrote: > >> Licheng Fang wrote: > >> > I find myself frequently in need of classes like this for two > >> > rea

Re: Installing modules via setuptools in a script

2007-11-24 Thread Robert Kern
Thorsten Kampe wrote: > Hi, > > can anyone give me a short code snippet how to install a missing > module via setuptools (assuming setuptools is already installed)?! > > Something like this: > > try: > import missing_module > except import_error > import setuptools > setuptools.wha

Re: How can I create customized classes that have similar properties as 'str'?

2007-11-24 Thread Steven D'Aprano
On Sat, 24 Nov 2007 12:00:25 +0100, Bjoern Schliessmann wrote: > Licheng Fang wrote: >> I mean, all the class instances that equal to each other should be >> reduced into only one instance, which means for instances of this class >> there's no difference between a is b and a==b. > > If you only w

Re: How can I create customized classes that have similar properties as 'str'?

2007-11-24 Thread Steven D'Aprano
On Sat, 24 Nov 2007 04:54:43 -0800, samwyse wrote: > create a hash that maps your keys to themselves, then use the values of > that hash as your keys. > store = {} def atom(str): > global store > if str not in store: > store[str] = str > return store[str]

Re: How can I create customized classes that have similar properties as 'str'?

2007-11-24 Thread Steven D'Aprano
On Sat, 24 Nov 2007 03:44:59 -0800, Licheng Fang wrote: > On Nov 24, 7:05 pm, Bjoern Schliessmann [EMAIL PROTECTED]> wrote: >> Licheng Fang wrote: >> > I find myself frequently in need of classes like this for two >> > reasons. First, it's efficient in memory. >> >> Are you using millions of obje

Re: Disk Space Script

2007-11-24 Thread kyosohma
On Nov 24, 2:20 pm, "[EMAIL PROTECTED]" <[EMAIL PROTECTED]> wrote: > On Nov 24, 2:11 pm, [EMAIL PROTECTED] wrote: > > > > > On Nov 24, 11:46 am, "[EMAIL PROTECTED]" <[EMAIL PROTECTED]> > > wrote: > > > > Hello all, > > > > I would like to write a script in Python to email me when disk space > > > g

Re: the annoying, verbose self

2007-11-24 Thread Paul Boddie
On 24 Nov, 20:10, "Patrick Mullen" <[EMAIL PROTECTED]> wrote: > > Yes, that's no good. So you would write it like so: > > def meth(self,*args): > tmp = int(raw_input('Enter age:')) > using self: > age = tmp > > Still an unnecessary lookup on tmp though :) Indeed. As has been menti

Re: Catching a segfault in a Python library

2007-11-24 Thread Paul Rubin
Donn Ingle <[EMAIL PROTECTED]> writes: > runapp > result = runActualApp( ) > while True: > if result == allokay: break > else: > > > Unless a segfault goes through that too, like Krypton through Superman. No you can't do it that way, when I say "run it under a debugger", I mean run the

Re: Disk Space Script

2007-11-24 Thread [EMAIL PROTECTED]
On Nov 24, 2:11 pm, [EMAIL PROTECTED] wrote: > On Nov 24, 11:46 am, "[EMAIL PROTECTED]" <[EMAIL PROTECTED]> > wrote: > > > > > Hello all, > > > I would like to write a script in Python to email me when disk space > > gets below a certain value. > > > My first question (I'm sure of many) is how do g

Re: OPLC purchase period extended

2007-11-24 Thread Aahz
In article <[EMAIL PROTECTED]>, Grant Edwards <[EMAIL PROTECTED]> wrote: > >I've ordered mine, but I still haven't gotten an answer on how to sign >up for the year of free T-Mobile WiFi access that's included in the >offer. The T-Mobile site says you need a PIN from your "confirmation >letter".

Re: Catching a segfault in a Python library

2007-11-24 Thread MrJean1
Try catching SIGSEGV using the Python signal module An example (for SIGALRM) is on the next page However, it may not work since a SIGSEGV fault is pretty much the end of everything :-( /Jean Brouwers

Re: Refreshing GridBagSizer

2007-11-24 Thread kyosohma
On Nov 23, 12:48 pm, Steve S <[EMAIL PROTECTED]> wrote: > Hey guys, > > I'm stuck with using a GridBagSizer (wxPython) in a GUI Dialog and am having > a frustrating time with refreshing it properly. > > Essentially, I've got to refresh the contents of the GridBagSizer on > occasion with new values.

Re: Disk Space Script

2007-11-24 Thread kyosohma
On Nov 24, 11:46 am, "[EMAIL PROTECTED]" <[EMAIL PROTECTED]> wrote: > Hello all, > > I would like to write a script in Python to email me when disk space > gets below a certain value. > > My first question (I'm sure of many) is how do get this output into a > dictionary or list to index the values?

Re: the annoying, verbose self

2007-11-24 Thread Patrick Mullen
On 24 Nov 2007 13:56:37 GMT, Marc 'BlackJack' Rintsch <[EMAIL PROTECTED]> wrote: > So:: > > def meth(self): > using self: > tmp = raw_input('Enter age: ') > age = int(tmp) > > becomes:: > > def meth(self): > using self: > self.tmp = self.

Re: OPLC purchase period extended

2007-11-24 Thread Grant Edwards
On 2007-11-24, Aahz <[EMAIL PROTECTED]> wrote: > Apparently demand has been such that you can buy an OLPC > through the end of the year: > > http://www.laptopgiving.org/en/index.php I've ordered mine, but I still haven't gotten an answer on how to sign up for the year of free T-Mobile WiFi access

OPLC purchase period extended

2007-11-24 Thread Aahz
Apparently demand has been such that you can buy an OLPC through the end of the year: http://www.laptopgiving.org/en/index.php -- Fortune cookie: "Focus on the color purple this week to bring you luck" -- http://mail.python.org/mailman/listinfo/python-list

Re: the annoying, verbose self

2007-11-24 Thread Ton van Vliet
On 24 Nov 2007 16:07:18 GMT, Duncan Booth <[EMAIL PROTECTED]> wrote: >Ton van Vliet <[EMAIL PROTECTED]> wrote: > >> It would boil down to choice: explicit/speed vs implicit/readability > >No, it would boil down to explicit+speed+readability+maintainability vs >implicit+error prone. It would not

Compile Cheetah Template on Windows

2007-11-24 Thread brianrpsgt1
Newbie here I have been able to successful pull info from a MySQL DB, get the results and output them in an HTML format using Cheetah to the screen using IDLE. I am doing this on a Windows Laptop, running WinXP, Python 2.5 and the latest version of Cheetah. I have two questions: 1. How and w

Disk Space Script

2007-11-24 Thread [EMAIL PROTECTED]
Hello all, I would like to write a script in Python to email me when disk space gets below a certain value. My first question (I'm sure of many) is how do get this output into a dictionary or list to index the values? import os os.system("df -x cifs -x iso9660 | grep -E ^/dev | awk '{ print $1,$

Re: How can I create customized classes that have similar properties as 'str'?

2007-11-24 Thread samwyse
On Nov 24, 5:44 am, Licheng Fang <[EMAIL PROTECTED]> wrote: > Yes, millions. In my natural language processing tasks, I almost > always need to define patterns, identify their occurrences in a huge > data, and count them. Say, I have a big text file, consisting of > millions of words, and I want to

Re: How can I create customized classes that have similar properties as 'str'?

2007-11-24 Thread samwyse
On Nov 24, 10:35 am, Licheng Fang <[EMAIL PROTECTED]> wrote: > Thanks. Then, is there a way to make python treat all strings this > way, or any other kind of immutable objects? The word generally used is 'atom' when referring to strings that are set up such that 'a == b' implies 'a is b'. This is

Re: How do I convert escaped HTML into a string?

2007-11-24 Thread Bruno Desthuilliers
Stefan Behnel a écrit : > [EMAIL PROTECTED] wrote: > >>On 24 Nov, 05:42, "Just Another Victim of the Ambient Morality" >><[EMAIL PROTECTED]> wrote: >> >> >>>I did find some people who complained about this and rolled their own >>>solution but I refuse to believe that Python doesn't have a built-in

Re: mod_python

2007-11-24 Thread Bruno Desthuilliers
Vernon Wenberg III a écrit : > Why do I receive a "File not found" error on a perfect good and simple > script but properly receive errors when I deliberately add errors in the > script? The file is there, it just doesn't do anything. > > Any help would be appreciated. Sorry, my crystal ball is

Re: How can I create customized classes that have similar properties as 'str'?

2007-11-24 Thread Bruno Desthuilliers
Licheng Fang a écrit : > I mean, all the class instances that equal to each other should be > reduced into only one instance, which means for instances of this > class there's no difference between a is b and a==b. Here's a Q&D attempt - without any garantee, and to be taylored to your needs. _v

Re: the annoying, verbose self

2007-11-24 Thread samwyse
On Nov 24, 10:07 am, Duncan Booth <[EMAIL PROTECTED]> wrote: > Ton van Vliet <[EMAIL PROTECTED]> wrote: > > > It would boil down to choice: explicit/speed vs implicit/readability > > No, it would boil down to explicit+speed+readability+maintainability vs > implicit+error prone. > > It would mean th

Re: the annoying, verbose self

2007-11-24 Thread Marc 'BlackJack' Rintsch
On Sat, 24 Nov 2007 08:27:56 -0800, samwyse wrote: > On Nov 24, 7:50 am, Marc 'BlackJack' Rintsch <[EMAIL PROTECTED]> wrote: >> On Sat, 24 Nov 2007 02:54:27 -0800, samwyse wrote: >> > On Nov 24, 4:07 am, Marc 'BlackJack' Rintsch <[EMAIL PROTECTED]> wrote: >> >> On Sat, 24 Nov 2007 01:55:38 -0800,

Re: How can I create customized classes that have similar properties as 'str'?

2007-11-24 Thread Licheng Fang
On Nov 24, 9:42 pm, Marc 'BlackJack' Rintsch <[EMAIL PROTECTED]> wrote: > On Sat, 24 Nov 2007 13:40:40 +0100, Bjoern Schliessmann wrote: > > Licheng Fang wrote: > >> On Nov 24, 7:05 pm, Bjoern Schliessmann > >> Wow, I didn't know this. But exactly how Python manage these > >> strings? > > > I don'

Re: the annoying, verbose self

2007-11-24 Thread samwyse
On Nov 24, 7:50 am, Marc 'BlackJack' Rintsch <[EMAIL PROTECTED]> wrote: > On Sat, 24 Nov 2007 02:54:27 -0800, samwyse wrote: > > On Nov 24, 4:07 am, Marc 'BlackJack' Rintsch <[EMAIL PROTECTED]> wrote: > >> On Sat, 24 Nov 2007 01:55:38 -0800, samwyse wrote: > >> > I've had the same thought, along wi

Re: the annoying, verbose self

2007-11-24 Thread Duncan Booth
Ton van Vliet <[EMAIL PROTECTED]> wrote: > It would boil down to choice: explicit/speed vs implicit/readability No, it would boil down to explicit+speed+readability+maintainability vs implicit+error prone. It would mean that as well as the interpreter having to search the instance to work out

Re: How do I convert escaped HTML into a string?

2007-11-24 Thread Stefan Behnel
[EMAIL PROTECTED] wrote: > On 24 Nov, 05:42, "Just Another Victim of the Ambient Morality" > <[EMAIL PROTECTED]> wrote: > >> I did find some people who complained about this and rolled their own >> solution but I refuse to believe that Python doesn't have a built-in >> solution to what must be a v

Re: the annoying, verbose self

2007-11-24 Thread Ton van Vliet
On 24 Nov 2007 13:56:37 GMT, Marc 'BlackJack' Rintsch <[EMAIL PROTECTED]> wrote: >On Sat, 24 Nov 2007 14:09:04 +0100, Ton van Vliet wrote: > >> On 24 Nov 2007 08:48:30 GMT, Marc 'BlackJack' Rintsch <[EMAIL PROTECTED]> >> wrote: >> >>>On Sat, 24 Nov 2007 09:12:34 +0100, Ton van Vliet wrote: >>> >>

existence of a program

2007-11-24 Thread Navid Parvini
Dear All, Would you please tell me that how can I check for existence of a program (for example Perl) on Windows and Linux by a Python code? Thank you in advance. Navid - Be a better sports nut! Let your teams follow you with Yahoo Mobile. Try

Re: Catching a segfault in a Python library

2007-11-24 Thread Donn Ingle
> I think the idea is, certain fonts in his collection may be corrupt, > and he wants to just scan through and load them, ignoring the ones > that make the program crash.   Ya got me! Sheesh, I can't hide anywhere :D > The bug in this case lies with a third > party and isn't something he can easi

Re: the annoying, verbose self

2007-11-24 Thread Marc 'BlackJack' Rintsch
On Sat, 24 Nov 2007 14:09:04 +0100, Ton van Vliet wrote: > On 24 Nov 2007 08:48:30 GMT, Marc 'BlackJack' Rintsch <[EMAIL PROTECTED]> > wrote: > >>On Sat, 24 Nov 2007 09:12:34 +0100, Ton van Vliet wrote: >> >>> Just bringing up something I sometimes miss from good-old Turbo-Pascal >>> here, which

Re: the annoying, verbose self

2007-11-24 Thread Marc 'BlackJack' Rintsch
On Sat, 24 Nov 2007 02:54:27 -0800, samwyse wrote: > On Nov 24, 4:07 am, Marc 'BlackJack' Rintsch <[EMAIL PROTECTED]> wrote: >> On Sat, 24 Nov 2007 01:55:38 -0800, samwyse wrote: >> > I've had the same thought, along with another. You see, on of my pet >> > peeves about all OO languages that that

Re: the annoying, verbose self

2007-11-24 Thread Colin J. Williams
Kay Schluehr wrote: > Colin J. Williams schrieb: >> Kay Schluehr wrote: >>> On Nov 22, 8:43 pm, Bruno Desthuilliers >>> <[EMAIL PROTECTED]> wrote: Colin J. Williams a écrit : > [EMAIL PROTECTED] wrote: >> Alexy: >>> Sometimes I >>> avoid OO just not to deal with

Re: How can I create customized classes that have similar properties as 'str'?

2007-11-24 Thread Marc 'BlackJack' Rintsch
On Sat, 24 Nov 2007 13:40:40 +0100, Bjoern Schliessmann wrote: > Licheng Fang wrote: >> On Nov 24, 7:05 pm, Bjoern Schliessmann >> Wow, I didn't know this. But exactly how Python manage these >> strings? > > I don't know (use the source, Luke). :) Or perhaps there is a Python > Elder here that

Installing modules via setuptools in a script

2007-11-24 Thread Thorsten Kampe
Date: Fri, 23 Nov 2007 19:35:21 - Message-ID: <[EMAIL PROTECTED]> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit User-Agent: MicroPlanet-Gravity/2.70.2067 Hi, can anyone give me a short code snippet how to install a missing module via setuptools (

Re: md5 wrongness?

2007-11-24 Thread Ron Johnson
On 11/24/07 02:27, Ayaz Ahmed Khan wrote: > John Machin wrote: >> On Nov 24, 1:34 pm, Ron Johnson <[EMAIL PROTECTED]> wrote: >>> Why do Python's md5 and GNU md5sum produce differing results? >> They don't differ. Try feeding them the same input: >> > import md5 > md5.new('snagglefrob').hexd

Re: How do I convert escaped HTML into a string?

2007-11-24 Thread leej
On 24 Nov, 05:42, "Just Another Victim of the Ambient Morality" <[EMAIL PROTECTED]> wrote: > I did find some people who complained about this and rolled their own > solution but I refuse to believe that Python doesn't have a built-in > solution to what must be a very common problem. Replace "py

Re: the annoying, verbose self

2007-11-24 Thread Ton van Vliet
On 24 Nov 2007 08:48:30 GMT, Marc 'BlackJack' Rintsch <[EMAIL PROTECTED]> wrote: >On Sat, 24 Nov 2007 09:12:34 +0100, Ton van Vliet wrote: > >> Just bringing up something I sometimes miss from good-old Turbo-Pascal >> here, which has the WITH statement to reduce the typing overhead with >> (long)

Re: How can I create customized classes that have similar properties as 'str'?

2007-11-24 Thread samwyse
On Nov 24, 5:44 am, Licheng Fang <[EMAIL PROTECTED]> wrote: > Yes, millions. In my natural language processing tasks, I almost > always need to define patterns, identify their occurrences in a huge > data, and count them. [...] So I end up with unnecessary > duplicates of keys. And this can be a gr

Re: How can I create customized classes that have similar properties as 'str'?

2007-11-24 Thread Bjoern Schliessmann
Licheng Fang wrote: > On Nov 24, 7:05 pm, Bjoern Schliessmann > BTW, what happens if you, by some operation, make a == b, and >> afterwards change b so another object instance must be created? >> This instance management is quite a runtime overhead. > > I probably need this class to be immutable.

Re: How can I create customized classes that have similar properties as 'str'?

2007-11-24 Thread Licheng Fang
On Nov 24, 7:05 pm, Bjoern Schliessmann wrote: > Licheng Fang wrote: > > I find myself frequently in need of classes like this for two > > reasons. First, it's efficient in memory. > > Are you using millions of objects, or MB size objects? Otherwise, > this is no argument. Yes, millions. In my na

Re: How can I create customized classes that have similar properties as 'str'?

2007-11-24 Thread Bjoern Schliessmann
Licheng Fang wrote: > I find myself frequently in need of classes like this for two > reasons. First, it's efficient in memory. Are you using millions of objects, or MB size objects? Otherwise, this is no argument. BTW, what happens if you, by some operation, make a == b, and afterwards change b

Re: the annoying, verbose self

2007-11-24 Thread jakub silar
BJörn Lindqvist wrote: > On Nov 22, 2007 2:08 PM, Colin J. Williams <[EMAIL PROTECTED]> wrote: > >>[EMAIL PROTECTED] wrote: >> >>>Alexy: >>> Sometimes I avoid OO just not to deal with its verbosity. In fact, I try to use Ruby anywhere speed is not crucial especially for @ prefix is be

Re: How can I create customized classes that have similar properties as 'str'?

2007-11-24 Thread Bjoern Schliessmann
Licheng Fang wrote: > I mean, all the class instances that equal to each other should be > reduced into only one instance, which means for instances of this > class there's no difference between a is b and a==b. If you only want that if "a == b" is True also "a is b" is True, overload the is_ attr

Re: the annoying, verbose self

2007-11-24 Thread samwyse
On Nov 24, 4:07 am, Marc 'BlackJack' Rintsch <[EMAIL PROTECTED]> wrote: > On Sat, 24 Nov 2007 01:55:38 -0800, samwyse wrote: > > I've had the same thought, along with another. You see, on of my pet > > peeves about all OO languages that that when creating new code, I > > generally begin by writing

Re: Code Management

2007-11-24 Thread BlueBird
On Nov 21, 7:05 am, "Sergio Correia" <[EMAIL PROTECTED]> wrote: > As a side note, I find much easier to drop a PTH file than messing > with pythonpath. If you are not familiar with PTH files, what I do is > this > > 1) Go to "C:\Program Files\Python25\Lib\site-packages" or whatever is > appropiate

Re: How can I create customized classes that have similar properties as 'str'?

2007-11-24 Thread Licheng Fang
I find myself frequently in need of classes like this for two reasons. First, it's efficient in memory. Second, when two instances are compared for equality only their pointers are compared. (I think that's how Python compares 'str's. On Nov 24, 6:31 pm, Licheng Fang <[EMAIL PROTECTED]> wrote: > I

How can I create customized classes that have similar properties as 'str'?

2007-11-24 Thread Licheng Fang
I mean, all the class instances that equal to each other should be reduced into only one instance, which means for instances of this class there's no difference between a is b and a==b. Thank you. -- http://mail.python.org/mailman/listinfo/python-list

Re: Custom Tkinter scrollbar

2007-11-24 Thread Hunter . lennon
I ended up giving up on doing the scrollbar as a separate class, which is probably for the best. This is the pertinent code for what I wanted, and it does what I need it to do. I found the canvas-moving-w- mouse.py program helpful in getting started with this; some of the code is directly from th

see the jop

2007-11-24 Thread roja
see the jop http://earnmac.blogspot.com -- http://mail.python.org/mailman/listinfo/python-list

setting attributes on external types (was Re: eof)

2007-11-24 Thread samwyse
On Nov 23, 2:06 am, greg <[EMAIL PROTECTED]> wrote: > There's a fair amount of overhead associated with providing > the ability to set arbitrary attributes on an object, which > is almost never wanted for built-in types, so it's not > provided by default. > > You can easily get it if you want it by

see the jop

2007-11-24 Thread roja
see the jop http://earnmac.blogspot.com -- http://mail.python.org/mailman/listinfo/python-list

Re: the annoying, verbose self

2007-11-24 Thread Marc 'BlackJack' Rintsch
On Sat, 24 Nov 2007 01:55:38 -0800, samwyse wrote: > I've had the same thought, along with another. You see, on of my pet > peeves about all OO languages that that when creating new code, I > generally begin by writing something like this: > > cat = 'felix' > dog = 'rover' > def example(): > g

Re: the annoying, verbose self

2007-11-24 Thread samwyse
On Nov 23, 7:16 pm, "Patrick Mullen" <[EMAIL PROTECTED]> wrote: > Most of the time self doesn't bother me in the slightest. The one > time it does bother me however, is when I am turning a function into a > method. In this case, often I have many local variables which I > actually want to be inst

Re: the annoying, verbose self

2007-11-24 Thread Patrick Mullen
Ton Van Vliet: > [... using/with ...] This looks like a really nice little construct, and solves my small quirk issue (which has popped up maybe twice in my python experience). It could also be a solution to the OP's problem. The issue of course is disambiguation. Is EVERY name looked up in the

Re: Catching a segfault in a Python library

2007-11-24 Thread Patrick Mullen
On 24 Nov 2007 08:41:24 GMT, Ayaz Ahmed Khan <[EMAIL PROTECTED]> wrote: > Donn Ingle wrote: > > Already done, the code within PIL is causing the crash. It gets ugly and > > out of my remit. It's a freetype/Pil thing and I simply want to a way to > > catch it when it happens. > > Since a segfault e

Re: the annoying, verbose self

2007-11-24 Thread Marc 'BlackJack' Rintsch
On Sat, 24 Nov 2007 09:12:34 +0100, Ton van Vliet wrote: > Just bringing up something I sometimes miss from good-old Turbo-Pascal > here, which has the WITH statement to reduce the typing overhead with > (long) record/struct prefixes, used like: > > with do begin > a = ... > b = ... > en

Re: Catching a segfault in a Python library

2007-11-24 Thread Ayaz Ahmed Khan
Donn Ingle wrote: > Already done, the code within PIL is causing the crash. It gets ugly and > out of my remit. It's a freetype/Pil thing and I simply want to a way to > catch it when it happens. > Since a segfault ends the process, I am asking about "wrappers" around > code > to catch a segfault

Re: md5 wrongness?

2007-11-24 Thread Ayaz Ahmed Khan
John Machin wrote: > On Nov 24, 1:34 pm, Ron Johnson <[EMAIL PROTECTED]> wrote: >> Why do Python's md5 and GNU md5sum produce differing results? > > They don't differ. Try feeding them the same input: > import md5 md5.new('snagglefrob').hexdigest() > '9eb2459fcdd9f9b8a9fef7348bcac933' >

GREAT VIDEO! >> http://www.tbn.org/films/videos/To_Hell_And_Back.ram << Just click link to view the free video.......... May 22, 2005 7:37:11 pm

2007-11-24 Thread Cris Villavicencio
-- Sent from my T-Mobile Sidekick® -- http://mail.python.org/mailman/listinfo/python-list

Re: the annoying, verbose self

2007-11-24 Thread Ton van Vliet
On Fri, 23 Nov 2007 17:16:25 -0800, "Patrick Mullen" <[EMAIL PROTECTED]> wrote: >Most of the time self doesn't bother me in the slightest. The one >time it does bother me however, is when I am turning a function into a >method. In this case, often I have many local variables which I >actually wa