Re: parsing tab and newline delimited text

2010-08-03 Thread alex23
On Aug 4, 12:14 pm, elsa wrote: > So, an individual entry might have this form (in printed form): > > Title    date   position   data > > with each field separated by tabs, and a newline at the end of data. As James posted, the csv module is ideal for this sort of thing. Dealing with delimited te

Re: Why is python not written in C++ ?

2010-08-03 Thread Neil Hodgson
Grant Edwards: > That said, the last time I looked the Ada spec was only something like > 100 pages long, so a case could be made that it won't take long to > learn. I don't know how long the C++ language spec is, but I'm > betting it's closer to 1000 than 100. The Ada 2012 Language Reference

Re: Global variables problem

2010-08-03 Thread Daniel da Silva
Your problem lies somewhere in the use of the Process class, not with global variables. If you replace your "p = ..." and "p.start()" lines with a direct call to self.handle_connection(), your code works as expected. I don't know much about the multiprocessing module, so I can't really comment on

Re: simple (I hope!) problem

2010-08-03 Thread Daniel da Silva
Why not just add the google app engine lib subdirectories to your python path? On Tue, Aug 3, 2010 at 3:09 AM, Jean-Michel Pichavant < jeanmic...@sequans.com> wrote: > samwyse wrote: > >> I'm writing for the Google app engine and have stubbed my toe yet >> again on a simple obstacle. Non-trivia

Re: Why is python not written in C++ ?

2010-08-03 Thread Paul Rubin
Lawrence D'Oliveiro writes: > I believe the life-support software on the International Space Station is > written in Ada. Would anybody feel happier if that had been done in C++? Take a look at the articles on C bug-finding on Dawson Engler's page: http://www.stanford.edu/~engler/ They are

Re: Loading pyd fails with "The operating system cannot run %1"

2010-08-03 Thread wazza
On Aug 4, 1:39 pm, wazza wrote: > Running python 2.6 (r26:66714)  on Win Xp Pro SP3, I receive the > following message: > python -v -v -v>>> import functions > > . > . > > # trying U:\wss\v72212\components\trm\python\lib\lib\site-packages > \_fk_cl.pyd > #   clear[2] __file__ > #   clear[2] __pack

Re: Why is python not written in C++ ?

2010-08-03 Thread Lawrence D'Oliveiro
In message , Roy Smith wrote: > There are, however, a lot of people who know a large enough subset of > C++ to be productive ... I think there are some language features, knowledge of which has a negative impact on productivity. :) -- http://mail.python.org/mailman/listinfo/python-list

Re: Why is python not written in C++ ?

2010-08-03 Thread Lawrence D'Oliveiro
In message , Grant Edwards wrote: > That said, the last time I looked the Ada spec was only something like > 100 pages long, so a case could be made that it won't take long to > learn. I don't know how long the C++ language spec is, but I'm > betting it's closer to 1000 than 100. I have a copy o

Re: Why is python not written in C++ ?

2010-08-03 Thread Lawrence D'Oliveiro
In message <7xmxt3uo4h@ruckus.brouhaha.com>, Paul Rubin wrote: > It's more verbose than C, so coding in it takes more keystrokes, but it > looks to me like the general coding approach (modulo the extra keystrokes) > should be similar to that of C, Algol, and so on, and the results should > be

Re: Python Script Cannot Write to Directory

2010-08-03 Thread Albert Hopkins
On Tue, 2010-08-03 at 21:01 -0700, Chris Brauchli wrote: > Hi, > > I am writing a script that, at one point, copies a file from directory > A to directory B. Directory B can only be written to by root, but the > script is always called with sudo, so this shouldn't be an issue, but > it is. I have

Re: Global variables problem

2010-08-03 Thread Navkirat Singh
On 04-Aug-2010, at 9:46 AM, Daniel da Silva wrote: > Please post approximate code that actually works and displays the problem. > > On Tue, Aug 3, 2010 at 9:00 PM, Navkirat Singh wrote: > Hey guys, > > I am using a multiprocessing program, where the new process is supposed to > change a vari

Re: Global variables problem

2010-08-03 Thread Daniel da Silva
Please post approximate code that actually works and displays the problem. On Tue, Aug 3, 2010 at 9:00 PM, Navkirat Singh wrote: > Hey guys, > > I am using a multiprocessing program, where the new process is supposed to > change a variable in the main class that it branches out from. This is > s

Python Script Cannot Write to Directory

2010-08-03 Thread Chris Brauchli
Hi, I am writing a script that, at one point, copies a file from directory A to directory B. Directory B can only be written to by root, but the script is always called with sudo, so this shouldn't be an issue, but it is. I have tried using shutil.copy() and calling "sudo cp " with os.popen to no

Re: Why is python not written in C++ ?

2010-08-03 Thread Roy Smith
In article , sturlamolden wrote: > On 4 Aug, 04:41, Grant Edwards wrote: > > > The issue that would prevent its use where I work is the inability to > > hire anybody who knows Ada.  You can't hire anybody who knows C++ > > either, but you can hire lots of people who claim they do.   > > That

Global variables problem

2010-08-03 Thread Navkirat Singh
Hey guys, I am using a multiprocessing program, where the new process is supposed to change a variable in the main class that it branches out from. This is somehow not working, following is an approximate code. Would really appreciate any insight into this matter: var = {} class Something():

Loading pyd fails with "The operating system cannot run %1"

2010-08-03 Thread wazza
Running python 2.6 (r26:66714) on Win Xp Pro SP3, I receive the following message: python -v -v -v >>> import functions . . # trying U:\wss\v72212\components\trm\python\lib\lib\site-packages \_fk_cl.pyd # clear[2] __file__ # clear[2] __package__ # clear[2] __path__ # clear[2] __name__ #

Re: Why is python not written in C++ ?

2010-08-03 Thread Carl Banks
On Aug 3, 7:07 pm, Paul Rubin wrote: > Mozilla is fed up with C++ and seems to be working on its own language, > called Rust: > >    http://lambda-the-ultimate.org/node/4009 That looks much better than Go. It's like all the cool features of Go without the annoying polemics. I'm starting to get t

Re: parsing tab and newline delimited text

2010-08-03 Thread elsa
On Aug 4, 12:49 pm, Tim Chase wrote: > On 08/03/10 21:14, elsa wrote: > > > > > I have a large file of text I need to parse. Individual 'entries' are > > separated by newline characters, while fields within each entry are > > separated by tab characters. > > > So, an individual entry might have th

Re: Trying to set a cookie within a python script

2010-08-03 Thread Νίκος
For the cookie problem iam tryign houts now and even this aint working: cookie = Cookie.SimpleCookie() if os.environ.get('HTTP_COOKIE') and cookie.has_key('visitor') == 'nikos':#if visitor cookie exist print "Cookie Unset" c

Re: Why is python not written in C++ ?

2010-08-03 Thread sturlamolden
On 4 Aug, 04:41, Grant Edwards wrote: > The issue that would prevent its use where I work is the inability to > hire anybody who knows Ada.  You can't hire anybody who knows C++ > either, but you can hire lots of people who claim they do.   That is very true. -- http://mail.python.org/mailma

Re: parsing tab and newline delimited text

2010-08-03 Thread MRAB
elsa wrote: Hi, I have a large file of text I need to parse. Individual 'entries' are separated by newline characters, while fields within each entry are separated by tab characters. So, an individual entry might have this form (in printed form): Titledate position data with each fiel

Re: Why is python not written in C++ ?

2010-08-03 Thread Paul Rubin
Grant Edwards writes: > The issue that would prevent its use where I work is the inability to > hire anybody who knows Ada. ... > That said, the last time I looked the Ada spec was only something like > 100 pages long, so a case could be made that it won't take long to > learn. Well, I don't kn

Re: default behavior

2010-08-03 Thread John Posner
On 8/3/2010 6:48 PM, Ethan Furman wrote: Christian Heimes wrote: I just went and read the entry that had the bogus claim -- personally, I didn't see any confusion. I would like to point out the __missing__ is *not* part of dicts (tested on 2.5 and 2.6 -- don't have 2.7 installed yet). I beg yo

Re: parsing tab and newline delimited text

2010-08-03 Thread Tim Chase
On 08/03/10 21:14, elsa wrote: I have a large file of text I need to parse. Individual 'entries' are separated by newline characters, while fields within each entry are separated by tab characters. So, an individual entry might have this form (in printed form): Titledate position data

Re: Trying to set a cookie within a python script

2010-08-03 Thread MRAB
Νίκος wrote: On 3 Αύγ, 21:00, Dave Angel wrote: A string is an object containing characters. A string literal is one of the ways you create such an object. When you create it that way, you need to make sure the compiler knows the correct encoding, by using the encoding: line at beginning of f

Re: Why is python not written in C++ ?

2010-08-03 Thread Grant Edwards
On 2010-08-04, Paul Rubin wrote: > Grant Edwards writes: > >> Yep, I've installed Gnat a couple times with the intention of playing >> around with it, but there's pretty much zero chance I could sell it >> at the office in place of C/C++ for embedded stuff, > > I wonder what the issues are. The

Re: Trying to set a cookie within a python script

2010-08-03 Thread Benjamin Kaplan
2010/8/3 Νίκος : >>On 3 Αύγ, 21:00, Dave Angel wrote: > >> A string is an object containing characters. A string literal is one of >> the ways you create such an object. When you create it that way, you >> need to make sure the compiler knows the correct encoding, by using the >> encoding: line at

Re: parsing tab and newline delimited text

2010-08-03 Thread James Mills
On Wed, Aug 4, 2010 at 12:14 PM, elsa wrote: > I have a large file of text I need to parse. Individual 'entries' are > separated by newline characters, while fields within each entry are > separated by tab characters. Sounds to me like a job of the csv module. cheers James -- -- James Mills --

parsing tab and newline delimited text

2010-08-03 Thread elsa
Hi, I have a large file of text I need to parse. Individual 'entries' are separated by newline characters, while fields within each entry are separated by tab characters. So, an individual entry might have this form (in printed form): Titledate position data with each field separated by

Re: Why is python not written in C++ ?

2010-08-03 Thread Paul Rubin
Grant Edwards writes: > Yep, I've installed Gnat a couple times with the intention of playing > around with it, but there's pretty much zero chance I could sell it at > the office in place of C/C++ for embedded stuff, I wonder what the issues are. From everything I've heard, it's a pretty good

Re: Why is python not written in C++ ?

2010-08-03 Thread Grant Edwards
On 2010-08-04, Lawrence D'Oliveiro wrote: > In message , Grant Edwards wrote: > >> I've always thought Ada was a pretty nice embedded/systems languages, >> but some of the initial implementations were indede horrible. > > Well, there?s GNAT, the GNU Ada implementation. Seems pretty robust and > c

Re: Trying to set a cookie within a python script

2010-08-03 Thread Νίκος
>On 3 Αύγ, 21:00, Dave Angel wrote: > A string is an object containing characters. A string literal is one of > the ways you create such an object. When you create it that way, you > need to make sure the compiler knows the correct encoding, by using the > encoding: line at beginning of file. m

Re: PIL

2010-08-03 Thread GrayShark
As we seem to be at an impasse with respect to PIL and xpm, I know gimp does support saving as xpm and that gimp has a python language console. Perhaps parvini_na...@yahoo.com, could look to the gimp mailing list for help? Steven On Tue, 03 Aug 2010 01:56:20 -0700, Chris Rebert wrote: > On T

Re: default behavior

2010-08-03 Thread Ethan Furman
Christian Heimes wrote: Perhaps punctuation will help clarify my intent: __missing__ is *not* part of (dict)s, as shown by dir(dict()): Indeed, that's correct. Can we agree, that __missing__ is an optional feature of the dict interface, that can be implemented in subclasses of dict? Absolute

Re: regular expressions and the LOCALE flag

2010-08-03 Thread MRAB
Baz Walter wrote: > On 03/08/10 21:24, MRAB wrote: And, BTW, none of your examples pass a UTF-8 bytestring to re.findall: all those string literals starting with the 'u' prefix are Unicode strings! >>> >>> not sure what you mean by this: if the string was encoded as utf8, >>> '\w' s

Re: default behavior

2010-08-03 Thread Christian Heimes
> Perhaps punctuation will help clarify my intent: > > __missing__ is *not* part of (dict)s, as shown by dir(dict()): Indeed, that's correct. Can we agree, that __missing__ is an optional feature of the dict interface, that can be implemented in subclasses of dict? Christian -- http://mail.pyt

Re: Why is python not written in C++ ?

2010-08-03 Thread Lawrence D'Oliveiro
In message , Grant Edwards wrote: > I've always thought Ada was a pretty nice embedded/systems languages, > but some of the initial implementations were indede horrible. Well, there’s GNAT, the GNU Ada implementation. Seems pretty robust and complete, while offering backward compatibility with s

Re: Air force one shoes ( http://www.brandtrade99.com/

2010-08-03 Thread THE BORG
Now don't all rush, and form an ordery queue PLEASE! We are sure you all want Air force one shoes. -- http://mail.python.org/mailman/listinfo/python-list

Re: The untimely dimise of a weak-reference

2010-08-03 Thread Gregory Ewing
Bruno Desthuilliers wrote: Would be better with : return self.func(obj, *args, *kwds) Thanks -- well spotted! -- Greg -- http://mail.python.org/mailman/listinfo/python-list

Re: regular expressions and the LOCALE flag

2010-08-03 Thread Baz Walter
On 03/08/10 21:24, MRAB wrote: And, BTW, none of your examples pass a UTF-8 bytestring to re.findall: all those string literals starting with the 'u' prefix are Unicode strings! not sure what you mean by this: if the string was encoded as utf8, '\w' still wouldn't match any of the non-ascii cha

Re: Why is python not written in C++ ?

2010-08-03 Thread Martin v. Loewis
> Has it ever been planned to rewrite in C++ the historical implementation > (of course in an object oriented design) ? Around the time Guido coined the term "Python 3000" (i.e. in 2000), he also said at a few occasions that it would be written in C++. He subsequently dropped the idea, for the rea

Re: default behavior

2010-08-03 Thread Ethan Furman
Christian Heimes wrote: I just went and read the entry that had the bogus claim -- personally, I didn't see any confusion. I would like to point out the __missing__ is *not* part of dicts (tested on 2.5 and 2.6 -- don't have 2.7 installed yet). I beg your pardon but you are wrong. __missing__

Re: Why is python not written in C++ ?

2010-08-03 Thread Roy Smith
In article <87aap3uyo7@castleamber.com>, John Bokma wrote: > > Go look at the original claim, the one that you responded to. "It's > > much easier to distribute C libraries than C++ libraries." > > Yup, and if I read it correctly the claim was: and that's why C++ was > not chosen. I doubt

Re: Why is python not written in C++ ?

2010-08-03 Thread Carl Banks
On Aug 3, 3:19 pm, John Bokma wrote: > Carl Banks writes: > > On Aug 3, 2:29 am, John Bokma wrote: > > [..] > > >> But they call both the C libraries in the same way. > > > Go look at the original claim, the one that you responded to.  "It's > > much easier to distribute C libraries than C++ lib

Re: Why is python not written in C++ ?

2010-08-03 Thread Ethan Furman
John Bokma wrote: Ethan Furman writes: John Bokma wrote: Michael Torrie writes: On 08/01/2010 07:09 PM, John Bokma wrote: One thing that comes to mind is that it's much easier to distribute C libraries than C++ libraries. In the beginning of C++ there were programs that just converted

Re: default behavior

2010-08-03 Thread Christian Heimes
> I just went and read the entry that had the bogus claim -- personally, I > didn't see any confusion. I would like to point out the __missing__ is > *not* part of dicts (tested on 2.5 and 2.6 -- don't have 2.7 installed yet). I beg your pardon but you are wrong. __missing__ is available for al

Re: Why is python not written in C++ ?

2010-08-03 Thread John Bokma
Ethan Furman writes: > John Bokma wrote: >> Michael Torrie writes: >> >>> On 08/01/2010 07:09 PM, John Bokma wrote: > One thing that comes to mind is that it's much easier to > distribute C libraries than C++ libraries. In the beginning of C++ there were programs that just converted

Re: default behavior

2010-08-03 Thread Ethan Furman
John Posner wrote: On 7/31/2010 1:31 PM, John Posner wrote: Caveat -- there's another description of defaultdict here: http://docs.python.org/library/collections.html#collections.defaultdict ... and it's bogus. This other description claims that __missing__ is a method of defaultdict, not of

Re: Why is python not written in C++ ?

2010-08-03 Thread John Bokma
Carl Banks writes: > On Aug 3, 2:29 am, John Bokma wrote: [..] >> But they call both the C libraries in the same way. > > Go look at the original claim, the one that you responded to. "It's > much easier to distribute C libraries than C++ libraries." Yup, and if I read it correctly the claim

Re: default behavior

2010-08-03 Thread John Posner
On 8/3/2010 5:47 PM, Christian Heimes wrote: So I'd rather not mention __missing__ in the first paragraph, which describes the functionality provided *by* the defaultdict class. How about adding this para at the end: defaultdict is defined using functionality that is available to *any* sub

Re: default behavior

2010-08-03 Thread Ethan Furman
John Posner wrote: On 8/3/2010 12:54 PM, Ethan Furman wrote: I think mentioning how __missing__ plays into all this would be helpful. Perhaps in the first paragraph, after the colon: if a key does not currently exist in a defaultdict object, __missing__ will be called with that key, which in

Re: default behavior

2010-08-03 Thread Christian Heimes
> So I'd rather not mention __missing__ in the first paragraph, which > describes the functionality provided *by* the defaultdict class. How > about adding this para at the end: > > defaultdict is defined using functionality that is available to *any* > subclass of dict: a missing-key lookup

Re: default behavior

2010-08-03 Thread John Posner
On 8/3/2010 12:54 PM, Ethan Furman wrote: I think mentioning how __missing__ plays into all this would be helpful. Perhaps in the first paragraph, after the colon: if a key does not currently exist in a defaultdict object, __missing__ will be called with that key, which in turn will call a "d

Re: None is negative?

2010-08-03 Thread Benjamin Kaplan
On Tue, Aug 3, 2010 at 1:29 PM, Grant Edwards wrote: > On 2010-08-03, wheres pythonmonks wrote: > >> I did the google search... I must be blind as I don't see any hits... >> >> None is negative in Python?  (v2.6) > > Not really. > >> http://www.google.com/search?ie=UTF-8&q=%22none+is+negative%22+

Re: None is negative?

2010-08-03 Thread Ethan Furman
Grant Edwards wrote: On 2010-08-03, wheres pythonmonks wrote: I did the google search... I must be blind as I don't see any hits... None is negative in Python? (v2.6) Not really. http://www.google.com/search?ie=UTF-8&q=%22none+is+negative%22+python if None < -999.99: print "hi" hi

Re: None is negative?

2010-08-03 Thread Chris Rebert
On Tue, Aug 3, 2010 at 1:29 PM, Grant Edwards wrote: > On 2010-08-03, wheres pythonmonks wrote: > >> I did the google search... I must be blind as I don't see any hits... >> >> None is negative in Python?  (v2.6) > > Not really. > >> http://www.google.com/search?ie=UTF-8&q=%22none+is+negative%22+

Re: Trying to set a cookie within a python script

2010-08-03 Thread Dave Angel
MRAB wrote: Dave Angel wrote: ¯º¿Â wrote: On 3 Αύγ, 18:41, Dave Angel wrote: Different encodings equal different ways of storing the data to the media, correct? Exactly. The file is a stream of bytes, and Unicode has more than 256 possible characters. Further, even the subset of character

Re: None is negative?

2010-08-03 Thread Mithrandir
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 On 08/03/2010 01:28 PM, Mithrandir wrote: > On 08/03/2010 01:17 PM, wheres pythonmonks wrote: >> I did the google search... I must be blind as I don't see any hits... > >> None is negative in Python? (v2.6) > >> http://www.google.com/search?ie=UTF-8

Re: None is negative?

2010-08-03 Thread Grant Edwards
On 2010-08-03, Grant Edwards wrote: > On 2010-08-03, wheres pythonmonks wrote: > >> I did the google search... I must be blind as I don't see any hits... >> >> None is negative in Python? (v2.6) > > Not really. > >> http://www.google.com/search?ie=UTF-8&q=%22none+is+negative%22+python >> > i

Re: None is negative?

2010-08-03 Thread Ned Deily
In article , wheres pythonmonks wrote: > I did the google search... I must be blind as I don't see any hits... > > None is negative in Python? (v2.6) > > http://www.google.com/search?ie=UTF-8&q=%22none+is+negative%22+python > > >>> if None < -999.99: print "hi" > > hi > >>> > > >>> if

Re: None is negative?

2010-08-03 Thread Grant Edwards
On 2010-08-03, wheres pythonmonks wrote: > I did the google search... I must be blind as I don't see any hits... > > None is negative in Python? (v2.6) Not really. > http://www.google.com/search?ie=UTF-8&q=%22none+is+negative%22+python > if None < -999.99: print "hi" > > hi > >>>

Re: None is negative?

2010-08-03 Thread Mithrandir
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 On 08/03/2010 01:17 PM, wheres pythonmonks wrote: > I did the google search... I must be blind as I don't see any hits... > > None is negative in Python? (v2.6) > > http://www.google.com/search?ie=UTF-8&q=%22none+is+negative%22+python > if Non

Re: regular expressions and the LOCALE flag

2010-08-03 Thread MRAB
Baz Walter wrote: On 03/08/10 19:40, MRAB wrote: Baz Walter wrote: the python docs say that re.LOCALE makes certain character classes "dependent on the current locale". re.LOCALE just passes the character to the underlying C library. It really only works on bytestrings which have 1 byte per c

Re: None is negative?

2010-08-03 Thread Benjamin Kaplan
On Tue, Aug 3, 2010 at 1:17 PM, wheres pythonmonks wrote: > > I did the google search... I must be blind as I don't see any hits... > > None is negative in Python?  (v2.6) > > http://www.google.com/search?ie=UTF-8&q=%22none+is+negative%22+python > > >>> if None < -999.99: print "hi" > > hi > >

None is negative?

2010-08-03 Thread wheres pythonmonks
I did the google search... I must be blind as I don't see any hits... None is negative in Python? (v2.6) http://www.google.com/search?ie=UTF-8&q=%22none+is+negative%22+python >>> if None < -999.99: print "hi" hi >>> >>> if -999 > None: print "hi" hi >>> Is there a way to have the co

Re: regular expressions and the LOCALE flag

2010-08-03 Thread Baz Walter
On 03/08/10 19:40, MRAB wrote: Baz Walter wrote: the python docs say that re.LOCALE makes certain character classes "dependent on the current locale". re.LOCALE just passes the character to the underlying C library. It really only works on bytestrings which have 1 byte per character. the re

Re: Trying to set a cookie within a python script

2010-08-03 Thread MRAB
Dave Angel wrote: ¯º¿Â wrote: On 3 Αύγ, 18:41, Dave Angel wrote: Different encodings equal different ways of storing the data to the media, correct? Exactly. The file is a stream of bytes, and Unicode has more than 256 possible characters. Further, even the subset of characters th

locale and number formatting.

2010-08-03 Thread Joe Goldthwaite
I've been working with some developers on a project. Our standard number formatting for the entire web site is comma separated with no decimals. Currency is formatted with the dollar sign. This is basically how they did it; import locale def currency(value): return locale.currency(va

Re: Trying to set a cookie within a python script

2010-08-03 Thread Dotan Cohen
On Tue, Aug 3, 2010 at 18:41, Dave Angel wrote: > I don't understand your wording. Certainly the server launches the python > script, and captures stdout. It then sends that stream of bytes out over > tcp/ip to the waiting browser. You ask when does it become html ? I don't > think the question ha

Re: regular expressions and the LOCALE flag

2010-08-03 Thread MRAB
Baz Walter wrote: the python docs say that re.LOCALE makes certain character classes "dependent on the current locale". here's what i currently see on my system: >>> import re, locale >>> locale.getdefaultlocale() ('en_GB', 'UTF8') >>> locale.getlocale() (None, None) >>> re.findall(r'\w',

Re: Why is python not written in C++ ?

2010-08-03 Thread Paul Rubin
Grant Edwards writes: > There's no computing problem so simple that it can't be solved in a > complex and obtuse manner in C++. > > I know that's true of any language, but from what I've seen over the > years, it "more true" in C++. http://www.willamette.edu/~fruehr/haskell/evolution.html -- htt

Re: finding homopolymers in both directions

2010-08-03 Thread Peter Otten
Lee Sander wrote: > Hi, > Suppose I have a string such as this > 'aabccefghiiijkr' > > I would like to print out all the positions that are flanked by a run > of symbols. > So for example, I would like to the output for the above input as > follows: > > 2 b 1 aa > 2 b -1 cc > 10

Re: Why is python not written in C++ ?

2010-08-03 Thread Benjamin Kaplan
On Tue, Aug 3, 2010 at 10:44 AM, John Nagle wrote: > On 8/1/2010 5:36 PM, Roy Smith wrote: > >> In article<4c55fe82$0$9111$426a3...@news.free.fr>, >> candide wrote: >> >> Python is an object oriented langage (OOL). The Python main >>> implementation is written in pure and "old" C90. Is it for h

Re: Trying to set a cookie within a python script

2010-08-03 Thread Dave Angel
¯º¿Â wrote: On 3 Αύγ, 18:41, Dave Angel wrote: Different encodings equal different ways of storing the data to the media, correct? Exactly. The file is a stream of bytes, and Unicode has more than 256 possible characters. Further, even the subset of characters that *do* take one b

regular expressions and the LOCALE flag

2010-08-03 Thread Baz Walter
the python docs say that re.LOCALE makes certain character classes "dependent on the current locale". here's what i currently see on my system: >>> import re, locale >>> locale.getdefaultlocale() ('en_GB', 'UTF8') >>> locale.getlocale() (None, None) >>> re.findall(r'\w', u'a b c \xe5 \xe6 \xe7'

Re: Why is python not written in C++ ?

2010-08-03 Thread John Nagle
On 8/1/2010 5:36 PM, Roy Smith wrote: In article<4c55fe82$0$9111$426a3...@news.free.fr>, candide wrote: Python is an object oriented langage (OOL). The Python main implementation is written in pure and "old" C90. Is it for historical reasons? C is not an OOL and C++ strongly is. I wonder if

Re: Behavior of re.split on empty strings is unexpected

2010-08-03 Thread John Nagle
On 8/2/2010 5:53 PM, samwyse wrote: On Aug 2, 12:34 pm, John Nagle wrote: The regular expression "split" behaves slightly differently than string split: I'm going to argue that it's the string split that's behaving oddly. I tend to agree. It doesn't seem to be possible to get the sam

finding homopolymers in both directions

2010-08-03 Thread Lee Sander
Hi, Suppose I have a string such as this 'aabccefghiiijkr' I would like to print out all the positions that are flanked by a run of symbols. So for example, I would like to the output for the above input as follows: 2 b 1 aa 2 b -1 cc 10 e -1 cc 11 f 1 g 17 h 1 iii 17

Re: Trying to set a cookie within a python script

2010-08-03 Thread Νίκος
>On 3 Αύγ, 18:41, Dave Angel wrote: > > Different encodings equal different ways of storing the data to the > > media, correct? > > Exactly. The file is a stream of bytes, and Unicode has more than 256 > possible characters. Further, even the subset of characters that *do* > take one byte are diff

Re: Why is python not written in C++ ?

2010-08-03 Thread Ethan Furman
John Bokma wrote: Michael Torrie writes: On 08/01/2010 07:09 PM, John Bokma wrote: One thing that comes to mind is that it's much easier to distribute C libraries than C++ libraries. In the beginning of C++ there were programs that just converted C++ to C (frontends). At least that is how th

Re: default behavior

2010-08-03 Thread Ethan Furman
John Posner wrote: On 7/31/2010 1:31 PM, John Posner wrote: Caveat -- there's another description of defaultdict here: http://docs.python.org/library/collections.html#collections.defaultdict ... and it's bogus. This other description claims that __missing__ is a method of defaultdict, not of

Re: Why is python not written in C++ ?

2010-08-03 Thread Carl Banks
On Aug 3, 2:29 am, John Bokma wrote: > Carl Banks writes: > > On Aug 1, 6:09 pm, John Bokma wrote: > >> Roy Smith writes: > >> > In article <4c55fe82$0$9111$426a3...@news.free.fr>, > >> >  candide wrote: > > >> >> Python is an object oriented langage (OOL). The Python main > >> >> implementati

Re: simple integer subclass

2010-08-03 Thread Roald de Vries
Hi Andreas, On Aug 3, 2010, at 1:52 AM, Andreas Pfrengle wrote: I'm trying to define a subclass of int called int1. An int1-object shall behave exactly like an int-object, with the only difference that the displayed value shall be value + 1 (it will be used to display array indices starting at 1

Re: Trying to set a cookie within a python script

2010-08-03 Thread Dave Angel
¯º¿Â wrote: On 3 Αύγ, 11:10, Dave Angel wrote: a) a text editor takes keystrokes and cut/paste info and other data, and produces a stream of (unicode) characters. It then encodes each of those character into one or more bytes and saves it to a file. You have to tell Notepad++ ho

Re: cPickle error when caching data

2010-08-03 Thread Benedict Verheyen
On 3/08/2010 17:01, Peter Otten wrote: > You can only pickle instances of classes that are reachable by the import > system as only the qualified name of the class is stored, not the bytecode > to generate it. Move your class out of the function into the global module > scope and you should be

Re: subclassing versus object redefinition

2010-08-03 Thread Roald de Vries
Hi W, On Aug 3, 2010, at 4:38 PM, wheres pythonmonks wrote: I think that the crux of the matter is in points #3, #4, and #5 that you raised: I think #2 is important too: a program is supposed to do what you expect, and I don't expect instantiation of an ABC. On #3: Not clear that all po

Re: cPickle error when caching data

2010-08-03 Thread Peter Otten
Benedict Verheyen wrote: > i get the following error when trying to set data in the cache of a django > application. The error is however a python error as it involves pickling > and i can reproduce it in a shell. > The error i get is this: > cPickle.PicklingError: Can't pickle : > attribute looku

Re: checking that process binds a port, fuser functionality

2010-08-03 Thread Roy Smith
On Aug 3, 10:32 am, Zdenek Maxa wrote: > Yes, but I need a check that certain known process's PID listens on a > defined port. connect() would certainly work, but I may end up > connecting to a different process. Then you need to define your protocol such that the client and server engage in so

Re: subclassing versus object redefinition

2010-08-03 Thread wheres pythonmonks
Roald: First, I must admit, I didn't know I could create an ABC in python. Now I see (http://docs.python.org/library/abc.html). Thank you. I think that the crux of the matter is in points #3, #4, and #5 that you raised: 3) adding stuff to instances is less reusable that adding stuff to (sub)cla

Re: checking that process binds a port, fuser functionality

2010-08-03 Thread Zdenek Maxa
Original Message Subject: Re: checking that process binds a port, fuser functionality From: Roy Smith To: python-list@python.org Date: Tue Aug 03 2010 13:06:27 GMT+0200 (CEST) > In article , > Nobody wrote: > >> On Mon, 02 Aug 2010 23:27:37 +0200, Zdenek Maxa wrote: >> >>> I

Re: Why is python not written in C++ ?

2010-08-03 Thread Grant Edwards
On 2010-08-02, Paul Rubin wrote: > Michael Torrie writes: >> Sometimes, C++ is just the right tool for the job, despite all its >> warts C++'s object semantics (guaranteed destruction, scoping, >> etc) can sometimes work very well when you need the speed of a >> compiled language, but don't

Re: Why is python not written in C++ ?

2010-08-03 Thread Grant Edwards
On 2010-08-02, Aahz wrote: > In article , > Peter wrote: >>On Aug 3, 7:42=A0am, Mark Lawrence wrote: >>> On 02/08/2010 00:08, candide wrote: >>> >>> I can't understand why any serious programmer mentions C++. As soon >>> as I read it, I have to rush either to the kitchen to find a bowl to >>> t

Re: subclassing versus object redefinition

2010-08-03 Thread Roald de Vries
On Aug 3, 2010, at 2:46 PM, wheres pythonmonks wrote: Hi! I have a class (supposed to be an abstract base class): In python (as opposed to static languages like C++) I don't seed to subclass the base class, but instead I can simply override the behavior of stub methods and values. Is there a pre

Re: simple integer subclass

2010-08-03 Thread Jean-Michel Pichavant
Jean-Michel Pichavant wrote: Andreas Pfrengle wrote: On 3 Aug., 03:22, Carl Banks wrote:> You are creating an object that differs from a built-in, int, in a highly misleading way that only makes sense in a very limited context, and this object's modified behavior gives no clue that it's been

Re: simple integer subclass

2010-08-03 Thread Jean-Michel Pichavant
Andreas Pfrengle wrote: On 3 Aug., 03:22, Carl Banks wrote:> You are creating an object that differs from a built-in, int, in a highly misleading way that only makes sense in a very limited context, and this object's modified behavior gives no clue that it's been modified in such as way. (T

Re: Trying to set a cookie within a python script

2010-08-03 Thread Νίκος
> On 3 Αύγ, 11:10, Dave Angel wrote: > a) a text editor takes keystrokes and cut/paste info and other data, and > produces a stream of (unicode) characters.  It then encodes each of   > those character into one or more bytes and saves it to a file.  You have > to tell Notepad++ how to do that enc

cPickle error when caching data

2010-08-03 Thread Benedict Verheyen
Hi i get the following error when trying to set data in the cache of a django application. The error is however a python error as it involves pickling and i can reproduce it in a shell. The error i get is this: cPickle.PicklingError: Can't pickle : attribute lookup management.views.Stats failed

Pydev 1.6.1 Released

2010-08-03 Thread Fabio Zadrozny
Hi All, Pydev 1.6.1 has been released Details on Pydev: http://pydev.org Details on its development: http://pydev.blogspot.com Release Highlights: --- * **Debugger** * **Critical Fix: issue that prevented the debugger from working with Python 3 solved** * Im

Re: simple integer subclass

2010-08-03 Thread rantingrick
> On Aug 3, 5:15 am, Andreas Pfrengle wrote: > > Seems I end up with your suggestion - if noone else has an idea ;-) START_COUNTING_FROM_HERE = 1 -- http://mail.python.org/mailman/listinfo/python-list

subclassing versus object redefinition

2010-08-03 Thread wheres pythonmonks
Hi! I have a class (supposed to be an abstract base class): In python (as opposed to static languages like C++) I don't seed to subclass the base class, but instead I can simply override the behavior of stub methods and values. Is there a preference between between subclassing (C++ approach) and o

  1   2   >