Re: loops

2008-10-19 Thread Paul Rubin
James Mills [EMAIL PROTECTED] writes: for x in (2**i for i in xrange(10)): print x This is by far the most concise solution I've seen so far. print '\n'.join(str(2**i) for i in xrange(10)) -- http://mail.python.org/mailman/listinfo/python-list

keyword in package name.

2008-10-19 Thread Abhishek Mishra
Hello Everyone, I have the habit of using domain names (of either the application or company) in reverse in package names. for e.g. com.spam.app1 I've recently started a project for an indian domain (tld = .in), which leads to a package name like in.spam.app1 This causes a syntax error, as in

Re: Creating single .exe file without py2exe and pyinstaller

2008-10-19 Thread Tino Wildenhain
Hi, Abah Joseph wrote: I have written a small application of about 40-45 lines which is about 4KB, so I want to create a single .exe file from it, using py2exe it created unnecessary files, that just increase the size of the program and also less portable to me. What else can I use? the

Re: keyword in package name.

2008-10-19 Thread Tino Wildenhain
Abhishek Mishra wrote: Hello Everyone, I have the habit of using domain names (of either the application or company) in reverse in package names. for e.g. com.spam.app1 While this seemed a good idea for java, I don't think it makes sense for python - the reason: in python you have an import

Re: default value in __init__

2008-10-19 Thread Aaron Brady
Steven D'Aprano wrote: On Sun, 19 Oct 2008 02:52:52 +, Aaron Brady wrote: Steven D'Aprano wrote: On Sat, 18 Oct 2008 09:17:28 +1300, Lawrence D'Oliveiro wrote: In message [EMAIL PROTECTED], Aaron Castironpi Brady wrote: The purpose of a parameter is something that the caller can

Re: ANN: pyparsing 1.5.1 released

2008-10-19 Thread Paul McGuire
On Oct 18, 1:05 pm, Terry Reedy [EMAIL PROTECTED] wrote: Paul McGuire wrote: I've just uploaded to SourceForge and PyPI the latest update to (Python 3.0 uses syntax for catching exceptions that is incompatible with Python versions pre 2.6, so there is no way for me to support both

Re: Python certification

2008-10-19 Thread Python Nutter
Yeah. The day Python goes Certification required to get a job is the day I quit Python forever and move on to another language. Certification prooves you're an idiot who needs to spend money to work for another idiot who doesn't know enough about programming to know if they hire competent

Re: xor: how come so slow?

2008-10-19 Thread Steven D'Aprano
On Sun, 19 Oct 2008 16:38:37 +1300, Lawrence D'Oliveiro wrote: In message [EMAIL PROTECTED], Steven D'Aprano wrote: On Sat, 18 Oct 2008 09:16:11 +1300, Lawrence D'Oliveiro wrote: Data can come in fractional bits. That's how compression works. If you don't believe me, try compressing a

Re: Linux.com: Python 3 makes a big break

2008-10-19 Thread Lawrence D'Oliveiro
In message [EMAIL PROTECTED], Kay Schluehr wrote: If someone had solved the hard problem of finding a less cumbersome way of writing sys.stdout.write(...) ... I don't see what the big deal is. I regularly write things like sys.stdout.write \ ( INPUT TYPE=\RADIO\

Re: Porting VB apps to Python for Window / Linux use

2008-10-19 Thread Stef Mientki
Lawrence D'Oliveiro wrote: In message [EMAIL PROTECTED], Dotan Cohen wrote: I often see mention of SMBs that either want to upgrade their Windows installations, or move to Linux, but cannot because of inhouse VB apps. Probably best to leave those legacy VB apps alone and develop new

Re: loops

2008-10-19 Thread Steven D'Aprano
On Sat, 18 Oct 2008 20:45:47 -0700, John Machin wrote: On Oct 19, 2:30 pm, Steven D'Aprano [EMAIL PROTECTED] cybersource.com.au wrote: [snip] making your code easy to read and easy to maintain is far more important. for x in (2**i for i in xrange(10)):     print x will also print 1, 2,

Re: default value in __init__

2008-10-19 Thread Paul McGuire
On Oct 14, 1:36 pm, David C. Ullrich [EMAIL PROTECTED] wrote: Well... How to say.. Is there any chance these people will read anything *at all* ? No. That's exactly the point! Basic Python is so transparent that you can start using it without reading anything, just looking at a few

Re: Linux.com: Python 3 makes a big break

2008-10-19 Thread Steven D'Aprano
On Sat, 18 Oct 2008 21:34:13 -0700, Kay Schluehr wrote: On 18 Okt., 22:01, Jean-Paul Calderone [EMAIL PROTECTED] wrote: Perhaps it also omitted the fact that nothing prevents you from defining a function to write things to stdout (or elsewhere) in Python 2.5, making the Python 3.x change

[ANN] pyKook 0.0.1 - a simple build tool similar to Make or Ant

2008-10-19 Thread kwatch
Hi all, I have released pyKook 0.0.1. http://pypi.python.org/pypi/Kook/0.0.1 http://www.kuwata-lab.com/kook/ http://www.kuwata-lab.com/kook/pykook-users-guide.html pyKook is a simple build tool similar to Make, Ant, Rake, or SCons. pyKook regards software project as cooking. Terms used in pyKook

Re: xor: how come so slow?

2008-10-19 Thread Steven D'Aprano
On Sun, 19 Oct 2008 04:38:04 +, Tim Roberts wrote: Steven D'Aprano [EMAIL PROTECTED] wrote: On Fri, 17 Oct 2008 20:51:37 +1300, Lawrence D'Oliveiro wrote: Is piece really meant to be random? If so, your create_random_block function isn't achieving much--xoring random data together isn't

Re: Porting VB apps to Python for Window / Linux use

2008-10-19 Thread Dotan Cohen
2008/10/19 Stef Mientki [EMAIL PROTECTED]: Sorry but for GUI design, Python is pre-historic ;-) Stef Really, even with the cross-platform Qt bindings? Can you recommend a better language? (not java no please not java) -- Dotan Cohen http://what-is-what.com http://gibberish.co.il

Re: keyword in package name.

2008-10-19 Thread Abhishek Mishra
On Oct 19, 12:11 pm, Tino Wildenhain [EMAIL PROTECTED] wrote: Abhishek Mishra wrote: Hello Everyone, I have the habit of using domain names (of either the application or company) in reverse in package names. for e.g. com.spam.app1 While this seemed a good idea for java, I don't think

Re: Porting VB apps to Python for Window / Linux use

2008-10-19 Thread Stef Mientki
Dotan Cohen wrote: 2008/10/19 Stef Mientki [EMAIL PROTECTED]: Sorry but for GUI design, Python is pre-historic ;-) Stef Really, even with the cross-platform Qt bindings? I skipped Qt because of the weird license (I make both commercial and free-open software) Can you recommend a

Re: Help with Iteration

2008-10-19 Thread Hendrik van Rooyen
Aaron Brady cast...pigmail.com wrote: while 1: calculate_stuff( ) if stuff 0.5: break The thought police will come and get you. You are doing things by side effect! You are using a global called stuff! You are relying on an implementation detail! While their cudgels are

Re: keyword in package name.

2008-10-19 Thread Marc 'BlackJack' Rintsch
On Sat, 18 Oct 2008 23:05:38 -0700, Abhishek Mishra wrote: I have the habit of using domain names (of either the application or company) in reverse in package names. for e.g. com.spam.app1 I've recently started a project for an indian domain (tld = .in), which leads to a package name

Re: Finding the instance reference of an object

2008-10-19 Thread Steven D'Aprano
On Fri, 17 Oct 2008 16:36:24 -0400, Steve Holden wrote: People here don't describe Python as different just because they *want* it to be different. Python acknowledges intellectual debts to many languages, none of which is exactly like it. I understand that Python's object and calling

Re: keyword in package name.

2008-10-19 Thread Terry Reedy
Abhishek Mishra wrote: Hello Everyone, I have the habit of using domain names (of either the application or company) in reverse in package names. for e.g. com.spam.app1 I've recently started a project for an indian domain (tld = .in), which leads to a package name like in.spam.app1 This

Re: default value in __init__

2008-10-19 Thread Chris Rebert
On Sun, Oct 19, 2008 at 12:56 AM, Paul McGuire [EMAIL PROTECTED] wrote: On Oct 14, 1:36 pm, David C. Ullrich [EMAIL PROTECTED] wrote: Well... How to say.. Is there any chance these people will read anything *at all* ? No. That's exactly the point! Basic Python is so transparent that you

Re: Porting VB apps to Python for Window / Linux use

2008-10-19 Thread Dotan Cohen
2008/10/19 Stef Mientki [EMAIL PROTECTED]: Dotan Cohen wrote: 2008/10/19 Stef Mientki [EMAIL PROTECTED]: Sorry but for GUI design, Python is pre-historic ;-) Stef Really, even with the cross-platform Qt bindings? I skipped Qt because of the weird license (I make both commercial and

urllib2.HTTPError: HTTP Error 204: NoContent

2008-10-19 Thread silk.odyssey
I am getting the following error trying to download an html page using urllib2. urllib2.HTTPError: HTTP Error 204: NoContent The url is of this type:

Re: Porting VB apps to Python for Window / Linux use

2008-10-19 Thread Francesco Bochicchio
Il Sun, 19 Oct 2008 10:34:23 +0200, Stef Mientki ha scritto: ... I'm very satisfied with Python, and must say it's much more beautiful language than Delphi, seen over the full width of programming. Although both languages are Object Oriented, for some (unknown) reason it's 10 times easier

Re: Normalizing arguments

2008-10-19 Thread Dan Ellis
On Oct 17, 7:16 pm, Aaron \Castironpi\ Brady [EMAIL PROTECTED] wrote: George Sakkis has a recipe that might help. http://code.activestate.com/recipes/551779/ Looks like just the thing. Thanks! -- http://mail.python.org/mailman/listinfo/python-list

Re: loops

2008-10-19 Thread John Machin
Steven D'Aprano wrote: On Sat, 18 Oct 2008 20:45:47 -0700, John Machin wrote: On Oct 19, 2:30 pm, Steven D'Aprano [EMAIL PROTECTED] cybersource.com.au wrote: [snip] making your code easy to read and easy to maintain is far more important. for x in (2**i for i in xrange(10)):  

Re: Porting VB apps to Python for Window / Linux use

2008-10-19 Thread Stef Mientki
Dotan Cohen wrote: 2008/10/19 Stef Mientki [EMAIL PROTECTED]: Dotan Cohen wrote: 2008/10/19 Stef Mientki [EMAIL PROTECTED]: Sorry but for GUI design, Python is pre-historic ;-) Stef Really, even with the cross-platform Qt bindings? I skipped Qt because of

Re: Porting VB apps to Python for Window / Linux use

2008-10-19 Thread Stef Mientki
Francesco Bochicchio wrote: Il Sun, 19 Oct 2008 10:34:23 +0200, Stef Mientki ha scritto: ... I'm very satisfied with Python, and must say it's much more beautiful language than Delphi, seen over the full width of programming. Although both languages are Object Oriented, for some

Re: keyword in package name.

2008-10-19 Thread Abhishek Mishra
On Oct 19, 2:06 pm, Marc 'BlackJack' Rintsch [EMAIL PROTECTED] wrote: `com_spam.app1`!?  I would even recommend this with domains that don't clash with keywords because if several people start to use this package name convention you will get name clashes at package level.  Say there are two

Re: Finding the instance reference of an object

2008-10-19 Thread Steven D'Aprano
On Fri, 17 Oct 2008 09:56:17 -0600, Joe Strout wrote: On Oct 16, 2008, at 11:23 PM, Dennis Lee Bieber wrote: On Thu, 16 Oct 2008 21:19:28 -0600, Joe Strout [EMAIL PROTECTED] declaimed the following in comp.lang.python: Now that IS mysterious. Doesn't calling a function add a frame to a

Re: default value in __init__

2008-10-19 Thread Steven D'Aprano
On Sun, 19 Oct 2008 00:56:17 -0700, Paul McGuire wrote: On Oct 14, 1:36 pm, David C. Ullrich [EMAIL PROTECTED] wrote: ... In particular default parameters should work the way the user expects! The fact that different users will expect different things here is no excuse... Are you being

Re: keyword in package name.

2008-10-19 Thread Diez B. Roggisch
Abhishek Mishra schrieb: On Oct 19, 2:06 pm, Marc 'BlackJack' Rintsch [EMAIL PROTECTED] wrote: `com_spam.app1`!? I would even recommend this with domains that don't clash with keywords because if several people start to use this package name convention you will get name clashes at package

Re: loops

2008-10-19 Thread Steven D'Aprano
On Sun, 19 Oct 2008 03:17:51 -0700, John Machin wrote: Steven D'Aprano wrote: On Sat, 18 Oct 2008 20:45:47 -0700, John Machin wrote: On Oct 19, 2:30 pm, Steven D'Aprano [EMAIL PROTECTED] cybersource.com.au wrote: [snip] making your code easy to read and easy to maintain is far more

What's the perfect (OS independent) way of storing filepaths ?

2008-10-19 Thread Stef Mientki
hello, I (again) wonder what's the perfect way to store, OS-independent, filepaths ? I can think of something like: - use a relative path if drive is identical to the application (I'm still a Windows guy) - use some kind of OS-dependent translation table if on another drive - use ? if on a

Re: a new brawser (avant) it is very very good

2008-10-19 Thread Stef Mientki
mina2020 wrote: what has this todo with Python ? Avant Browser allows users to browse multiple Web sites simultaneously and to block all unwanted pop-up pages and Flash ads automatically. The integrated cleaner helps users clear all traces and maintain privacy. The built-in Yahoo and Google

Re: inserting Unicode character in dictionary - Python

2008-10-19 Thread Joe Strout
On Oct 18, 2008, at 1:20 AM, Martin v. Löwis wrote: Do you then have a proper UTF-8 string, but the problem is that none of the standard Python library methods know how to properly interpret UTF-8? There is (probably) no such thing as a proper UTF-8 string (in the sense in which you

Re: ANN: pyparsing 1.5.1 released

2008-10-19 Thread Rob Williscroft
Paul McGuire wrote in news:[EMAIL PROTECTED] in comp.lang.python: On Oct 18, 1:05 pm, Terry Reedy [EMAIL PROTECTED] wrote: Paul McGuire wrote: I've just uploaded to SourceForge and PyPI the latest update to (Python 3.0 uses syntax for catching exceptions that is incompatible with Python

Re: What's the perfect (OS independent) way of storing filepaths ?

2008-10-19 Thread [EMAIL PROTECTED]
On Oct 19, 8:35 am, Stef Mientki [EMAIL PROTECTED] wrote: I (again) wonder what's the perfect way to store, OS-independent, filepaths ? I don't think there is any such thing. What problem are you trying to solve? -- http://mail.python.org/mailman/listinfo/python-list

Re: keyword in package name.

2008-10-19 Thread MRAB
On Oct 19, 7:05 am, Abhishek Mishra [EMAIL PROTECTED] wrote: Hello Everyone, I have the habit of using domain names (of either the application or company) in reverse in package names. for e.g. com.spam.app1 I've recently started a project for an indian domain (tld = .in), which leads to a

indentation

2008-10-19 Thread Gandalf
every time I switch editor all the script indentation get mixed up, and python start giving me indentation weird errors. indentation also hard to follow because it invisible unlike brackets { } is there any solution to this problems? thank you! --

Re: xor: how come so slow?

2008-10-19 Thread MRAB
On Oct 19, 7:13 am, Dennis Lee Bieber [EMAIL PROTECTED] wrote: On Sun, 19 Oct 2008 04:38:04 GMT, Tim Roberts [EMAIL PROTECTED] declaimed the following in comp.lang.python: For those who got a bit lost here, I'd would point out that Knuth[1] has an excellent chapter on random numbers that

Re: a new brawser (avant) it is very very good

2008-10-19 Thread George Sakkis
On Oct 17, 5:59 pm, Stef Mientki [EMAIL PROTECTED] wrote: mina2020 wrote: what has this todo with Python ? Do you take the time to reply to every spam you receive ? -- http://mail.python.org/mailman/listinfo/python-list

Re: indentation

2008-10-19 Thread Steven D'Aprano
On Sun, 19 Oct 2008 07:16:44 -0700, Gandalf wrote: every time I switch editor all the script indentation get mixed up, and python start giving me indentation weird errors. indentation also hard to follow because it invisible unlike brackets { } Indentation is not invisible. Can

Re: Linux.com: Python 3 makes a big break

2008-10-19 Thread Aahz
In article [EMAIL PROTECTED], Lawrence D'Oliveiro [EMAIL PROTECTED] wrote: In message [EMAIL PROTECTED], Kay Schluehr wrote: If someone had solved the hard problem of finding a less cumbersome way of writing sys.stdout.write(...) ... I don't see what the big deal is. I regularly write things

Re: Linux.com: Python 3 makes a big break

2008-10-19 Thread D'Arcy J.M. Cain
On 19 Oct 2008 07:44:52 -0700 [EMAIL PROTECTED] (Aahz) wrote: sys.stdout.write \ ( Why are you using a backslash? Because he hasn't opened the paren yet. He could have put the open paren on the same line as the write obviating the need for the backslash but then his open/close

Re: What's the perfect (OS independent) way of storing filepaths ?

2008-10-19 Thread Steven D'Aprano
On Sun, 19 Oct 2008 14:35:01 +0200, Stef Mientki wrote: hello, I (again) wonder what's the perfect way to store, OS-independent, filepaths ? Perfect? I can't imagine any scheme which will work on every imaginable OS, past present and future. However, in practice I think there are two

Re: What's the perfect (OS independent) way of storing filepaths ?

2008-10-19 Thread Duncan Booth
Steven D'Aprano [EMAIL PROTECTED] wrote: In Linux, config files should go into: ~/.appname/ or /etc/appname/ In Windows (which versions?) then should go into the Documents And Settings folder, where ever that is. There's no single string which can represent both of these conventions!

Re: What's the perfect (OS independent) way of storing filepaths ?

2008-10-19 Thread Duncan Booth
Steven D'Aprano [EMAIL PROTECTED] wrote: import os os.path.splitdrive('C://My Documents/My File.txt') ('C:', 'My Documents\\My File.txt') I had to fake the above output because I'm not running Windows, so excuse me if I got it wrong. Not that it matters, but:

Re: better scheduler with correct sleep times

2008-10-19 Thread Scott David Daniels
qvx wrote: I need a scheduler which can delay execution of a function for certain period of time. My attempt was something like this: ... code Is there a better way or some library that does that? The trick is to use Queue's timeout argument to interrupt your sleep when new requests come in.

Re: What's the perfect (OS independent) way of storing filepaths ?

2008-10-19 Thread Grant Edwards
On 2008-10-19, Stef Mientki [EMAIL PROTECTED] wrote: I (again) wonder what's the perfect way to store, OS-independent, filepaths ? The question appears to me to be meaningless. File paths are not OS independant, so an OS-independant way to store them doesn't seem to be a useful thing to talk

Re: Emacs users: feedback on diffs between python-mode.el and python.el?

2008-10-19 Thread dsyzling
Damien Wyart wrote: * Carl Banks [EMAIL PROTECTED] in comp.lang.python: The python-mode.el on Subversion (python-mode's Subversion on source forge, not the ancient version of python-mode in the Python repository) has a fix for this issue. It doesn't look like there's any way to browse the

Re: xor: how come so slow?

2008-10-19 Thread Steve Holden
Lawrence D'Oliveiro wrote: In message [EMAIL PROTECTED], Steven D'Aprano wrote: On Sat, 18 Oct 2008 09:16:11 +1300, Lawrence D'Oliveiro wrote: Data can come in fractional bits. That's how compression works. If you don't believe me, try compressing a single bit and see if you get a

Re: Finding the instance reference of an object

2008-10-19 Thread Steve Holden
Steven D'Aprano wrote: [...] when you talk about call by value where the value is a reference, it sounds to me as if you are insisting that cars are ACTUALLY horse and buggies, where the horse is the engine, why are we inventing new terms like 'automobile', that just confuses people.

Re: keyword in package name.

2008-10-19 Thread Steve Holden
Abhishek Mishra wrote: On Oct 19, 12:11 pm, Tino Wildenhain [EMAIL PROTECTED] wrote: Abhishek Mishra wrote: Hello Everyone, I have the habit of using domain names (of either the application or company) in reverse in package names. for e.g. com.spam.app1 While this seemed a good idea for

Re: keyword in package name.

2008-10-19 Thread Steve Holden
Marc 'BlackJack' Rintsch wrote: On Sat, 18 Oct 2008 23:05:38 -0700, Abhishek Mishra wrote: I have the habit of using domain names (of either the application or company) in reverse in package names. [...] The `__init__.py` of which vendor should live at the `com/` directory level? If you

Re: Help with Iteration

2008-10-19 Thread Steve Holden
Hendrik van Rooyen wrote: Aaron Brady cast...pigmail.com wrote: while 1: calculate_stuff( ) if stuff 0.5: break The thought police will come and get you. You are doing things by side effect! You are using a global called stuff! You are relying on an implementation

Re: urllib2.HTTPError: HTTP Error 204: NoContent

2008-10-19 Thread Philip Semanchuk
On Oct 19, 2008, at 6:13 AM, silk.odyssey wrote: I am getting the following error trying to download an html page using urllib2. urllib2.HTTPError: HTTP Error 204: NoContent The url is of this type:

Re: Help with Iteration

2008-10-19 Thread Eric Wertman
Aaron Brady cast...pigmail.com wrote: while 1: calculate_stuff( ) if stuff 0.5: break The thought police will come and get you. Based on Aaron's previous posting history, I suspect this was a joke. -- http://mail.python.org/mailman/listinfo/python-list

Paramiko, termios - interactive shell connection.

2008-10-19 Thread Pawel Gega
Hi, I am coding a small SSH client, I ve got some issues with creating pseudo terminal on server side, or at least I suppose that's the problem. That is the 'ps auxf' run on SSH server: root 4317 0.0 0.3 33744 876 ?Ss 11:36 0:00 /usr/sbin/sshd *### **4525** is

Re: Linux.com: Python 3 makes a big break

2008-10-19 Thread Aahz
In article [EMAIL PROTECTED], D'Arcy J.M. Cain [EMAIL PROTECTED] wrote: On 19 Oct 2008 07:44:52 -0700 [EMAIL PROTECTED] (Aahz) wrote: sys.stdout.write \ ( Why are you using a backslash? Because he hasn't opened the paren yet. He could have put the open paren on the same line as the

$$$ Download Sexy Military Babes

2008-10-19 Thread Larry Bird
http://militarybodyarmor.blogspot.com/2008/10/law-enforcement-certifications.html - Here it is don't miss out! -- http://mail.python.org/mailman/listinfo/python-list

The truth about Prophet Muhammad (Peace Be Upon Him)

2008-10-19 Thread hi
The truth about Prophet Muhammad (Peace Be Upon Him) Loving him is following him Muslims all over the world are deeply hurt by the recent caricatures of our beloved Prophet Muhammad , in Danish and several other publications. Every now and then, some Western media outlets provoke Muslims by

Re: What's the perfect (OS independent) way of storing filepaths ?

2008-10-19 Thread Eric Wertman
I (again) wonder what's the perfect way to store, OS-independent, filepaths ? I'm in agreement that perfect probably isn't applicable. If I were doing this myself, I might store the information in a tuple: base = 'some root structure ('/' or 'C') path = ['some','set','of','path','names']

Re: IDE Question

2008-10-19 Thread Jorgen Grahn
On Sat, 18 Oct 2008 19:17:35 -0300, Fabio Zadrozny [EMAIL PROTECTED] wrote: [I wrote] (As a side note: I don't use Eclipse myself, but I have seen novice programmers editing Python code with it, and what saw wasn't impressive. They *did* some kind of Python plugin installed, but were sitting

Re: better scheduler with correct sleep times

2008-10-19 Thread Scott David Daniels
Scott David Daniels wrote: def time_server(commands): '''Process all scheduled operations that arrive on queue commands''' ... queue = Queue.Queue() thread.thread.start_new_thread(queue) queue.put((time.time() + dt, callable, args, {})) ... And of course of the three lines that were

regexp in Python (from Perl)

2008-10-19 Thread Pat
I have a regexp in Perl that converts the last digit of an ip address to '9'. This is a very particular case so I don't want to go off on a tangent of IP octets. ( my $s = $str ) =~ s/((\d+\.){3})\d+/${1}9/ ; While I can do this in Python which accomplishes the same thing: ip = ip[ :-1 ]

Re: indentation

2008-10-19 Thread Jorgen Grahn
On 19 Oct 2008 14:34:45 GMT, Steven D'Aprano [EMAIL PROTECTED] wrote: On Sun, 19 Oct 2008 07:16:44 -0700, Gandalf wrote: every time I switch editor all the script indentation get mixed up, and python start giving me indentation weird errors. indentation also hard to follow because it

Re: inserting Unicode character in dictionary - Python

2008-10-19 Thread Martin v. Löwis
Well, the if no encoding is declared, it (quite sensibly) assumes UTF-8, so for my purposes this boils down to using a UTF-8 editor -- which I always do anyway. But do I still have to put a u before my string literals in order to have it treated as characters rather than bytes? Yes. I'm

Re: xor: how come so slow?

2008-10-19 Thread Aaron Brady
Steven D'Aprano wrote: On Sun, 19 Oct 2008 04:38:04 +, Tim Roberts wrote: Steven D'Aprano [EMAIL PROTECTED] wrote: On Fri, 17 Oct 2008 20:51:37 +1300, Lawrence D'Oliveiro wrote: Is piece really meant to be random? If so, your create_random_block function isn't achieving much--xoring

re.search over a list

2008-10-19 Thread Pat
While I can use a for loop looking for a match on a list, I was wondering if there was a one-liner way. In particular, one of my RE's looks like this '^somestring$' so I can't just do this: re.search( '^somestring$', str( mylist ) ) I'm not smart enough (total newbie) to code up a generator

Re: regexp in Python (from Perl)

2008-10-19 Thread Bruno Desthuilliers
Pat a écrit : I have a regexp in Perl that converts the last digit of an ip address to '9'. This is a very particular case so I don't want to go off on a tangent of IP octets. ( my $s = $str ) =~ s/((\d+\.){3})\d+/${1}9/ ; While I can do this in Python which accomplishes the same thing:

Re: indentation

2008-10-19 Thread Bruno Desthuilliers
Gandalf a écrit : every time I switch editor all the script indentation get mixed up, and python start giving me indentation weird errors. indentation also hard to follow because it invisible unlike brackets { } is there any solution to this problems? Properly configure your eidtors to use

Re: What's the perfect (OS independent) way of storing filepaths ?

2008-10-19 Thread Stef Mientki
Eric Wertman wrote: I (again) wonder what's the perfect way to store, OS-independent, filepaths ? I'm in agreement that perfect probably isn't applicable. If I were doing this myself, I might store the information in a tuple: base = 'some root structure ('/' or 'C') path =

Re: What's the perfect (OS independent) way of storing filepaths ?

2008-10-19 Thread Aaron Brady
Duncan Booth wrote: Steven D'Aprano [EMAIL PROTECTED] wrote: In Linux, config files should go into: ~/.appname/ or /etc/appname/ In Windows (which versions?) then should go into the Documents And Settings folder, where ever that is. There's no single string which can represent both

Re: re.search over a list

2008-10-19 Thread Bruno Desthuilliers
Pat a écrit : While I can use a for loop looking for a match on a list, I was wondering if there was a one-liner way. In particular, one of my RE's looks like this '^somestring$' so I can't just do this: re.search( '^somestring$', str( mylist ) ) I'm not smart enough (total newbie) to code

Re: indentation

2008-10-19 Thread Bruno Desthuilliers
Steven D'Aprano a écrit : (snip) You can use tabs, or spaces. If you use spaces, you can choose 4 spaces, or 8, or any number, By all means, make it 4 spaces - that's the standard. -- http://mail.python.org/mailman/listinfo/python-list

Re: Help with Iteration

2008-10-19 Thread Aaron Brady
Hendrik van Rooyen wrote: Aaron Brady cast...pigmail.com wrote: while 1: calculate_stuff( ) if stuff 0.5: break The thought police will come and get you. You are doing things by side effect! You are using a global called stuff! You are relying on an implementation

Re: better scheduler with correct sleep times

2008-10-19 Thread sokol
from circuits.core import Manager, Component, Event, listener from circuits.timers import Timer what is circuits? -- http://mail.python.org/mailman/listinfo/python-list

Re: indentation

2008-10-19 Thread Derek Martin
On Sun, Oct 19, 2008 at 06:05:08PM +, Jorgen Grahn wrote: Doesn't pretty much everyone use spaces and a four-position indent? I can't speak for everyone, or even pretty much everyone... but I know of several people who favor the idea of indent with tab, align with space. The advantage to

Re: better scheduler with correct sleep times

2008-10-19 Thread sokol
On Oct 19, 6:25 pm, Scott David Daniels [EMAIL PROTECTED] wrote: qvx wrote: I need a scheduler which can delay execution of a function for certain period of time. My attempt was something like this:  ... code Is there a better way or some library that does that? The trick is to use

Re: indentation

2008-10-19 Thread bearophileHUGS
Derek Martin: I know of several people who favor the idea of indent with tab, align with space. [...] I favor this myself actually, [...] Thanks Guido, in Python3 this is finally a Syntax Error (I have asked for this probably about three years ago). Unfortunately the new Python-syntax-based

Re: indentation

2008-10-19 Thread Ben Finney
Gandalf [EMAIL PROTECTED] writes: every time I switch editor all the script indentation get mixed up, and python start giving me indentation weird errors. indentation also hard to follow because it invisible unlike brackets { } is there any solution to this problems? Follow PEP 8

Re: Porting VB apps to Python for Window / Linux use

2008-10-19 Thread infixum
On Oct 19, 12:51 am, Stef Mientki [EMAIL PROTECTED] wrote: Lawrence D'Oliveiro wrote: In message [EMAIL PROTECTED], Dotan Cohen wrote: I often see mention of SMBs that either want to upgrade their Windows installations, or move to Linux, but cannot because of inhouse VB apps.

Re: indentation

2008-10-19 Thread Jorgen Grahn
On Sun, 19 Oct 2008 15:50:59 -0400, Derek Martin [EMAIL PROTECTED] wrote: On Sun, Oct 19, 2008 at 06:05:08PM +, Jorgen Grahn wrote: Doesn't pretty much everyone use spaces and a four-position indent? I can't speak for everyone, or even pretty much everyone... but I know of several

Re: indentation

2008-10-19 Thread Steven D'Aprano
On Sun, 19 Oct 2008 19:03:29 +0200, Bruno Desthuilliers wrote: Steven D'Aprano a écrit : (snip) You can use tabs, or spaces. If you use spaces, you can choose 4 spaces, or 8, or any number, By all means, make it 4 spaces - that's the standard. It's *a* standard. I believe it is the

Re: better scheduler with correct sleep times

2008-10-19 Thread Scott David Daniels
sokol wrote: ... I see what you did there. You are keeping the queue empty so you get notified for free, while I introduced a new threading Condition to detect insertions. All that is missing in your version is to put back all pending tasks when somebody sends the stop (None) request.

Re: better scheduler with correct sleep times

2008-10-19 Thread James Mills
On Mon, Oct 20, 2008 at 5:31 AM, sokol [EMAIL PROTECTED] wrote: from circuits.core import Manager, Component, Event, listener from circuits.timers import Timer what is circuits? If you're interested: An event framework with a focus on Component architectures. It can be downloaded currently

Re: What's the perfect (OS independent) way of storing filepaths ?

2008-10-19 Thread Steven D'Aprano
On Sun, 19 Oct 2008 15:40:32 +, Duncan Booth wrote: Steven D'Aprano [EMAIL PROTECTED] wrote: In Linux, config files should go into: ~/.appname/ or /etc/appname/ In Windows (which versions?) then should go into the Documents And Settings folder, where ever that is. There's no

Re: What's the perfect (OS independent) way of storing filepaths ?

2008-10-19 Thread Steven D'Aprano
On Sun, 19 Oct 2008 20:50:46 +0200, Stef Mientki wrote: Duncan, in windows it's begin to become less common to store settings in DocsSettings, because these directories are destroyed by roaming profiles Isn't *everything* destroyed by roaming profiles? *wink* Seriously, I don't know anyone

Re: regexp in Python (from Perl)

2008-10-19 Thread MRAB
On Oct 19, 5:47 pm, Bruno Desthuilliers [EMAIL PROTECTED] wrote: Pat a écrit : I have a regexp in Perl that converts the last digit of an ip address to  '9'.  This is a very particular case so I don't want to go off on a tangent of IP octets.  ( my $s = $str ) =~

Re: urllib2.HTTPError: HTTP Error 204: NoContent

2008-10-19 Thread Mark Sapiro
On Oct 19, 9:49 am, Philip Semanchuk [EMAIL PROTECTED] wrote: On Oct 19, 2008, at 6:13 AM, silk.odyssey wrote: I am getting the following error trying to download an html page using urllib2. urllib2.HTTPError: HTTP Error 204: NoContent The url is of this type:

Re: Porting VB apps to Python for Window / Linux use

2008-10-19 Thread bearophileHUGS
Stef Mientki: it's just Object Pascal , which is inferior to Python. They are quite different languages, you can't compare them in a simple way. Delphi is statically typed, and compiles very quickly producing small exes; algorithmic code can run a hundred times faster than Python code. There are

Re: regexp in Python (from Perl)

2008-10-19 Thread bearophileHUGS
MRAB: The regular expression changes the last sequence of digits to 9 (192.168.1.100 = 192.168.1.9) but the other code replaces the last digit (192.168.1.100 = 192.168.1.109). Uhmm, this is a possible alternative: s = 192.168.1.100 ..join(s.strip().split(.)[:3]) + .9 '192.168.1.9' Bye,

Re: keyword in package name.

2008-10-19 Thread Christian Heimes
Marc 'BlackJack' Rintsch wrote: `com_spam.app1`!? I would even recommend this with domains that don't clash with keywords because if several people start to use this package name convention you will get name clashes at package level. Say there are two vendors with a `com` TLD, how do you

Re: Porting VB apps to Python for Window / Linux use

2008-10-19 Thread david . lyon
Quoting [EMAIL PROTECTED]: Stef Mientki: it's just Object Pascal , which is inferior to Python. They are quite different languages, you can't compare them in a simple way. Delphi is kinda old, so today there are better languages than Delphi (like D), but when Delphi 2-3 was out, there

Re: Linux.com: Python 3 makes a big break

2008-10-19 Thread Lawrence D'Oliveiro
In message [EMAIL PROTECTED], Dennis Lee Bieber wrote: There is also the matter that the original material is using on each line to delimit the string, and then \ within the line to escape the desired output s, rather than either using ' for the string and bare for the output characters ...

Re: Linux.com: Python 3 makes a big break

2008-10-19 Thread Lawrence D'Oliveiro
In message [EMAIL PROTECTED], Aahz wrote: I'm strongly opposed to backslashes because they break when you get whitespace after them. 1) I've never had that problem. 2) Even if I did, it would report a syntax error, it's not going to fail silently and introduce any run-time bugs, is it? --

Re: keyword in package name.

2008-10-19 Thread Lawrence D'Oliveiro
In message [EMAIL PROTECTED], Abhishek Mishra wrote: I have the habit of using domain names (of either the application or company) in reverse in package names. for e.g. com.spam.app1 I've recently started a project for an indian domain (tld = .in), which leads to a package name like

  1   2   >