Re: Your beloved python features

2010-02-05 Thread Martin P. Hellwig
On 02/04/10 23:03, Julian wrote: For those guys would be a poster quite cool which describes the most popular and beloved python features. That it is ego-orientated programming ;-) http://mail.python.org/pipermail/python-announce-list/2009-April/007419.html -- mph -- http://mail.python.org/m

Re: "if {negative}" vs. "if {positive}" style

2010-02-10 Thread Martin P. Hellwig
On 02/10/10 03:36, Tim Chase wrote: Larry Hudson wrote: But a minor rearrangement is simpler, and IMHO clearer: if 'mystring' not in s: print 'not found' else: print 'foundit' print 'processing' I've always vacillated on whether that would better be written as Larry does, or as if 'mystring'

Re: New to Python

2010-02-10 Thread Martin P. Hellwig
On 02/10/10 10:53, Jean-Michel Pichavant wrote: Quin wrote: Well, now you know! All I know is that you are using a python implementation that does not support python 3. No wonder why your py3 code fails. You knew you known, you know :-) -- mph -- http://mail.python.org/mailman/listinfo/

Re: Executing Commands From Windows Service

2010-02-11 Thread Martin P. Hellwig
On 02/07/10 19:02, T wrote: I have a script, which runs as a Windows service under the LocalSystem account, that I wish to have execute some commands. Specifically, the program will call plink.exe to create a reverse SSH tunnel. Right now I'm using subprocess.Popen to do so. When I run it inte

Re: method names nounVerb or verbNoun

2010-02-11 Thread Martin P. Hellwig
On 02/05/10 19:53, Wanderer wrote: Which is the more accepted way to compose method names nounVerb or verbNoun? For example voltageGet or getVoltage? getVoltage sounds more normal, but voltageGet is more like voltage.Get. I seem to mix them and I should probably pick one way and stick with it.

Re: Modifying Class Object

2010-02-12 Thread Martin P. Hellwig
Well at least you are well written and more subtle than Xah Lee. Though I find him also quite amusing, I do like a good flame-war every now and again, and in that perspective I solute you. -- mph -- http://mail.python.org/mailman/listinfo/python-list

Re: Hashing in python

2010-02-14 Thread Martin v. Loewis
> floor(x) returns an integer Why do you say that? Assuming you are talking about math.floor, it works differently for me: py> math.floor(10.0/3) 3.0 Regards, Martin -- http://mail.python.org/mailman/listinfo/python-list

Re: Hashing in python

2010-02-14 Thread Martin v. Loewis
SIZE) table[key(point)] You could even use that key function as a key to a dictionary, if you can't use lists for some reason. Regards, Martin -- http://mail.python.org/mailman/listinfo/python-list

Re: listing existing windows services with python

2010-02-16 Thread Martin P. Hellwig
On 02/16/10 13:51, Alf P. Steinbach wrote: - Alf (is this off-topic for the group?) Strictly speaking yes, but I do find it interesting and there is nothing wrong with ignoring posts you don't like to read. -- mph -- http://mail.python.org/mailman/listinfo/python-list

Re: Can't Access ANY url from python (errno 61)

2010-02-19 Thread Martin P. Hellwig
On 02/19/10 21:48, MattB wrote: Hey all, I've been working on a program that accesses my school's password protected website and downloads directory names. I'm using mechanize. Recently, the program has been unable to open the website, returning the 'errno 61 connection refused' error. I presum

Re: Pure virtual functions in Python?

2010-02-20 Thread Martin v. Loewis
lallous wrote: > Hello > > How can I do something similar to pure virtual functions in C++ ? See, for example http://code.activestate.com/recipes/266468/ Regards, Martin -- http://mail.python.org/mailman/listinfo/python-list

Re: Pure virtual functions in Python?

2010-02-20 Thread Martin v. Loewis
sible to do something like if hasattr(c, 'cb') and not is_pure(c.cb): c.cb("Hello", "World") is_pure could, for example, look at a function attribute of the callback. You'd write something like @pure_virtual def cb(self, param1, param2): not_implemented Regards, Martin -- http://mail.python.org/mailman/listinfo/python-list

Re: Can't Access ANY url from python (errno 61)

2010-02-20 Thread Martin P. Hellwig
On 02/20/10 00:20, MattB wrote: Also, based on Martin's comment, I just wanted to make you all aware that I intend no misuse, but rather am just trying to learn, as I'm a programming noob. It wasn't my intention to imply that, rather the opposite, that if some BOFH would see your action as m

Re: Compiling and running 32-bit Python on 64-bit server?

2010-02-20 Thread Martin v. Loewis
lib32 libs and compiling Python with > some magical switches. The precise set of packages that you will need depends on the specific Linux distribution. Check whether "gcc -m32" can build a hello-world program. Then, set CC to "gcc -m32", and follow the build instructions in P

Re: Pure virtual functions in Python?

2010-02-21 Thread Martin v. Loewis
o", "World") >> >> is_pure could, for example, look at a function attribute of the >> callback. You'd write something like >> >> @pure_virtual >> def cb(self, param1, param2): >> not_implemented >> >> Regards, >>

Re: Overcoming python performance penalty for multicore CPU

2010-02-21 Thread Martin v. Loewis
ded case, and 32s for the multi-threaded case when pinning the Python process to a single CPU (using taskset(1)). So it's 6% overhead for threading, and 25% penalty for multicore CPUs - far from the 100% you seem to expect. Regards, Martin -- http://mail.python.org/mailman/listinfo/python-list

Use eval() safely?

2010-02-21 Thread W. Martin Borgert
Hi, I know that this issue has been discussed before, but most of the time using only one argument to eval(). Is it possible to use the following code, e.g. run as part of a web application, to break in and if so, how? import math def myeval(untrustedinput): return eval(untrustedinput, {"__

Re: Overcoming python performance penalty for multicore CPU

2010-02-21 Thread Martin v. Loewis
inux), what specific Python version had you been using? (less important) what CPUs? If you can: what specific test suite? A lot of science is about repeatability. Making a systematic study is (IMO) over-valued - anecdotal reports are useful, too, as long as they allow for repeatable experiments. Regar

Re: When will Python go mainstream like Java?

2010-02-23 Thread Martin P. Hellwig
Actually I am still waiting for Java to be mainstream :-) You could say it is popular, which it is without doubt but in my opinion after C handed over it's pseudo de facto standard (mostly because a lot of OS'es are written in it) nobody else has had enough momenta to reach for that crown. Ac

Re: When will Python go mainstream like Java?

2010-02-24 Thread Martin P. Hellwig
On 02/24/10 16:05, Peter Parker wrote: Steve Holden wrote: At 12.34 pm on November 13, 2011 At December 21, 2012 at 11:11 am (according to the Maya calendar) On August 29, 1997, Java became mainstream. In a panic, Microsoft tried to embrace, extend and exterminate the system, prompting Sun

Re: taking python enterprise level?...

2010-02-25 Thread Martin P. Hellwig
On 02/25/10 10:26, simn_stv wrote: what i am concerned about is scalability and efficiency, well, as far as the 'core' is concerned. would python be able to manage giving me a solid 'core' and will i be able to use python provide any API i would like to implement?... Python isn't the most eff

Re: taking python enterprise level?...

2010-02-25 Thread Martin P. Hellwig
On 02/25/10 13:58, D'Arcy J.M. Cain wrote: On Thu, 25 Feb 2010 02:26:18 -0800 (PST) Our biggest problem was in a network heavy element of the app and that was low level TCP/IP stuff that rather than being Python's problem was something we used Python to fix. Out off interest, could you elabo

Re: taking python enterprise level?...

2010-02-25 Thread Martin P. Hellwig
On 02/25/10 16:18, D'Arcy J.M. Cain wrote: Very interesting, I had a similar kind of problem (a network balancer that doesn't balance small tcp packages too well) and solved it by wrapping the TCP package in UDP. UDP was treated differently, although in overall switch and router manager it has

Re: Python dos2unix one liner

2010-02-27 Thread Martin P. Hellwig
On 02/27/10 09:36, @ Rocteur CC wrote: Hi a couple of fragmented things popped in my head reading your question, non of them is very constructive though in what you actually want, but here it goes anyway. - Oneline through away script with re as a built in syntax, yup that sounds like perl t

Re: Python dos2unix one liner

2010-02-28 Thread Martin P. Hellwig
On 02/28/10 11:05, Stefan Behnel wrote: Steven D'Aprano, 28.02.2010 09:48: There ought to be some kind of competition for the least efficient solution to programming problems That wouldn't be very interesting. You could just write a code generator that spits out tons of garbage code including

Re: Use eval() safely?

2010-02-28 Thread W. Martin Borgert
Gregory Ewing wrote: > I posted a demonstration of this earlier in this thread. As you wrote, your example does not work when using eval() like in my original post with second and third parameter to eval(): >>> import math >>> eval("[c for c in (0).__class__.__bases__[0].__subclasses__() if c.__n

Re: Queue peek?

2010-03-02 Thread Martin P. Hellwig
On 03/02/10 19:44, MRAB wrote: information, such as when it was completed, the status (OK or failed), etc. You might want to wrap it in a class with locks (mutexes) to ensure it's threadsafe. What actually happens if multiple threads at the same time, write to a shared dictionary (Not using the

Re: start function in new process

2010-03-05 Thread Martin P. Hellwig
On 03/05/10 19:21, wongjoek...@yahoo.com wrote: Any specific reason why threading.Thread or multiprocessing is not suitable to solve your problem? -- mph -- http://mail.python.org/mailman/listinfo/python-list

Re: start function in new process

2010-03-05 Thread Martin P. Hellwig
On 03/05/10 19:45, wongjoek...@yahoo.com wrote: On 5 mrt, 20:40, "Martin P. Hellwig" wrote: On 03/05/10 19:21, wongjoek...@yahoo.com wrote: Any specific reason why threading.Thread or multiprocessing is not suitable to solve your problem? -- mph Because I got a memory leak in my

Re: Conditional based on whether or not a module is being used

2010-03-05 Thread Martin P. Hellwig
On 03/05/10 19:24, Pete Emerson wrote: In a module, how do I create a conditional that will do something based on whether or not another module has been loaded? > If someone is using foo module, I want to take advantage of its features and use it in foobar, otherwise, I want to do something els

Re: start function in new process

2010-03-05 Thread Martin P. Hellwig
On 03/05/10 20:09, wongjoek...@yahoo.com wrote: On 5 mrt, 21:02, "Martin P. Hellwig" wrote: On 03/05/10 19:45, wongjoek...@yahoo.com wrote: On 5 mrt, 20:40, "Martin P. Hellwig" wrote: On 03/05/10 19:21, wongjoek...@yahoo.com wrote: Any specific reason why

Re: start function in new process

2010-03-06 Thread Martin P. Hellwig
On 03/06/10 09:45, wongjoek...@yahoo.com wrote: Yes, I saw this example also before. HOwever what I want is to call an internal function which gets a reference of another internal function as input and not calling an external program. Do you have any example on that with subprocess module ? Tha

Re: killing own process in windows

2010-03-07 Thread Martin P. Hellwig
On 03/07/10 21:08, News123 wrote: Hi, How can I kill my own process? Some multithreaded programs, that I have are unable to stop when ctrl-C is pressed. Some can't be stopped with sys.exit() So I'd just like to terminate my own program. Examples of non killable (not killable with CTRL-C) pr

Re: killing own process in windows

2010-03-07 Thread Martin P. Hellwig
On 03/07/10 21:54, News123 wrote: Hi Martin. Hellwig wrote: On 03/07/10 21:08, News123 wrote: Hi, How can I kill my own process? Some multithreaded programs, that I have are unable to stop when ctrl-C is pressed. Some can't be stopped with sys.exit() So I'd just like to termin

Re: running a program on many processors

2010-03-07 Thread Martin P. Hellwig
On 03/08/10 00:18, Paweł Banyś wrote: Hello, I have already read about Python and multiprocessing which allows using many processors. The idea is to split a program into separate tasks and run each of them on a separate processor. However I want to run a Python program doing a single simple task

Re: write to remote ile

2010-03-07 Thread Martin P. Hellwig
On 03/08/10 02:10, monkeys paw wrote: I can xfer a file from a remote server using: import urllib2 as u x=u.urlopen('http://tycho.usno.navy.mil/cgi-bin/timer.pl') for line in x: print line How can i write a file to the remote server? I tried: x = u.url.open('http://joemoney.net/somefile.txt

Re: write to remote ile

2010-03-07 Thread Martin P. Hellwig
On 03/08/10 02:51, monkeys paw wrote: On 3/7/2010 9:20 PM, Martin P. Hellwig wrote: On 03/08/10 02:10, monkeys paw wrote: I can xfer a file from a remote server using: import urllib2 as u x=u.urlopen('http://tycho.usno.navy.mil/cgi-bin/timer.pl') for line in x: print line How can

Re: Trouble with quotes

2010-03-08 Thread Martin P. Hellwig
On 03/08/10 17:06, Stephen Nelson-Smith wrote: Hi, I've written some (primitive) code to parse some apache logfies and establish if apache has appended a session cookie to the end. We're finding that some browsers don't and apache doesn't just append a "-" - it just omits it. It's working fine

Re: String is ASCII or UTF-8?

2010-03-09 Thread Martin v. Loewis
> I can create ASCII strings containing byte values between 127 and 255. No, you can't - or what you create wouldn't be an ASCII string, by definition of ASCII. Regards, Martin -- http://mail.python.org/mailman/listinfo/python-list

Re: equivalent of Ruby's Pathname?

2010-03-09 Thread Martin P. Hellwig
On 02/09/10 14:00, Phlip wrote: Ah, now we get down to the root of the problem. Because Python is so stuck on the "one best way to do it" mentality, language bigotry prevented the Committee from picking from among several equally valid but non-best options. And after 20 years of growth, Python s

Does this already exists?: A module that checks if the used platform is supported

2010-03-10 Thread Martin P. Hellwig
Hi all, Before I start reinventing a squared wheel, I have the following question: Is there already a (standard) module that wraps around the various os/sys information which checks if the platform + version is supported for what I want to do with it. For example I am currently looking at mak

Re: Can't install ssl for Python2.5

2010-03-10 Thread Martin v. Loewis
> I don't know how to solve this problem and I am looking forward for > help. Try running "python setup.py install" directly, after downloading and unpacking the package. Regards, Martin -- http://mail.python.org/mailman/listinfo/python-list

Re: Ideas for creating processes

2010-03-10 Thread Martin P. Hellwig
On 03/10/10 21:52, J wrote: I'm working on a project and thought I'd ask for a suggestion on how to proceed (I've got my own ideas, but I wanted to see if I was on the right track) Well I can't speak with authority but I would go into similar lines, especially since you want to call an externa

Re: Python, Reportlabs, Pil and Windows 7 (64bit)

2010-03-11 Thread Martin v. Loewis
, use VS 2008. This comes with an AMD64 compiler. You technically don't need a 64-bit Windows, as it supports cross-compilation (but you would need a 64-bit Windows to test it). I personally build Python on a 32-bit machine, and move the MSI to a 64-bit machine for testing. Regards, Martin -- http://mail.python.org/mailman/listinfo/python-list

Re: Where can I find documentation for data[:,9]

2010-03-11 Thread Martin P. Hellwig
On 03/11/10 22:08, Cal Who wrote: Thanks, that helped a lot. I'm having trouble knowing what to search for to find documenatation. For example, is print a Python command, a numpy command or a java command? I like to read the documentation even if the command is working for me. Thanks again

Platform Requirement Checker (was Does this already exists?: A module that checks if the used platform is supported)

2010-03-11 Thread Martin P. Hellwig
On 03/11/10 01:37, Gabriel Genellina wrote: En Wed, 10 Mar 2010 10:54:27 -0300, Martin P. Hellwig escribió: Before I start reinventing a squared wheel, I have the following question: Is there already a (standard) module that wraps around the various os/sys information which checks if the

Re: Python, Reportlabs, Pil and Windows 7 (64bit)

2010-03-11 Thread Martin v. Loewis
ll early adaptors. Regards, Martin -- http://mail.python.org/mailman/listinfo/python-list

Re: Python, Reportlabs, Pil and Windows 7 (64bit)

2010-03-12 Thread Martin v. Löwis
I'm still puzzled why I ship the import libraries of all the pyd files as well - I can't see a reason other than tradition]. Then, distutils should change to look it up there. Regards, Martin -- http://mail.python.org/mailman/listinfo/python-list

Re: Unicode characters in btye-strings

2010-03-12 Thread Martin v. Loewis
are none. Various Python versions then try different things; what they should do is to determine the terminal encoding, and decode the bytes according to that one. Regards, Martin (*) If a source encoding was given, the source is actually recoded to UTF-8, parsed, and then re-encoded back into the o

Re: Unicode characters in btye-strings

2010-03-12 Thread Martin v. Loewis
Michael Rudolf wrote: > Am 12.03.2010 21:56, schrieb Martin v. Loewis: >> (*) If a source encoding was given, the source is actually recoded to >> UTF-8, parsed, and then re-encoded back into the original encoding. > > Why is that? Why is what? That string literals get reen

Re: python to exe

2010-03-13 Thread Martin P. Hellwig
On 03/13/10 19:23, Steven D'Aprano wrote: On Sat, 13 Mar 2010 12:52:39 -0600, John Bokma wrote: For quite some time I thought that comp.lang.perl.misc was quite unfriendly because of a certain attitude. comp.lang.python was quite a refreshment for a while: very newbie friendly, less pissing con

Re: xml-rpc

2010-03-14 Thread Martin P. Hellwig
there some queuing mechanism for client calls? Thanks in advance. --erdinc How I usually tackle stuff like this: [mar...@aspire8930 /usr/home/martin]$ python Python 2.6.4 (r264:75706, Jan 31 2010, 20:52:16) [GCC 4.2.1 20070719 [FreeBSD]] on freebsd8 Type "help", "copyright

Re: xml-rpc

2010-03-14 Thread Martin P. Hellwig
On 03/14/10 10:32, hackingKK wrote: Instead of using the library directly, isn't python-twisted a better choice? Why? -- mph -- http://mail.python.org/mailman/listinfo/python-list

Re: import antigravity

2010-03-16 Thread Martin P. Hellwig
On 03/16/10 19:30, Hans Mulder wrote: Ulrich Eckhardt wrote: Chris Rebert wrote: You're a bit behind the times. If my calculations are right, that comic is over 2 years old. import timetravel I think you mean: from __future__ import timetravel -- HansM Well according to Marty it is: fr

Re: multiprocessing on freebsd

2010-03-17 Thread Martin P. Hellwig
mentation, therefore, the required synchronization primitives needed will not function, see issue 3770. Build mine from ports, with the following options (notice SEM & PTH): [mar...@aspire8930 /usr/home/martin]$ cat /var/db/ports/python26/options # This file is auto-generated by 'mak

Re: Need to create subprocess...

2010-03-18 Thread Martin P. Hellwig
On 03/18/10 16:17, drstoka wrote: Hello, I have to run a program as a child process inside my python program and redirect it's output through a pipe to a parent program process. So, I wrote this: pipe = Popen('example_program', shell=True, bufsize=0, stdout=PIPE).stdout and it works great. No

Re: using Python distutils bdist_msi to create installer for large complicated package

2010-03-21 Thread Martin v. Löwis
i. If you find this too tedious to use, please propose *base classes* that could become part of msilib, rather than trying to create *subclasses* of the bdist_msi classes. Regards, Martin -- http://mail.python.org/mailman/listinfo/python-list

Re: Unicode blues in Python3

2010-03-23 Thread Martin v. Loewis
really infrequently used in practice. So that you try to write it strongly suggests that it is not actually text what you are writing. Also, your formulation suggests the same: "Is there any way to write a value 253 to standard output?" If you would really be writing text, you'd ask "Is there any way to write 'ý' to standard output?" Regards, Martin -- http://mail.python.org/mailman/listinfo/python-list

Re: Pythonic way to trim and keep leading and trailing whitespace

2010-03-23 Thread Martin P. Hellwig
On 03/23/10 23:38, Tim Chase wrote: Just in case you're okay with a regexp solution, you can use >>> s = "\t\tabc def " >>> import re >>> r = re.compile(r'^(\s*)(.*?)(\s*)$') >>> m = re.match(s) >>> m.groups() ('\t\t', 'abc def', ' ') >>> leading, text, trailing = m.groups() Ahhh regex,

Re: RELEASED Python 2.6.5

2010-03-24 Thread Martin v. Loewis
> Is anyone else having trouble with the 2.6.5 Windows x86 installer? Not me. Run msiexec /i py...msi /l*v py.log and inspect py.log for errors (post it to bugs.python.org if you can't determine the cause of the problems). Are you using SUBST by any chance? Regards, Martin

Don't understand behavior; instance form a class in another class' instance

2010-03-25 Thread Martin P. Hellwig
Hi all, When I run the following snippet (drastically simplified, to just show what I mean): >> import platform, sys class One(object): def __init__(self): self.one = True def change(self): self.one = False class Two(object): def __init__(self): self._inst

Re: Don't understand behavior; instance form a class in another class' instance

2010-03-25 Thread Martin P. Hellwig
On 03/25/10 23:41, Christian Heimes wrote: Martin P. Hellwig schrieb: What I don't understand why in the second test, the last boolean is True instead of (what I expect) False. Could somebody enlighten me please as this has bitten me before and I am confused by this behavior. Hint: TEST

Re: Don't understand behavior; instance form a class in another class' instance

2010-03-25 Thread Martin P. Hellwig
On 03/26/10 01:10, Rhodri James wrote: Pretty much. In the sense that you're thinking of, every assignment works that way, even the initial "TEST1 = One()". Assignment binds names to objects, though you have to be aware that names can be such exotic things as "t", "a[15]" or "TEST2.__instance_o

Re: subprocess only good for win32?

2010-03-31 Thread Martin v. Loewis
it's not only that Python can't start it, but nobody can. Regards, Martin -- http://mail.python.org/mailman/listinfo/python-list

Re: Get Eclipse/PyDev to run scripts that don't end in .py

2010-03-31 Thread Martin P. Hellwig
On 03/31/10 22:37, J wrote: Is there any way to tell PyDev in Eclipse to run a script that doesn't end in .py? Even if I have to go and manually set something for each file... I've inherited (in a manner of speaking) a dev project that is done in python2.6... I pulled the latest dev branch and

Re: Is it possible to store data in a Python file in a way similar to Ruby's __END__ section?

2010-04-02 Thread Martin v. Loewis
thon? The common approach is to write DATA="""\ yaml data here """ If you want to process the data in the same file, you can't really put them at the end of the file - in fact, putting them at the beginning is more common. Regards, Martin -- http://mail.python.org/mailman/listinfo/python-list

Re: off topic but please forgive me me and answer

2010-04-03 Thread Martin P. Hellwig
On 04/03/10 14:38, Steve Holden wrote: If you think you will persuade a crackpot to drop his lunacy by logical argument you are clearly an optimist of the first water. But since I like a challenge (and bearing in mind this is OT so I don't claim to be an expert) you might try first of all persu

Re: off topic but please forgive me me and answer

2010-04-03 Thread Martin P. Hellwig
On 04/03/10 16:17, Steven D'Aprano wrote: On Sat, 03 Apr 2010 15:43:41 +0100, Martin P. Hellwig wrote: I am replying to this post not because I disagree but because it postalogically fits the best (I am by no means an expert either). IMHO, the crackpot in this regard is actually part

Re: off topic but please forgive me me and answer

2010-04-03 Thread Martin P. Hellwig
On 04/03/10 16:46, Patrick Maupin wrote: On Apr 3, 9:43 am, "Martin P. Hellwig"> IMHO, the crackpot in this regard is actually partially right, multiplication does mean that the number must get bigger, however for fractions you multiply four numbers, two numerators and two deno

Re: regenerating unicodedata for py2.7 using py3 makeunicodedata.py?

2010-11-18 Thread Martin v. Loewis
> Thanks for the confirmation Martin! > > Do you think, it the mentioned omission of the character names of some > CJK ranges in unicodedata intended, or should it be reported to the > tracker? It's certainly a bug. So a bug report would be appreciated, but much more so a

Re: Glob in python which supports the ** wildcard

2010-11-22 Thread Martin v. Loewis
Am 22.11.2010 22:43, schrieb Martin Lundberg: > Hi, > > I want to be able to let the user enter paths like this: > > apps/name/**/*.js > > and then find all the matching files in apps/name and all its > subdirectories. However I found out that Python's glob f

Re: Pypi (Cheeseshop) Score - derivation of ?

2010-11-25 Thread Martin v. Loewis
to that? There was indeed a kwalitee computation (cheesecake); it is unmaintained. It is a urban myth that this had any impact on search results. It never did. Regards, Martin -- http://mail.python.org/mailman/listinfo/python-list

Re: Python 3 encoding question: Read a filename from stdin, subsequently open that filename

2010-11-30 Thread Martin v. Loewis
locale (as you apparently do), but set it to a locale that actually matches the encoding that you use. Regards, Martin -- http://mail.python.org/mailman/listinfo/python-list

Re: Python 3 encoding question: Read a filename from stdin, subsequently open that filename

2010-11-30 Thread Martin v. Löwis
e > problems. So I need something for which a filename is just a blob > that shouldn't be monkeyed with. In that case, you should use byte strings as file names, not character strings. Regards, Martin -- http://mail.python.org/mailman/listinfo/python-list

Re: Python 3 encoding question: Read a filename from stdin, subsequently open that filename

2010-11-30 Thread Martin v. Loewis
> The world does not revolve around Python. Unix filenames have been > encoding-agnostic long before Python was around. If Python3 does not > support this then it's a regression on Python's part. Fortunately, Python 3 does support that. Regards, Martin -- http://mail

Re: Python 3 encoding question: Read a filename from stdin, subsequently open that filename

2010-11-30 Thread Martin v. Loewis
ss a (Unicode) string to open; instead, it will (as will Java) use your locale's encoding. Regards, Martin -- http://mail.python.org/mailman/listinfo/python-list

Re: Comparison with False - something I don't understand

2010-12-05 Thread Martin v. Loewis
ning either a list or False) is not. If you return False from a function, the only other possible result should be True. Regards, Martin -- http://mail.python.org/mailman/listinfo/python-list

Re: Enabling the use of POSIX character classes in Python

2010-12-11 Thread Martin v. Loewis
ly for single-byte encodings. I'm not aware of a procedure that does that for multi-byte strings. But perhaps you didn't mean "POSIX character class" in this literal way. Regards, Martin -- http://mail.python.org/mailman/listinfo/python-list

Re: Bind C++ program for use with both Python 2.x and 3.x

2010-12-11 Thread Martin v. Loewis
binding, supporting both 2.x and 3.x simultaneously will be straight-forward. Regards, Martin -- http://mail.python.org/mailman/listinfo/python-list

Re: while True or while 1

2010-12-12 Thread Martin v. Loewis
uot;1". In the end, in any project, there should be coding conventions, and authors should follow them. What is legible is IMO much more determined by convention than "intuition", at least to experienced programmers (i.e. those that have been following the convention for a long time). Regards, Martin -- http://mail.python.org/mailman/listinfo/python-list

Re: "Download/windows" site page

2010-12-13 Thread Martin v. Loewis
I'd rather not fix it by adding all product names that Microsoft has used for Windows. How about "Microsoft Windows (XP and later releases)"? Regards, Martin -- http://mail.python.org/mailman/listinfo/python-list

Re: Python 3.2 beta 2

2010-12-21 Thread Martin v. Loewis
ou literal question: most certainly. At least you seem to be considering it, so it's certainly being considered by somebody. Regards, Martin -- http://mail.python.org/mailman/listinfo/python-list

Re: round in 2.6 and 2.7

2010-12-23 Thread Martin v. Loewis
conversions are correctly rounded. The round() function is also now correctly rounded. Not sure that this is correct English; I think it means that the round() function is now correct. Regards, Martin -- http://mail.python.org/mailman/listinfo/python-list

Re: round in 2.6 and 2.7

2010-12-28 Thread Martin v. Loewis
File "", line 1, in TypeError: a float is required But then, I'm not a native speaker (of English). Regards, Martin -- http://mail.python.org/mailman/listinfo/python-list

Re: Is there anyway to run JavaScript in python?

2010-12-30 Thread Martin v. Loewis
Am 30.12.2010 14:52, schrieb crow: > Hi, I'm writing a test tool to simulate Web browser. Is there anyway > to run JavaScript in python? Thanks in advance. See PyV8: http://pypi.python.org/pypi/PyV8 Regards, Martin -- http://mail.python.org/mailman/listinfo/python-list

Re: Python3 Web Framework

2010-12-31 Thread Martin v. Loewis
b frameworks are available for > Python3... I heard the Django is still not compatible with 3.x... Any > idea guys? You could try my port of Django to Py3k: https://bitbucket.org/loewis/django-3k Regards, Martin -- http://mail.python.org/mailman/listinfo/python-list

Re: How to define a bytes literal in Python 2.x for porting to Python 3.x using 2to3?

2011-01-01 Thread Martin v. Loewis
should first determine what Python versions their users want to see supported, and then look for solutions that cover all these versions. In the case of byte literals, the solution is fairly straight-forward, and only moderately ugly. Regards, Martin -- http://mail.python.org/mailman/listinfo/python-list

Re: How to define a bytes literal in Python 2.x for porting to Python 3.x using 2to3?

2011-01-01 Thread Martin v. Loewis
7;t helped by 2to3, so compatibility within 2.x is more important to consider than compatibility between 2.x and 3.x. Regards, Martin -- http://mail.python.org/mailman/listinfo/python-list

How to dump a Python 2.6 dictionary with UTF-8 strings?

2011-01-11 Thread W. Martin Borgert
Hi, naively, I thought the following code: #!/usr/bin/env python2.6 # -*- coding: utf-8 -*- import codecs d = { u'key': u'我爱中国人' } if __name__ == "__main__": with codecs.open("ilike.txt", "w", "utf-8") as f: print >>f, d would produce a file ilike.txt like this: {u'key': u'我爱中国人'}

Re: How to dump a Python 2.6 dictionary with UTF-8 strings?

2011-01-11 Thread Martin v. Loewis
> What's the right way to get the strings in UTF-8? This will work. I doubt you can get it much simpler in 2.x; in 3.x, your code will work out of the box (with proper syntactical adjustments). import pprint, cStringIO class UniPrinter(pprint.PrettyPrinter): def format(self, obj, context, ma

Re: How to dump a Python 2.6 dictionary with UTF-8 strings?

2011-01-11 Thread W. Martin Borgert
On 2011-01-12 00:27, Martin v. Loewis wrote: > This will work. I doubt you can get it much simpler > in 2.x; in 3.x, your code will work out of the box > (with proper syntactical adjustments). Thanks, this works like a charm. I tried pprint before for this task and failed. Now I

Multiple independently started python processes and sharing of a module

2011-01-13 Thread Martin P. Hellwig
uared wheel or am totally missing the point. Any suggestions/comments are greatly appreciated, Thanks in advanced, Martin P. Hellwig -- http://mail.python.org/mailman/listinfo/python-list

Re: Multiple independently started python processes and sharing of a module

2011-01-14 Thread Martin P. Hellwig
. It might be a misconfiguration but, under mod_wsgi with apache it does. Cheers, Martin -- http://mail.python.org/mailman/listinfo/python-list

Re: Multiple independently started python processes and sharing of a module

2011-01-14 Thread Martin P. Hellwig
On 01/14/11 10:05, Kushal Kumaran wrote: This might help though: https://code.google.com/p/modwsgi/wiki/ProcessesAndThreading It seems if you're not using 'daemon' mode, global data might be shared. Yes I read that thoroughly before I started out implementing a solution. But in my case I want

Re: do you know what's CGI? (web history personal story)

2011-01-15 Thread Martin v. Loewis
>> CGI is still used in some places today, hello? > > Yeah, James Cameron made a *ton* of money using it to make Avatar. He used compacted graphite iron in Avatar? I didn't know that. Regards, Martin -- http://mail.python.org/mailman/listinfo/python-list

Should there be a 'core' python install? (was Re: Tkinter: The good, the bad, and the ugly!)

2011-01-17 Thread Martin P. Hellwig
On 01/17/11 19:39, rantingrick wrote: Q: If you could replace Tkinter with any module/library (THAT IS NOT A GUI OR IDE!!) what would you like to see fill its place? Some systems, like FreeBSD have Tkinter and IDLE as a separate package which is not installed by default. Purely because those

Re: Should there be a 'core' python install? (was Re: Tkinter: The good, the bad, and the ugly!)

2011-01-17 Thread Martin P. Hellwig
On 01/17/11 22:00, rantingrick wrote: On Jan 17, 2:09 pm, "Martin P. Hellwig" wrote: fortunately it is not my call and I actually quite like Tkinter. Are you sure about that Martin? :))) From: "Martin P. Hellwig" Newsgroups: comp.lang.python Subject: Re: GUIs - A Modes

Re: Efficient python 2-d arrays?

2011-01-17 Thread Martin v. Loewis
y, and take the elements at indices 2k and 2k+1 together. Sorting would then only look at even indices, but any swapping you do during the sorting would always swap two numbers with two other numbers. Regards, Martin -- http://mail.python.org/mailman/listinfo/python-list

Re: __pycache__, one more good reason to stck with Python 2?

2011-01-20 Thread Martin v. Loewis
rror near unexpected token `(' > ./toto.pyc: line 2: `P7Mc@s dGHdS(tfooNs./ > toto.pys' Works fine here: martin@mira:/tmp$ cat >a.py print "Hello, world" martin@mira:/tmp$ python Python 2.6.6 (r266:84292, Dec 26 2010, 22:31:48) [GCC 4.4.5] on linux2 Ty

Re: __pycache__, one more good reason to stck with Python 2?

2011-01-20 Thread Martin v. Loewis
for a module of the same name further down the path -- the new interpreter will find the first .pyc file and complain about it, while the old interpreter would ignore it and use the .py file further down.) Regards, Martin -- http://mail.python.org/mailman/listinfo/python-list

<    35   36   37   38   39   40   41   42   43   44   >