Re: Guido's new method definition idea

2008-12-05 Thread Russ P.
On Dec 5, 6:21 pm, "Daniel Fetchinson" <[EMAIL PROTECTED]> wrote: > Hi folks, > > The story of the explicit self in method definitions has been > discussed to death and we all know it will stay. However, Guido > himself acknowledged that an alternative syntax makes perfect sense > and having both (

Re: Don't you just love writing this sort of thing :)

2008-12-05 Thread Lawrence D'Oliveiro
In message <[EMAIL PROTECTED]>, Istvan Albert wrote: > Originally, like many others here I said YIKES! but on a second read, > it is not that bad. It actually grows on you. > > After looking at it one more time I found it neat, very concise > without being unreadable. The key thing is, it's func

Re: Don't you just love writing this sort of thing :)

2008-12-05 Thread Lawrence D'Oliveiro
In message <[EMAIL PROTECTED]>, Steven D'Aprano wrote: > It would have been far more concise ... Gee, I thought people were complaining it was too cryptic, now it turns out they were actually complaining because it was too verbose. -- http://mail.python.org/mailman/listinfo/python-list

Re: Don't you just love writing this sort of thing :)

2008-12-05 Thread Lawrence D'Oliveiro
In message <[EMAIL PROTECTED]>, Steven D'Aprano wrote: > On Fri, 05 Dec 2008 23:28:48 +1300, Lawrence D'Oliveiro wrote: > >> In message <[EMAIL PROTECTED]>, Steven D'Aprano >> wrote: >> >>> Since the context has been deleted, it's hard to tell whether the code >>> as written by Lawrence ... >>

Re: Quick Newbie Question

2008-12-05 Thread r0g
Josh wrote: > Can Python be used on one Linux machine to drive another Linux machine > through SSH? I am currently running Putty on my XP box to run tests on a > Linux box. I need to automate these tests and thought it would be fun to > do so from a Linux VMWare Image I recently setup. Does this s

Re: Guido's new method definition idea

2008-12-05 Thread Kay Schluehr
On 6 Dez., 03:21, "Daniel Fetchinson" <[EMAIL PROTECTED]> wrote: > Hi folks, > > The story of the explicit self in method definitions has been > discussed to death and we all know it will stay. However, Guido > himself acknowledged that an alternative syntax makes perfect sense > and having both (o

Re: Guido's new method definition idea

2008-12-05 Thread Patrick Mullen
>> Daniel Fetchinson wrote: >>> http://neopythonic.blogspot.com/2008/10/why-explicit-self-has-to- > stay.html >>> >>> The proposal is to allow this: >>> >>> class C: >>> def self.method( arg ): >>> self.value = arg >>> return self.value >>> >>> instead of this: >>> >>> class C:

Re: Guido's new method definition idea

2008-12-05 Thread Steven D'Aprano
On Fri, 05 Dec 2008 20:35:07 -0800, James Stroud wrote: > Daniel Fetchinson wrote: >> http://neopythonic.blogspot.com/2008/10/why-explicit-self-has-to- stay.html >> >> The proposal is to allow this: >> >> class C: >> def self.method( arg ): >> self.value = arg >> return self.

Can't get exclusive file lock when safely renaming a file

2008-12-05 Thread Steven D'Aprano
I'm trying to safely rename a file without over-writing any existing files, and I've run into a problem with file locks. Here's a naive way of renaming without over-writing: import os oldname = "ham.txt" newname = "spam.txt" if not os.path.exists(newname): os.rename(oldname, newname) It's n

Re: Running Python 2 and Python 3 on the same machine

2008-12-05 Thread Paul Watson
On Sat, 2008-12-06 at 01:27 +0100, "Martin v. Löwis" wrote: > > For *NIX machines, will 'python' be placed into /usr/bin? > > Not by default, no. Just try it and see for yourself. > > Regards, > Martin Ok. I built the source on an openSUSE 11.0 system. I used 'sudo make altinstll'. It created

Re: m2crypto loading cert file from memory buffer

2008-12-05 Thread Heikki Toivonen
netpork wrote: > ctx = SSL.Context('sslv3') > ctx.load_cert_chain('client.pem') > > anyone knows a way of loading cert file from memory buffer and not > from a file? Yeah, see for example how I did it for Chandler: http://svn.osafoundation.org/chandler/trunk/chandler/parcels/osaf/framework/certst

Re: Guido's new method definition idea

2008-12-05 Thread James Stroud
Of course I meant class C: def me.method(arg): me.value = arg James -- http://mail.python.org/mailman/listinfo/python-list

Re: Guido's new method definition idea

2008-12-05 Thread James Stroud
Daniel Fetchinson wrote: http://neopythonic.blogspot.com/2008/10/why-explicit-self-has-to-stay.html The proposal is to allow this: class C: def self.method( arg ): self.value = arg return self.value instead of this: class C: def method( self, arg ): self.value

Re: Don't you just love writing this sort of thing :)

2008-12-05 Thread Steven D'Aprano
On Fri, 05 Dec 2008 20:19:22 -0800, Istvan Albert wrote: > On Dec 3, 8:07 pm, Lawrence D'Oliveiro <[EMAIL PROTECTED] > central.gen.new_zealand> wrote: > > > > Originally, like many others here I said YIKES! but on a second read, it > is not that bad. It actually grows on you. Just like a disfi

Re: To Troll or Not To Troll (aka: "as" keyword woes)

2008-12-05 Thread James Stroud
alex23 wrote: On Dec 6, 8:00 am, James Stroud <[EMAIL PROTECTED]> wrote: I think its a symptom of the language's maturing, getting popular, and a minority fraction* of the language's most devout advocates developing an egotism that complements their python worship in a most unsavory way. It's

Cambodia TEFL - Gap Year, Travel & Study, Paid Teaching Job - http://www.cambodiatefl.com

2008-12-05 Thread Jobs Teaching English in Asia
Cambodia TEFL - Gap Year, Travel & Study, Paid Teaching Job http://www.cambodiatefl.com -- http://mail.python.org/mailman/listinfo/python-list

Re: To Troll or Not To Troll (aka: "as" keyword woes)

2008-12-05 Thread Steven D'Aprano
On Fri, 05 Dec 2008 19:00:12 -0800, alex23 wrote: > On Dec 6, 8:00 am, James Stroud <[EMAIL PROTECTED]> wrote: >> I think its a symptom of the language's maturing, getting popular, and >> a minority fraction* of the language's most devout advocates developing >> an egotism that complements their p

Re: Don't you just love writing this sort of thing :)

2008-12-05 Thread Istvan Albert
On Dec 3, 8:07 pm, Lawrence D'Oliveiro <[EMAIL PROTECTED] central.gen.new_zealand> wrote: Originally, like many others here I said YIKES! but on a second read, it is not that bad. It actually grows on you. After looking at it one more time I found it neat, very concise without being unreadable.

Re: slow Python 3.0 write performance?

2008-12-05 Thread Istvan Albert
On Dec 5, 3:41 pm, Christian Heimes <[EMAIL PROTECTED]> wrote: > I've fixed the read() slowness yesterday. You'll get the fix in the next > release of Python 3.0 in a couple of weeks. Does this fix speed up the write() function as well? A previous poster suggested that in this case the slowdown

Re: Python 3.0 C API migration tools, or docs?

2008-12-05 Thread Benjamin
On Dec 4, 9:06 pm, illume <[EMAIL PROTECTED]> wrote: > Cool thanks Benjamin! > > Maybe it should be in a wiki as well?  So that as people convert their > modules we can add notes as well. > > I started a wiki with that in mind here:http://wiki.python.org/moin/cporting > > It'd be good if there was

Re: RELEASED Python 3.0 final

2008-12-05 Thread bearophileHUGS
Steven D'Aprano: >I think you're talking about mixed spaces/tabs in the one module.< Right. >My gut feeling is that you have to have a fairly unusual set of circumstances >before it causes actual bugs.< I don't mix tab and spaces in my code, and my editor is able to convert them, so after the

Re: To Troll or Not To Troll (aka: "as" keyword woes)

2008-12-05 Thread alex23
On Dec 6, 8:00 am, James Stroud <[EMAIL PROTECTED]> wrote: > I think its a symptom of the language's > maturing, getting popular, and a minority fraction* of the language's > most devout advocates developing an egotism that complements their > python worship in a most unsavory way. It's hard to se

Guido's new method definition idea

2008-12-05 Thread Daniel Fetchinson
Hi folks, The story of the explicit self in method definitions has been discussed to death and we all know it will stay. However, Guido himself acknowledged that an alternative syntax makes perfect sense and having both (old and new) in a future version of python is a possibility since it maintain

Re: A more pythonic way of writting

2008-12-05 Thread eric
On Dec 6, 12:19 am, Steven D'Aprano <[EMAIL PROTECTED] cybersource.com.au> wrote: > On Fri, 05 Dec 2008 07:44:21 -0800, eric wrote: > > I like to believe that the less the 'debug pointer' stands in the python > > code, the fastest the code is (or is potentially) > > What's a debug pointer? > > Pre-

Re: Don't you just love writing this sort of thing :)

2008-12-05 Thread Lawrence D'Oliveiro
In message <[EMAIL PROTECTED]>, Aaron Brady wrote: > On Dec 5, 4:32 am, Lawrence D'Oliveiro <[EMAIL PROTECTED] > central.gen.new_zealand> wrote: > >> The code people write is probably a direct reflection of their thinking >> processes: For example, slow, plodding, one step at a time, incapable of

Re: RELEASED Python 3.0 final

2008-12-05 Thread Ben Finney
[EMAIL PROTECTED] (Aahz) writes: > In article <[EMAIL PROTECTED]>, > Ben Finney <[EMAIL PROTECTED]> wrote: > >James Stroud <[EMAIL PROTECTED]> writes: > >> > >> comp.lang.python3k ? > > > >The language has undergone an incompatible divide. Hopefully the > >community need not do the same. > > Pis

Re: Python 3.0 automatic decoding of UTF16

2008-12-05 Thread MRAB
John Machin wrote: On Dec 6, 10:35 am, Steven D'Aprano <[EMAIL PROTECTED] cybersource.com.au> wrote: On Fri, 05 Dec 2008 12:00:59 -0700, Joe Strout wrote: So UTF-16 has an explicit EOF marker within the text? No, it does not. I don't know what Terry's thinking of there, but text files do not

Progressive download with Urllib2.

2008-12-05 Thread r0g
Hi There, I am trying to download some video with python but have run aground on the rocky shores of pseudostreaming. Fingers crossed someone else here has some experience with this! Here's what I've done so far... The initial link is foo.asx so I download that with... handle = urllib2.urlopen(

Re: Running Python 2 and Python 3 on the same machine

2008-12-05 Thread Martin v. Löwis
> For *NIX machines, will 'python' be placed into /usr/bin? Not by default, no. Just try it and see for yourself. Regards, Martin -- http://mail.python.org/mailman/listinfo/python-list

Re: Running Python 2 and Python 3 on the same machine

2008-12-05 Thread Martin v. Löwis
Terry Reedy wrote: > Martin v. Löwis wrote: >>> Since the source code is incompatible, I was expecting the Python >>> executable to have a new name such as 'python3' >> >> It does: the executable is called python3.0. > > Why do you say that? Because it is - on Unix. I assumed that was the platfo

Re: Python 3.0 automatic decoding of UTF16

2008-12-05 Thread John Machin
On Dec 6, 10:35 am, Steven D'Aprano <[EMAIL PROTECTED] cybersource.com.au> wrote: > On Fri, 05 Dec 2008 12:00:59 -0700, Joe Strout wrote: > >> So UTF-16 has an explicit EOF marker within the text? > > > No, it does not.  I don't know what Terry's thinking of there, but text > > files do not have an

Re: Multiple Versions of Python on Windows XP

2008-12-05 Thread Martin v. Löwis
Glenn Linderman wrote: > I'm unaware of it needing to handle multiple extensions > from the command line or via double clicking in Explorer, so was > exploiting the extra level of indirection to save typing, and make the > command simpler to remember. Python *does* provide multiple useful extensio

Re: Centralized logging server...

2008-12-05 Thread Sam
Yep...I'm planning on using SysLogHandler. Although if I were to use rsyslog, for example, I might potentially be better off using tcp or even doing it using rfc 3195. Sysloghandler uses udp...I imagine that will be faster but with less reliability. I'll have to think about that. Has anyone imp

Re: RELEASED Python 3.0 final

2008-12-05 Thread Aahz
In article <[EMAIL PROTECTED]>, Ben Finney <[EMAIL PROTECTED]> wrote: >James Stroud <[EMAIL PROTECTED]> writes: >> >> comp.lang.python3k ? > >The language has undergone an incompatible divide. Hopefully the >community need not do the same. Pish and tosh. James was clearly making a funny; there's

Re: To Troll or Not To Troll (aka: "as" keyword woes)

2008-12-05 Thread Steven D'Aprano
On Fri, 05 Dec 2008 14:00:18 -0800, James Stroud wrote: > Andreas Waldenburger wrote: >> Is it me, or has c.l.p. developed a slightly harsher tone recently? >> (Haven't been following for a while.) > > Yep. I can only post here for about a week or two until someone blows a > cylinder and gets ugl

Re: Python 3.0 automatic decoding of UTF16

2008-12-05 Thread Steven D'Aprano
On Fri, 05 Dec 2008 12:00:59 -0700, Joe Strout wrote: >> So UTF-16 has an explicit EOF marker within the text? > > No, it does not. I don't know what Terry's thinking of there, but text > files do not have any EOF marker. They start at the beginning > (sometimes including a byte-order mark), an

Re: RELEASED Python 3.0 final

2008-12-05 Thread Steven D'Aprano
On Fri, 05 Dec 2008 22:01:55 +, je.s.te.r wrote: > Fernando H. Sanches <[EMAIL PROTECTED]> wrote: >> And I personally disliked most of the changes (specially the ones on >> map and reduce). I hope functional programming doesn't get even more >> hindered in future releases, because I believe th

Re: Python C API

2008-12-05 Thread googler . 1 . webmaster
Hi! Any ideas? Thanks, :) -- http://mail.python.org/mailman/listinfo/python-list

Re: Can I load a python program at the interactive >>> prompt?

2008-12-05 Thread Diez B. Roggisch
Tim Golden schrieb: walterbyrd wrote: I am running cygwin on xp. and I just noticed this vital bit. So not sure how much of my other post applies. Sorry. Maybe it'll help anyway. :) Everything. The atrocity that the windows terminal window is isn't mitigated by an out-of-the-box cygwi

Re: A more pythonic way of writting

2008-12-05 Thread Steven D'Aprano
On Fri, 05 Dec 2008 07:44:21 -0800, eric wrote: > I like to believe that the less the 'debug pointer' stands in the python > code, the fastest the code is (or is potentially) What's a debug pointer? Pre-mature optimization is the root of evil in programming. Unless you have actually *measured*

Re: Find Files in a Folder Between 2 Dates

2008-12-05 Thread John Machin
On Dec 6, 9:41 am, Gregory Plantaine <[EMAIL PROTECTED]> wrote: > That worked perfectly! > > Thanks Tim! > > Since we can print the files, does that mean the list of files is in a > tuple, or something?  Would there be a way to further split up the > file names? > > For example, now that the files

Re: RELEASED Python 3.0 final

2008-12-05 Thread Steven D'Aprano
On Fri, 05 Dec 2008 07:09:27 -0800, bearophileHUGS wrote: > Andreas Waldenburger: >> Whenever has it been a pythonic ideal to "not allow" stuff? You get >> warnings. Everything else is up to you. > > It's a strong source for bugs, especially for newbies, that I have hoped > to see removed from Py

Re: Find Files in a Folder Between 2 Dates

2008-12-05 Thread Gregory Plantaine
That worked perfectly! Thanks Tim! Since we can print the files, does that mean the list of files is in a tuple, or something? Would there be a way to further split up the file names? For example, now that the files are processed into the list, we want to look through that list to find differen

Re: Python 3.0 automatic decoding of UTF16

2008-12-05 Thread John Machin
On Dec 6, 5:36 am, Johannes Bauer <[EMAIL PROTECTED]> wrote: > So UTF-16 has an explicit EOF marker within the text? I cannot find one > in original file, only some kind of starting sequence I suppose > (0xfeff). The last characters of the file are 0x00 0x0d 0x00 0x0a, > simple \r\n line ending. S

Re: Project structure - Best practices

2008-12-05 Thread Casey McGinty
> > This is first time that I am building python application that is > larger than a single module and I would like to do it right. I want to just say I am in agreement with the OP. Basically, there are a lot of factors to balance out and consider when starting a python application for the first

Re: slow Python 3.0 write performance?

2008-12-05 Thread bearophileHUGS
Christian Heimes: > I've fixed the read() slowness yesterday. You'll get the fix in the next > release of Python 3.0 in a couple of weeks. Thank you. Bye, bearophile -- http://mail.python.org/mailman/listinfo/python-list

Re: To Troll or Not To Troll (aka: "as" keyword woes)

2008-12-05 Thread Mike Driscoll
On Dec 5, 4:00 pm, James Stroud <[EMAIL PROTECTED]> wrote: > Andreas Waldenburger wrote: > > Is it me, or has c.l.p. developed a slightly harsher tone recently? > > (Haven't been following for a while.) > > Yep. I can only post here for about a week or two until someone blows a > cylinder and gets

Re: Problems running on hp duo Pentium R processor

2008-12-05 Thread Benjamin Kaplan
On Fri, Dec 5, 2008 at 4:08 PM, jim-on-linux <[EMAIL PROTECTED]> wrote: > On Friday 05 December 2008 15:27, Kevin Kelley wrote: > > If they are running standard Win XP (Home or Pro), > > as opposed to 64-bit Win XP, then whether or not the > > CPU supports the IA64 instruction set really doesn't >

Re: dict subclass and pickle bug (?)

2008-12-05 Thread James Stroud
James Stroud wrote: Terry Reedy wrote: because there is no bug to fix. I have suggesting closing. May I suggest to add something to this effect within the issue itself so others won't spend time trying to figure out why the "bug" is still open? Sorry, you did that. James -- http://mail.p

Re: dict subclass and pickle bug (?)

2008-12-05 Thread James Stroud
Terry Reedy wrote: because there is no bug to fix. I have suggesting closing. May I suggest to add something to this effect within the issue itself so others won't spend time trying to figure out why the "bug" is still open? If this is a more general feature of issues, then perhaps it would

Re: To Troll or Not To Troll (aka: "as" keyword woes)

2008-12-05 Thread James Stroud
Andreas Waldenburger wrote: Is it me, or has c.l.p. developed a slightly harsher tone recently? (Haven't been following for a while.) Yep. I can only post here for about a week or two until someone blows a cylinder and gets ugly because they interpreted something I said as a criticism of the

Re: Overriding a method at the instance level on a subclass of a builtin type

2008-12-05 Thread Arnaud Delobelle
Arnaud Delobelle <[EMAIL PROTECTED]> writes: [...] > class ClassGetItem(object): > def __get__(self, obj, objtype=None): > return obj._getitem_ > def __set__(self, obj, val): > obj._getitem_ = val > > class GetItem(object): > def __get__(self, obj, objtype=None): >

Re: slow Python 3.0 write performance?

2008-12-05 Thread Christian Heimes
MRAB wrote: Does pysco with with Python 3.0 (the homepage says 2.5)? If it does then that might help! :-) No, it won't help. -- http://mail.python.org/mailman/listinfo/python-list

Re: Can I load a python program at the interactive >>> prompt?

2008-12-05 Thread Brian Blais
On Dec 5, 2008, at 15:52 , walterbyrd wrote: Can I load a file into the python interactive environment? For example I have a file called test.py that consists of the following: print "hello" print "hello again" Can I load that file into python at the >>> prompt? load "test.py" or somethin

Re: Can I load a python program at the interactive >>> prompt?

2008-12-05 Thread Tim Golden
walterbyrd wrote: I am running cygwin on xp. and I just noticed this vital bit. So not sure how much of my other post applies. Sorry. Maybe it'll help anyway. :) TJG -- http://mail.python.org/mailman/listinfo/python-list

Re: Problems running on hp duo Pentium R processor

2008-12-05 Thread jim-on-linux
On Friday 05 December 2008 15:27, Kevin Kelley wrote: > If they are running standard Win XP (Home or Pro), > as opposed to 64-bit Win XP, then whether or not the > CPU supports the IA64 instruction set really doesn't > matter. As far as I know every Intel Core2 and > Pentium Dual-Core CPU since ~ 2

Re: Can I load a python program at the interactive >>> prompt?

2008-12-05 Thread Tim Golden
walterbyrd wrote: I am running cygwin on xp. Much to my annoyance, I can not cut-and-paste from a windows app to the python prompt. I think I could do this with putty, but I do not have the permissions to install putty on my xp box. I do this all the time. The key (altho' not strictly essentia

Re: slow Python 3.0 write performance?

2008-12-05 Thread MRAB
Istvan Albert wrote: On Dec 5, 3:06 pm, [EMAIL PROTECTED] wrote: It should get faster over time. It will get faster over a shorter period of time if people contribute patches. I see, thanks for the clarification. I will make the point though that this makes python 3.0 unsuited for anyone wh

Can I load a python program at the interactive >>> prompt?

2008-12-05 Thread walterbyrd
I am running cygwin on xp. Much to my annoyance, I can not cut-and-paste from a windows app to the python prompt. I think I could do this with putty, but I do not have the permissions to install putty on my xp box. Can I load a file into the python interactive environment? For example I have a f

Re: RELEASED Python 3.0 final

2008-12-05 Thread Andreas Waldenburger
On Fri, 5 Dec 2008 12:16:47 -0800 (PST) "Fernando H. Sanches" <[EMAIL PROTECTED]> wrote: > On Dec 4, 5:45 pm, Andreas Waldenburger <[EMAIL PROTECTED]> wrote: > > On Thu, 4 Dec 2008 11:52:38 -0600 [EMAIL PROTECTED] wrote: > > [snip] > > Whenever has it been a pythonic ideal to "not allow" stuff? Yo

Re: slow Python 3.0 write performance?

2008-12-05 Thread Christian Heimes
Istvan Albert wrote: I see, thanks for the clarification. I will make the point though that this makes python 3.0 unsuited for anyone who has to process data. One could live with slowdowns of say 20-50 percent, to get the goodies that 3.0 offers, but when a process that takes 1 second suddenly s

Re: Overriding a method at the instance level on a subclass of a builtin type

2008-12-05 Thread Arnaud Delobelle
Arnaud Delobelle <[EMAIL PROTECTED]> writes: > "Zac Burns" <[EMAIL PROTECTED]> writes: > >> Ok. Feature request then - assignment of a special method name to an >> instance raises an error. > > I haven't got the time to implement it, but I'm sure you can obtain the > behaviour you want. OK I've h

Re: Problems running on hp duo Pentium R processor

2008-12-05 Thread Kevin Kelley
If they are running standard Win XP (Home or Pro), as opposed to 64-bit Win XP, then whether or not the CPU supports the IA64 instruction set really doesn't matter. As far as I know every Intel Core2 and Pentium Dual-Core CPU since ~ 2006 has supported 64bit instructions, even the Atom is 64bit. Al

Re: Centralized logging server...

2008-12-05 Thread skip
Sam> I've been playing with the python logging module. I'd like all of Sam> these applications to write their logs to the same place in order Sam> to make analysis easier. Sam> Any ideas on best practices? Perhaps use logging.handlers.SysLogHandler? Sam> What are my options

Re: slow Python 3.0 write performance?

2008-12-05 Thread Istvan Albert
On Dec 5, 3:06 pm, [EMAIL PROTECTED] wrote: > It should get faster over time.  It will get faster over a shorter period of > time if people contribute patches. I see, thanks for the clarification. I will make the point though that this makes python 3.0 unsuited for anyone who has to process data

Re: RELEASED Python 3.0 final

2008-12-05 Thread Fernando H. Sanches
On Dec 4, 5:45 pm, Andreas Waldenburger <[EMAIL PROTECTED]> wrote: > On Thu, 4 Dec 2008 11:52:38 -0600 [EMAIL PROTECTED] wrote: > > > > >     >>> As you have probably guessed: nothing changed here. > >     >>> Also see:http://www.python.org/dev/peps/pep-0666/ > > >     >> What? Do you mean it's pos

Re: slow Python 3.0 write performance?

2008-12-05 Thread skip
Istvan> Could someone run the code below on both Python 2.5 and 3.0 For Istvan> me (on Windows) it runs over 7 times slower with Python 3.0 ... I/O was completely rewritten for Python 3.0. Stdio is no longer used. At the moment I believe much of the io subsystem is still implemente

Centralized logging server...

2008-12-05 Thread Sam
Hi... I'm working with a small team writing a bunch of python applications that communicate via xml/http in a somewhat restful way. :) They are running on about half a dozen computers. We'll probably be scaling that to a lot more computers soon. I've been playing with the python logging module

Problems running on hp duo Pentium R processor

2008-12-05 Thread jim-on-linux
Python help, In September I wrote: I have a number of clients running a program built with python 2.5. One has just purchased an HP with a duo core Pentium R processor E2200, 2.2G with .99g ram. Only on the new HP, when they try to print they get an import error; File win32ui.pyc line 12, in

Re: slow Python 3.0 write performance?

2008-12-05 Thread Bruno Desthuilliers
Istvan Albert a écrit : Could someone run the code below on both Python 2.5 and 3.0 For me (on Windows) it runs over 7 times slower with Python 3.0 Already covered, I think: http://groups.google.com/group/comp.lang.python/browse_frm/thread/9046eee09137c657# import time lo, hi, step = 10**5

Re: pytz and timezone specialists

2008-12-05 Thread Ned Deily
In article <[EMAIL PROTECTED]>, manatlan <[EMAIL PROTECTED]> wrote: > Here is a really simple code : > --- > from datetime import datetime > from pytz import timezone > > tz=timezone("Europe/Paris") > > d=datetime(2008,12,12,19,00,00,tzinfo=tz

Re: Don't you just love writing this sort of thing :)

2008-12-05 Thread Aaron Brady
On Dec 5, 4:32 am, Lawrence D'Oliveiro <[EMAIL PROTECTED] central.gen.new_zealand> wrote: > The code people write is probably a direct reflection of their thinking > processes: For example, slow, plodding, one step at a time, incapable of > imaginative leaps, versus those who operate directly on la

Re: Python 3.0 automatic decoding of UTF16

2008-12-05 Thread MRAB
Joe Strout wrote: On Dec 5, 2008, at 11:36 AM, Johannes Bauer wrote: I suspect that '?' after \n (\u0a00) is indicates not 'question-mark' but 'uninterpretable as a utf16 character'. The traceback below confirms that. It should be an end-of-file marker and should not be passed to Python. I s

Re: slow Python 3.0 write performance?

2008-12-05 Thread Mike Driscoll
On Dec 5, 12:54 pm, Istvan Albert <[EMAIL PROTECTED]> wrote: > Could someone run the code below on both Python 2.5 and 3.0 > > For me (on Windows) it runs over 7 times slower with Python 3.0 > > import time > > lo, hi, step = 10**5, 10**6, 10**5 > > # writes increasingly more lines to a file > for

Re: Python 3.0 automatic decoding of UTF16

2008-12-05 Thread info
On Dec 5, 3:25 pm, Johannes Bauer <[EMAIL PROTECTED]> wrote: > Hello group, > > I'm having trouble reading a utf-16 encoded file with Python3.0. This is > my (complete) code: > > #!/usr/bin/python3.0 > > class AddressBook(): >         def __init__(self, filename): >                 f = open(filenam

Re: Overwrite single line of file

2008-12-05 Thread MRAB
[EMAIL PROTECTED] wrote: Hi, I have about 900 text files (about 2 GB of data) and I need to make some very specific changes to the last line of each file. I'm wondering if there is a way to just overwrite the last line of a file or replace the spots I want (I even know the position of the chara

Re: Python 3.0 automatic decoding of UTF16

2008-12-05 Thread Joe Strout
On Dec 5, 2008, at 11:36 AM, Johannes Bauer wrote: I suspect that '?' after \n (\u0a00) is indicates not 'question-mark' but 'uninterpretable as a utf16 character'. The traceback below confirms that. It should be an end-of-file marker and should not be passed to Python. I strongly suspect tha

Re: slow Python 3.0 write performance?

2008-12-05 Thread Benjamin Kaplan
On Fri, Dec 5, 2008 at 1:54 PM, Istvan Albert <[EMAIL PROTECTED]>wrote: > Could someone run the code below on both Python 2.5 and 3.0 > > For me (on Windows) it runs over 7 times slower with Python 3.0 > > import time > > lo, hi, step = 10**5, 10**6, 10**5 > > # writes increasingly more lines to a

slow Python 3.0 write performance?

2008-12-05 Thread Istvan Albert
Could someone run the code below on both Python 2.5 and 3.0 For me (on Windows) it runs over 7 times slower with Python 3.0 import time lo, hi, step = 10**5, 10**6, 10**5 # writes increasingly more lines to a file for N in range(lo, hi, step): fp = open('foodata.txt', 'wt') start = time

Overwrite single line of file

2008-12-05 Thread chrispoliquin
Hi, I have about 900 text files (about 2 GB of data) and I need to make some very specific changes to the last line of each file. I'm wondering if there is a way to just overwrite the last line of a file or replace the spots I want (I even know the position of the characters I need to replace).

Re: Python 3.0 automatic decoding of UTF16

2008-12-05 Thread Johannes Bauer
Terry Reedy schrieb: > Johannes Bauer wrote: >> Hello group, >> >> I'm having trouble reading a utf-16 encoded file with Python3.0. This is >> my (complete) code: > > what OS. This is often critical when you have a problem interacting > with the OS. It's a 64-bit Linux, currently running: Linux

pytz and timezone specialists

2008-12-05 Thread manatlan
Here is a really simple code : --- from datetime import datetime from pytz import timezone tz=timezone("Europe/Paris") d=datetime(2008,12,12,19,00,00,tzinfo=tz) print d.isoformat() d=datetime.now(tz) print d.isoformat()

Re: Python 3.0 automatic decoding of UTF16

2008-12-05 Thread Terry Reedy
Johannes Bauer wrote: Hello group, I'm having trouble reading a utf-16 encoded file with Python3.0. This is my (complete) code: what OS. This is often critical when you have a problem interacting with the OS. #!/usr/bin/python3.0 class AddressBook(): def __init__(self, filename):

Re: RELEASED Python 3.0 final

2008-12-05 Thread Terry Reedy
[EMAIL PROTECTED] wrote: Andreas Waldenburger: Whenever has it been a pythonic ideal to "not allow" stuff? You get warnings. Everything else is up to you. It's a strong source for bugs, especially for newbies, that I have hoped to see removed from Python3 (my first request of this was years ag

Re: dict subclass and pickle bug (?)

2008-12-05 Thread Terry Reedy
James Stroud wrote: James Stroud wrote: Hello All, I subclassed dict and overrode __setitem__. When instances are unpickled, the __setstate__ is not called before the keys are assigned via __setitem__ in the unpickling protocol. I googled a bit and found that this a bug filed in 2003: It

etree, minidom unicode

2008-12-05 Thread n00b
hi, i have a feew questions concnering unicode and utf-8 handling and would appreciate any insights. 1) i got a xml document, utf-8, encoded and been trying to use etree to parse and then commit to mysql db. using etree, everything i've been extracting is return as a string except ascii char > 12

Re: Python 3.0 automatic decoding of UTF16

2008-12-05 Thread Richard Brodie
"J Kenneth King" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > It probably means what it says: that the input file contains characters > it cannot read using the specified encoding. That was my first thought. However it appears that there is an off by one error somewhere in the

Re: RELEASED Python 3.0 final

2008-12-05 Thread Peter Pearson
On Thu, 4 Dec 2008 15:49:46 -0600, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote: > > It's more than warnings. With properly crafted > combinations of spaces and tabs you can get code which > looks like it has a certain indentation to the human > observer but which looks like it has different indent

Re: ANN: Shed Skin 0.0.30, an experimental (restricted-)Python-to-C++ Compiler

2008-12-05 Thread Scott David Daniels
Mark Dufour wrote: Hi all, I have just released version 0.0.30 of Shed Skin, ... Normally, including a link is a good idea. --Scott David Daniels [EMAIL PROTECTED] -- http://mail.python.org/mailman/listinfo/python-list

Re: Python 3.0 automatic decoding of UTF16

2008-12-05 Thread Johannes Bauer
J Kenneth King schrieb: > It probably means what it says: that the input file contains characters > it cannot read using the specified encoding. No, it doesn't. The file is just fine, just as the example. > Are you generating the file from python using a file object with the > same encoding? If

Re: pretty strange behavior of "strip" FORGET THE LAST ONE

2008-12-05 Thread Scott David Daniels
Guy Doune wrote: Guy Doune a écrit : Ok, didn't show the whole problem... I will read the doc anyway, but why "questions.html" keep it "t"?? >>> test=['03.html', '06.html', 'questions.html', '04.html', 'toc.html', '01.html', '05.html', '07.html', '02.html', '08.html'] >>> test[4] 'toc.html

Re: Python 3.0 automatic decoding of UTF16

2008-12-05 Thread J Kenneth King
Johannes Bauer <[EMAIL PROTECTED]> writes: > Traceback (most recent call last): > File "./modify.py", line 12, in > a = AddressBook("2008_11_05_Handy_Backup.txt") > File "./modify.py", line 7, in __init__ > line = f.readline() > File "/usr/local/lib/python3.0/io.py", line 1807, in r

Whitespace in Python (3) [was: RELEASED Python 3.0 final]

2008-12-05 Thread Andreas Waldenburger
On Fri, 5 Dec 2008 07:46:02 -0800 (PST) [EMAIL PROTECTED] wrote: > Andreas Waldenburger: > > My point is: If you mix tabs and spaces in a way that breaks code, > > you'll find out pretty easily, because your program will not work. > > - Most newbies don't know that. > - Sometimes it may produce w

Re: simplest way to strip a comment from the end of a line?

2008-12-05 Thread eric
On Dec 5, 11:56 am, eric <[EMAIL PROTECTED]> wrote: > On Dec 4, 11:35 pm, Paul McGuire <[EMAIL PROTECTED]> wrote: > > > Yowza!  My eyes glaze over when I see re's like "r'(?m)^(?P.*? > > (".*?".*?)*)(?:#.*?)?$"! > > yeah, I know ... :( ( I love complicated regexp ... it's like a puzzle > game for m

Re: pretty strange behavior of "strip"

2008-12-05 Thread rdmurray
On Fri, 5 Dec 2008 at 07:54, Mark Tolonen wrote: > > import re > > re.split('[,.]','blah,blah.blah') ['blah', 'blah', 'blah'] Thank you. Somehow it never occurred to me that I could use that kind of pattern that way. I guess my brain just doesn't think in regexes very well :) --RDM -- htt

Re: Don't you just love writing this sort of thing :)

2008-12-05 Thread George Sakkis
On Dec 5, 8:06 am, Marco Mariani <[EMAIL PROTECTED]> wrote: > Steven D'Aprano wrote: > > Gosh Lawrence, do tell, which category do YOU fall into? > > I suppose a mix-up between a cowbody (or Fonzie) coder and a troll. Naah.. more likely an (ex?) Lisper/Schemer. -- http://mail.python.org/mailman/li

Re: To Troll or Not To Troll (aka: "as" keyword woes)

2008-12-05 Thread Michael Mabin
Warren, weren't you aware that Python.org is now a church. So you can never live up to the standards of the Pythonista high priests. You can only ask a question or submit your comment then cower, hoping the pythonista high priests don't beat you with clubs for heresy. ;) 2008/12/4 Warren DeLa

Re: pretty strange behavior of "strip"

2008-12-05 Thread MRAB
[EMAIL PROTECTED] wrote: On Thu, 4 Dec 2008 at 20:54, Terry Reedy wrote: 'toc.html' > > > test[4].strip('.html') 'oc' Can't figure out what is going on, really. What I can't figure out is why, when people cannot figure out what is going on with a function (or methods in this case), they

Re: Mathematica 7 compares to other languages

2008-12-05 Thread Xah Lee
On Dec 4, 6:09 pm, [EMAIL PROTECTED] wrote: > For the interested, with MMA 6, on a Pentium 4 3.8Ghz: > > The code that Jon posted: > > Timing[Export["image-jon.pgm", [EMAIL PROTECTED]@Main[2, 100, 4]]] > {80.565, "image-jon.pgm"} > > The code that Xah posted: > > Timing[Export["image-xah.pgm", [EMA

Re: pretty strange behavior of "strip"

2008-12-05 Thread Mark Tolonen
<[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] On Thu, 4 Dec 2008 at 20:54, Terry Reedy wrote: [snip] I have often wished that in 'split' I could specify a _set_ of characters on which the string would be split, in the same way the default list of whitespace characters causes a s

  1   2   >