Re: how to tell a method is classmethod or static method or instance method

2012-02-12 Thread Cameron Simpson
On 13Feb2012 15:59, Zheng Li wrote: | how to tell a method is class method or static method or instance method? Maybe a better question is: under what circumstances do you need to figure this out? I'm actually quite serious here. Please outline what circumstances cause you to want to ask and

Re: ANN: Sarge, a library wrapping the subprocess module, has been released.

2012-02-12 Thread Anh Hai Trinh
> Objection! Does the defense REALLY expect this court to believe that > he can testify as to how MOST members of the Python community would or > would not favor bash over Python? And IF they do in fact prefer bash, > is this display of haughty arrogance nothing more than a hastily > stuffed straw-

how to tell a method is classmethod or static method or instance method

2012-02-12 Thread Zheng Li
how to tell a method is class method or static method or instance method? -- http://mail.python.org/mailman/listinfo/python-list

Re: Python usage numbers

2012-02-12 Thread Chris Angelico
On Mon, Feb 13, 2012 at 3:48 PM, Rick Johnson wrote: > The problem with bytes is not encodings or OS's. Can you guess what > the REAL problem is? ..take all the time you need. The REAL problem is trolls. But they're such fun, and so cute when they get ranting... ChrisA -- http://mail.python.or

Re: Python usage numbers

2012-02-12 Thread Rick Johnson
On Feb 12, 12:10 am, Steven D'Aprano wrote: > On Sat, 11 Feb 2012 18:36:52 -0800, Rick Johnson wrote: > >> "I have a file containing text. I can open it in an editor and see it's > >> nearly all ASCII text, except for a few weird and bizarre characters > >> like £ © ± or ö. In Python 2, I can rea

Re: ANN: Sarge, a library wrapping the subprocess module, has been released.

2012-02-12 Thread Rick Johnson
On Feb 12, 2:13 pm, Vinay Sajip wrote: > wc(ls("/etc", "-1"), "-l") > > is not as readable as > > call(“ls /etc –1 | wc –l”) And i agree! I remember a case where i was forced to use an idiotic API for creating inputbox dialogs. Something like this: prompts = ['Height', 'Width', 'Color'] values

Re: Python usage numbers

2012-02-12 Thread Ben Finney
Roy Smith writes: > All that is just fine, but what the heck are we going to do about ascii > art, that's what I want to know. Python just won't be the same in > UTF-8. If it helps, ASCII art *is* UTF-8 art. So it will be the same in UTF-8. Or maybe you already knew that, and your sarcasm was

Re: ANN: Sarge, a library wrapping the subprocess module, has been released.

2012-02-12 Thread Rick Johnson
On Feb 12, 9:35 am, Anh Hai Trinh wrote: > > It's not hard for the user > > I think most users like to use Python, or they'd use Bash. I think people > prefer not another language that is different from both, and having little > benefits. My own opinion of course. Objection! Does the defense RE

Re: ANN: Sarge, a library wrapping the subprocess module, has been released.

2012-02-12 Thread Anh Hai Trinh
On Monday, February 13, 2012 3:13:17 AM UTC+7, Vinay Sajip wrote: > On Feb 12, 3:35 pm, Anh Hai Trinh wrote: > > > I think most users like to use Python, or they'd use Bash. I think people > > prefer not another language that is different from both, and having little > > benefits. My own opinio

Re: Python usage numbers

2012-02-12 Thread Roy Smith
In article , Terry Reedy wrote: > On 2/12/2012 5:14 PM, Chris Angelico wrote: > > On Mon, Feb 13, 2012 at 9:07 AM, Terry Reedy wrote: > >> The situation before ascii is like where we ended up *before* unicode. > >> Unicode aims to replace all those byte encoding and character sets with > >> *on

Re: Python vs. C++11

2012-02-12 Thread sturlamolden
On Feb 13, 4:21 am, sturlamolden wrote: > There are bigsimilarities between Python and the new C++ standard. Now > we can actually use our experience as Python programmers to write > fantastic C++ :-) And of course the keyword 'auto', which means automatic type interence. -- http://mail.python.o

Python vs. C++11

2012-02-12 Thread sturlamolden
There are bigsimilarities between Python and the new C++ standard. Now we can actually use our experience as Python programmers to write fantastic C++ :-) Here is a small list of similarities to consider: Iterate over any container, like Python's for loop: for (type& item: container) Pointer

Re: Python usage numbers

2012-02-12 Thread Terry Reedy
On 2/12/2012 5:14 PM, Chris Angelico wrote: On Mon, Feb 13, 2012 at 9:07 AM, Terry Reedy wrote: The situation before ascii is like where we ended up *before* unicode. Unicode aims to replace all those byte encoding and character sets with *one* byte encoding for *one* character set, which will

entering unicode (was Python usage numbers)

2012-02-12 Thread rusi
On Feb 12, 10:36 pm, Nick Dokos wrote: > rusi wrote: > > On Feb 12, 10:51 am, Steven D'Aprano > +comp.lang.pyt...@pearwood.info> wrote: > > > On Sun, 12 Feb 2012 15:38:37 +1100, Chris Angelico wrote: > > > > Everything that displays text to a human needs to translate bytes into > > > > glyphs, a

Re: Python usage numbers

2012-02-12 Thread Roy Smith
In article , Chris Angelico wrote: > The advantage, though, is that you can always know how many bytes to > read for X characters. In ASCII, you allocate 80 bytes of storage and > you can store 80 characters. In UTF-8, if you want an 80-character > buffer, you can probably get away with allocati

Re: Python usage numbers

2012-02-12 Thread Chris Angelico
On Mon, Feb 13, 2012 at 11:03 AM, Dave Angel wrote: > On 02/12/2012 06:29 PM, Steven D'Aprano wrote: >> I think you mean 4 times as many bytes as characters. Unless you have 32 >> bit bytes :) >> >> > Until you have 32 bit bytes, you'll continue to have encodings, even if only > a couple of them.

Re: M2crypto

2012-02-12 Thread geremy condra
On Sun, Feb 12, 2012 at 4:00 PM, Mel Wilson wrote: > zigi wrote: > >> Hello, >> M2crypto >> >> __init__(self, alg, key, iv, op, key_as_bytes=0, d='md5', >> salt='12345678', i=1, padding=1) >> >> I wont write app, using M2crypto and I can not understand what are the >> arguments: >> key, iv, op, sa

Re: M2crypto

2012-02-12 Thread Mel Wilson
zigi wrote: > Hello, > M2crypto > > __init__(self, alg, key, iv, op, key_as_bytes=0, d='md5', > salt='12345678', i=1, padding=1) > > I wont write app, using M2crypto and I can not understand what are the > arguments: > key, iv, op, salt ? > What they do ? I assume you're reading in

Re: Python usage numbers

2012-02-12 Thread Dave Angel
On 02/12/2012 06:29 PM, Steven D'Aprano wrote: On Sun, 12 Feb 2012 17:27:34 -0500, Roy Smith wrote: Hopefully, we will eventually reach the point where storage is so cheap that nobody minds how inefficient UTF-32 is and we all just start using that. Life will be a lot simpler then. No more t

Re: Python usage numbers

2012-02-12 Thread Christian Heimes
Am 12.02.2012 23:07, schrieb Terry Reedy: > But because of the limitation of ascii on a worldwide, as opposed to > American basis, we ended up with 100-200 codings for almost as many > character sets. This is because the idea of ascii was applied by each > nation or language group individually to t

Re: Numeric root-finding in Python

2012-02-12 Thread Dave Angel
On 02/12/2012 06:05 PM, Steven D'Aprano wrote: On Sun, 12 Feb 2012 12:18:15 -0800, Mark Dickinson wrote: On Feb 12, 6:41 am, Steven D'Aprano wrote: err = -a/b # Estimate of the error in the current w. if abs(err)<= 1e-16: break If the result you'r

Re: Python usage numbers

2012-02-12 Thread Roy Smith
In article <4f384b6e$0$29986$c3e8da3$54964...@news.astraweb.com>, Steven D'Aprano wrote: > > I could hope for one and only one, but I know I'm just going to be > > disapointed. The last project I worked on used UTF-8 in most places, > > but also used some C and Java libraries which were only av

Re: Generating a .pc file using distutils

2012-02-12 Thread Dave Angel
On 02/12/2012 06:04 PM, Tycho Andersen wrote: Just re-bumping this - I am fiddling with this code again and it's gross, so any input would be greatly appreciated :-) \t On Mon, Jan 23, 2012 at 05:31:20PM -0600, Tycho Andersen wrote: Is there some standard way to generate a .pc file (given a .p

French and IDLE on Windows (was Re: Python usage numbers)

2012-02-12 Thread Terry Reedy
On 2/12/2012 2:52 PM, jmfauth wrote: Python popularity? I have no popularity-meter. What I know: I can not type French text in IDLE on Windows. It is like I am pretty sure others have managed to. tk and hence idle handle the entire BMP subset of unicode just fine once they get them. Except fo

Re: Python usage numbers

2012-02-12 Thread Steven D'Aprano
On Sun, 12 Feb 2012 17:27:34 -0500, Roy Smith wrote: > In article , > Chris Angelico wrote: > >> On Mon, Feb 13, 2012 at 9:07 AM, Terry Reedy wrote: >> > The situation before ascii is like where we ended up *before* >> > unicode. Unicode aims to replace all those byte encoding and >> > charact

Re: Numeric root-finding in Python

2012-02-12 Thread Steven D'Aprano
On Sun, 12 Feb 2012 12:18:15 -0800, Mark Dickinson wrote: > On Feb 12, 6:41 am, Steven D'Aprano +comp.lang.pyt...@pearwood.info> wrote: > >>             err = -a/b  # Estimate of the error in the current w. >>             if abs(err) <= 1e-16: >>                 break > > If the result you're e

Re: Generating a .pc file using distutils

2012-02-12 Thread Tycho Andersen
Just re-bumping this - I am fiddling with this code again and it's gross, so any input would be greatly appreciated :-) \t On Mon, Jan 23, 2012 at 05:31:20PM -0600, Tycho Andersen wrote: > Is there some standard way to generate a .pc file (given a .pc.in or > similar) using distutils? > > If the

Re: Python usage numbers

2012-02-12 Thread Steven D'Aprano
On Sun, 12 Feb 2012 08:50:28 -0800, rusi wrote: >> You can't say that it cost you £10 to courier your résumé to the head >> office of Encyclopædia Britanica to apply for the position of Staff >> Coördinator. (Admittedly, the umlaut on the second "o" looks a bit >> stuffy and old-fashioned, but it

Re: Numeric root-finding in Python

2012-02-12 Thread Steven D'Aprano
On Sun, 12 Feb 2012 13:52:48 +, Robert Kern wrote: > I don't have any advice for fixing your code, per se, but I would just > grab mpmath and use their lambertw function: That's no fun! I'd never see mpmath before, it looks like it is worth investigating. Nevertheless, I still intend workin

Re: Python usage numbers

2012-02-12 Thread Steven D'Aprano
On Sun, 12 Feb 2012 12:11:46 -0500, Roy Smith wrote: > In article , > Dennis Lee Bieber wrote: > >> On Sun, 12 Feb 2012 10:48:36 -0500, Roy Smith wrote: >> >> >As Steven D'Aprano pointed out, it was missing some commonly used US >> >symbols such as ¢ or ©. > > That's interesting. When I wro

Re: Python usage numbers

2012-02-12 Thread Dave Angel
On 02/12/2012 05:30 PM, Steven D'Aprano wrote: On Sun, 12 Feb 2012 05:11:30 -0600, Andrew Berg wrote: On 2/12/2012 3:12 AM, Steven D'Aprano wrote: Windows has two separate APIs, one for "wide" characters, the other for single bytes. Depending on which one you use, the directory will appear t

M2crypto

2012-02-12 Thread zigi
Hello, M2crypto __init__(self, alg, key, iv, op, key_as_bytes=0, d='md5', salt='12345678', i=1, padding=1) I wont write app, using M2crypto and I can not understand what are the arguments: key, iv, op, salt ? What they do ? -- http://mail.python.org/mailman/listinfo/python-list

How do you Unicode proponents type your non-ASCII characters? (was: Python usage numbers)

2012-02-12 Thread Ben Finney
rusi writes: > On Feb 12, 10:51 am, Steven D'Aprano +comp.lang.pyt...@pearwood.info> wrote: > > Pardon me, but you can't even write *English* in ASCII. > > > > You can't say that it cost you £10 to courier your résumé to the head > > office of Encyclopædia Britanica to apply for the position of

Re: Python usage numbers

2012-02-12 Thread Dave Angel
On 02/12/2012 05:27 PM, Roy Smith wrote: In article, Chris Angelico wrote: On Mon, Feb 13, 2012 at 9:07 AM, Terry Reedy wrote: The situation before ascii is like where we ended up *before* unicode. Unicode aims to replace all those byte encoding and character sets with *one* byte encoding

Re: Python usage numbers

2012-02-12 Thread Steven D'Aprano
On Sun, 12 Feb 2012 05:11:30 -0600, Andrew Berg wrote: > On 2/12/2012 3:12 AM, Steven D'Aprano wrote: >> NTFS by default uses the UTF-16 encoding, which means the actual bytes >> written to disk are \x1d\x040\x04\xe5\x042\x04 (possibly with a leading >> byte-order mark \xff\xfe). > > That's what I

Re: Python usage numbers

2012-02-12 Thread Roy Smith
In article , Chris Angelico wrote: > On Mon, Feb 13, 2012 at 9:07 AM, Terry Reedy wrote: > > The situation before ascii is like where we ended up *before* unicode. > > Unicode aims to replace all those byte encoding and character sets with > > *one* byte encoding for *one* character set, which

Re: Python usage numbers

2012-02-12 Thread Roy Smith
In article , Terry Reedy wrote: > Let me repeat. Unicode and utf-8 is a solution to the mess, not the > cause. Perhaps we should have a synonym for utf-8: escii, for Earthian > Standard Code for Information Interchange. I'm not arguing that Unicode is where we need to get to. Just trying to

Re: Python usage numbers

2012-02-12 Thread Chris Angelico
On Mon, Feb 13, 2012 at 9:07 AM, Terry Reedy wrote: > The situation before ascii is like where we ended up *before* unicode. > Unicode aims to replace all those byte encoding and character sets with > *one* byte encoding for *one* character set, which will be a great > simplification. It is the id

Re: Python usage numbers

2012-02-12 Thread Terry Reedy
On 2/12/2012 10:13 AM, Roy Smith wrote: Exactly.. ASCII was so successful at becoming a universal standard which lasted for decades, I think you are overstating the universality and length. I used a machine in the 1970s with 60-bit words that could be interpreted as 10 6-bit characters. IBM

Re: Numeric root-finding in Python

2012-02-12 Thread Terry Reedy
On 2/12/2012 5:10 AM, Eelco wrote: On Feb 12, 7:41 am, Steven D'Aprano wrote: This is only peripherally a Python problem, but in case anyone has any good ideas I'm going to ask it. I have a routine to calculate an approximation of Lambert's W function, and then apply a root-finding technique t

Re: Need help with shutils.copytree

2012-02-12 Thread Chris Rebert
On Sun, Feb 12, 2012 at 12:14 PM, Steven W. Orr wrote: > I have a 'master' directory and a collection of 'slave' dirs. I want the > master to collect all of the stuff in the slave dirs. > > The slaves all look like this, > > . > |-- slaveX > |   `-- archI > |   |   `-- distJ > |   |   |   ` -- FIL

Re: ANN: Sarge, a library wrapping the subprocess module, has been released.

2012-02-12 Thread Vinay Sajip
On Feb 12, 4:19 pm, Anh Hai Trinh wrote: > If you use threads and call fork(), you'll almost guaranteed to face with > deadlocks. Perhaps not in a particular piece of code, but some others. > Perhaps not on your laptop, but on the production machine with different > kernels. Like most race con

Re: ANN: Sarge, a library wrapping the subprocess module, has been released.

2012-02-12 Thread Vinay Sajip
On Feb 12, 3:35 pm, Anh Hai Trinh wrote: > I think most users like to use Python, or they'd use Bash. I think people > prefer not another language that is different from both, and having little > benefits. My own opinion of course. > I have looked at pbs and clom: they Pythonify calls to exter

Re: Numeric root-finding in Python

2012-02-12 Thread Mark Dickinson
On Feb 12, 6:41 am, Steven D'Aprano wrote: >             err = -a/b  # Estimate of the error in the current w. >             if abs(err) <= 1e-16: >                 break If the result you're expecting is around -1.005, this exit condition is rather optimistic: the difference between the two Py

Need help with shutils.copytree

2012-02-12 Thread Steven W. Orr
I have a 'master' directory and a collection of 'slave' dirs. I want the master to collect all of the stuff in the slave dirs. The slaves all look like this, . |-- slaveX | `-- archI | | `-- distJ | | | ` -- FILE Where the different slaveX dirs may contain multiple occurrences of a

Re: Python usage numbers

2012-02-12 Thread jmfauth
There is so much to say on the subject, I do not know where to start. Some points. Today, Sunday, 12 February 2012, 90%, if not more, of the Python applications supposed to work with text and I'm toying with are simply not working. Two reasons: 1) Most of the devs understand nothing or not enoug

Re: Python usage numbers

2012-02-12 Thread alister
On Sun, 12 Feb 2012 12:11:01 +, Mark Lawrence wrote: > On 12/02/2012 08:26, Matej Cepl wrote: >> On 12.2.2012 09:14, Matej Cepl wrote: Obvious answers: - Try decoding with UTF8 or Latin1. Even if you don't get the right characters, you'll get *something*. - Use op

Re: Disable use of pyc file with no matching py file

2012-02-12 Thread Brian
On 2/2/2012 1:21 AM, Terry Reedy wrote: On 2/2/2012 1:42 AM, Devin Jeanpierre wrote: On Wed, Feb 1, 2012 at 2:53 PM, Terry Reedy wrote: And it bothers me that you imput such ignorance to me. You made what I think was a bad analogy and I made a better one of the same type, though still imperfe

package extension problem

2012-02-12 Thread Fabrizio Pollastri
Hello, I wish to extend the functionality of an existing python package by creating a new package that redefines the relevant classes of the old package. Each new class inherits the equivalent old class and adds new methods. In the new package there is something like the following. import old_p

Re: Python usage numbers

2012-02-12 Thread Peter Pearson
On 12 Feb 2012 09:12:57 GMT, Steven D'Aprano wrote: > > Suppose you're a fan of Russian punk bank Наӥв and you have a directory > of their music. Sigh. Banking ain't what it used to be. I'm sticking with classical Muzak. -- To email me, substitute nowhere->spamcop, invalid->net. -- http://ma

Re: Python usage numbers

2012-02-12 Thread Nick Dokos
rusi wrote: > On Feb 12, 10:51 am, Steven D'Aprano +comp.lang.pyt...@pearwood.info> wrote: > > On Sun, 12 Feb 2012 15:38:37 +1100, Chris Angelico wrote: > > > Everything that displays text to a human needs to translate bytes into > > > glyphs, and the usual way to do this conceptually is to go v

Re: Python usage numbers

2012-02-12 Thread Roy Smith
In article , rusi wrote: > On Feb 12, 10:51 am, Steven D'Aprano +comp.lang.pyt...@pearwood.info> wrote: > > On Sun, 12 Feb 2012 15:38:37 +1100, Chris Angelico wrote: > > > Everything that displays text to a human needs to translate bytes into > > > glyphs, and the usual way to do this conceptu

Re: Python usage numbers

2012-02-12 Thread Roy Smith
In article , Dennis Lee Bieber wrote: > On Sun, 12 Feb 2012 10:48:36 -0500, Roy Smith wrote: > > >As Steven D'Aprano pointed out, it was missing some commonly used US > >symbols such as ¢ or ©. That's interesting. When I wrote that, it showed on my screen as a cent symbol and a copyright

Re: Python usage numbers

2012-02-12 Thread rusi
On Feb 12, 10:51 am, Steven D'Aprano wrote: > On Sun, 12 Feb 2012 15:38:37 +1100, Chris Angelico wrote: > > Everything that displays text to a human needs to translate bytes into > > glyphs, and the usual way to do this conceptually is to go via > > characters. Pretending that it's all the same th

Re: Numeric root-finding in Python

2012-02-12 Thread Dave Angel
On 02/12/2012 10:20 AM, inq1ltd wrote: I don't know the first thing about this math problem however, if I were to code this I might try ; except ZeroDivisionError: assert w = -1 You top-posted. Please type your response after whatever you're quoting. In my case, I only need a

Re: ANN: Sarge, a library wrapping the subprocess module, has been released.

2012-02-12 Thread Anh Hai Trinh
> For a careful impl of fork-exec with threads, see > http://golang.org/src/pkg/syscall/exec_unix.go I forgot to mention that this impl is indeed "correct" only because you cannot start thread or call fork() directly in the Go language, other than use goroutines and the ForkExec() function impl

Re: Numeric root-finding in Python

2012-02-12 Thread inq1ltd
I don't know the first thing about this math problem however, if I were to code this I might try ; except ZeroDivisionError: assert w = -1 rather than; except ZeroDivisionError: assert w == -1 jimonlinux On Sunday, February 12, 2012 06:41:20 AM Steven D'Aprano wro

Re: Python usage numbers

2012-02-12 Thread Dan Sommers
On Sun, 12 Feb 2012 17:08:24 +1100, Chris Angelico wrote: > On Sun, Feb 12, 2012 at 4:51 PM, Steven D'Aprano > wrote: >> You can't say that it cost you £10 to courier your résumé to the head >> office of Encyclopædia Britanica to apply for the position of Staff >> Coördinator. > > True, but if i

Re: ANN: Sarge, a library wrapping the subprocess module, has been released.

2012-02-12 Thread Anh Hai Trinh
> It's not hard for the user I think most users like to use Python, or they'd use Bash. I think people prefer not another language that is different from both, and having little benefits. My own opinion of course. Re. threads & fork(): http://www.linuxprogrammingblog.com/threads-and-fork-think

Re: Python usage numbers

2012-02-12 Thread Roy Smith
In article <4f375347$0$29986$c3e8da3$54964...@news.astraweb.com>, Steven D'Aprano wrote: > ASCII truly is a blight on the world, and the sooner it fades into > obscurity, like EBCDIC, the better. That's a fair statement, but it's also fair to say that at the time it came out (49 years ago!) i

Re: Python usage numbers

2012-02-12 Thread Roy Smith
In article , Chris Angelico wrote: > On Sun, Feb 12, 2012 at 1:36 PM, Rick Johnson > wrote: > > On Feb 11, 8:23 pm, Steven D'Aprano > +comp.lang.pyt...@pearwood.info> wrote: > >> "I have a file containing text. I can open it in an editor and see it's > >> nearly all ASCII text, except for a fe

Re: Numeric root-finding in Python

2012-02-12 Thread Robert Kern
On 2/12/12 6:41 AM, Steven D'Aprano wrote: This is only peripherally a Python problem, but in case anyone has any good ideas I'm going to ask it. I have a routine to calculate an approximation of Lambert's W function, and then apply a root-finding technique to improve the approximation. This mos

Re: Numeric root-finding in Python

2012-02-12 Thread Mark Lawrence
On 12/02/2012 10:10, Eelco wrote: On Feb 12, 7:41 am, Steven D'Aprano wrote: This is only peripherally a Python problem, but in case anyone has any good ideas I'm going to ask it. I have a routine to calculate an approximation of Lambert's W function, and then apply a root-finding technique to

Re: Numeric root-finding in Python

2012-02-12 Thread 88888 Dihedral
在 2012年2月12日星期日UTC+8下午2时41分20秒,Steven D'Aprano写道: > This is only peripherally a Python problem, but in case anyone has any > good ideas I'm going to ask it. > > I have a routine to calculate an approximation of Lambert's W function, > and then apply a root-finding technique to improve the approx

Re: ldap proxy user bind

2012-02-12 Thread Michael Ströder
sajuptpm wrote: Yea i am not totally clear about that Client's Requirement is option to have a ldap proxy user bind to the ldap server if it needs more directory rights than an anonymous bind. option to use a ldap proxy user when searching. As said: there's the proxy authorization control (see

Re: Python usage numbers

2012-02-12 Thread Mark Lawrence
On 12/02/2012 08:26, Matej Cepl wrote: On 12.2.2012 09:14, Matej Cepl wrote: Obvious answers: - Try decoding with UTF8 or Latin1. Even if you don't get the right characters, you'll get *something*. - Use open(filename, encoding='ascii', errors='surrogateescape') (Or possibly errors='ignore'.)

Re: ANN: Sarge, a library wrapping the subprocess module, has been released.

2012-02-12 Thread Vinay Sajip
On Feb 12, 9:41 am, Anh Hai Trinh wrote: > Having written something with similar purpose > (https://github.com/aht/extproc), here are my comments: > > * Having command parsed from a string is complicated. Why not just have an > OOP API to construct commands? It's not hard for the user, and less

Re: Python usage numbers

2012-02-12 Thread Andrew Berg
On 2/12/2012 3:12 AM, Steven D'Aprano wrote: > NTFS by default uses the UTF-16 encoding, which means the actual bytes > written to disk are \x1d\x040\x04\xe5\x042\x04 (possibly with a leading > byte-order mark \xff\xfe). That's what I meant. Those bytes will be interpreted consistently across all

Re: Numeric root-finding in Python

2012-02-12 Thread Eelco
On Feb 12, 7:41 am, Steven D'Aprano wrote: > This is only peripherally a Python problem, but in case anyone has any > good ideas I'm going to ask it. > > I have a routine to calculate an approximation of Lambert's W function, > and then apply a root-finding technique to improve the approximation.

Re: ANN: Sarge, a library wrapping the subprocess module, has been released.

2012-02-12 Thread Anh Hai Trinh
Having written something with similar purpose (https://github.com/aht/extproc), here are my comments: * Having command parsed from a string is complicated. Why not just have an OOP API to construct commands? extproc does this, but you opted to write a recursive descent parser. I'm sure it's fun

Re: Python usage numbers

2012-02-12 Thread Steven D'Aprano
On Sun, 12 Feb 2012 01:05:35 -0600, Andrew Berg wrote: > On 2/12/2012 12:10 AM, Steven D'Aprano wrote: >> It's not just UTF8 either, but nearly all encodings. You can't even >> expect to avoid problems if you stick to nothing but Windows, because >> Windows' default encoding is localised: a file g

Re: Guide to: Learning Python Decorators

2012-02-12 Thread Jack Diederich
just google "jack diederich decorators" it costs nothing and you get a free pycon talk out of it. -Jack -- http://mail.python.org/mailman/listinfo/python-list

Re: Python usage numbers

2012-02-12 Thread Matej Cepl
On 12.2.2012 09:14, Matej Cepl wrote: Obvious answers: - Try decoding with UTF8 or Latin1. Even if you don't get the right characters, you'll get *something*. - Use open(filename, encoding='ascii', errors='surrogateescape') (Or possibly errors='ignore'.) These are not good answer, IMHO. The

Re: Python usage numbers

2012-02-12 Thread Matej Cepl
On 12.2.2012 03:23, Steven D'Aprano wrote: The use-case given is: "I have a file containing text. I can open it in an editor and see it's nearly all ASCII text, except for a few weird and bizarre characters like £ © ± or ö. In Python 2, I can read that file fine. In Python 3 I get an error. What