Re: Finding where to store application data portably

2005-09-21 Thread Jeff Schwab
Steven D'Aprano wrote: As a Linux user, I really am sick of every damn application, script and program under the sun filling the top level of my home directory with dot-files. I wish the Linux Standard Base folks would specify that settings files should all go into a subdirectory like

Character Sequence Generation

2005-09-22 Thread Jeff Schwab
What's the best way to generate a sequence of characters in Python? I'm looking for something like this Perl code: 'a' .. 'z' . -- http://mail.python.org/mailman/listinfo/python-list

Re: Character Sequence Generation

2005-09-22 Thread Jeff Schwab
[EMAIL PROTECTED] wrote: Jeff Schwab wrote: What's the best way to generate a sequence of characters in Python? I'm looking for something like this Perl code: 'a' .. 'z' . import string print string.ascii_lowercase abcdefghijklmnopqrstuvwxyz Thanks. Is there a good way to generate

Re: What is self?

2005-09-23 Thread Jeff Schwab
Rick Wotnaz wrote: Roy Smith [EMAIL PROTECTED] wrote in news:[EMAIL PROTECTED]: Ron Adam [EMAIL PROTECTED] wrote: You can actually call it anything you want but self is sort of a tradition. That's true, but I think needs to be said a bit more emphatically. There's no reason to call it

Re: Character Sequence Generation

2005-09-23 Thread Jeff Schwab
Pedro Werneck wrote: On Thu, 22 Sep 2005 23:26:58 -0400 Jeff Schwab [EMAIL PROTECTED] wrote: What's the best way to generate a sequence of characters in Python? I'm looking for something like this Perl code: 'a' .. 'z' . If you want arbitrary sequences, you may use something like

Re: Best practices for dynamically loading plugins at startup

2005-09-25 Thread Jeff Schwab
Christoph Haas wrote: Dear coders... I'm working on an application that is supposed to support plugins. The idea is to use the plugins as packages like this: Plugins/ __init__.py Plugin1.py Plugin2.py Plugin3.py When the application starts up I want to have these modules

Re: Best practices for dynamically loading plugins at startup

2005-09-26 Thread Jeff Schwab
Christoph Haas wrote: On Sun, Sep 25, 2005 at 11:33:03PM -0400, Jeff Schwab wrote: I recently came up against this exact problem. My preference is to have the plugin writer call a method to register the plugins, as this allows him the most control. Something along these lines: class

Re: 1 Million users.. I can't Scale!!

2005-09-28 Thread Jeff Schwab
[EMAIL PROTECTED] wrote: Damjan Is there some python module that provides a multi process Queue? Skip Not as cleanly encapsulated as Queue, but writing a class that Skip does that shouldn't be all that difficult using a socket and the Skip pickle module. Jeremy What

Re: 1 Million users.. I can't Scale!!

2005-09-28 Thread Jeff Schwab
[EMAIL PROTECTED] wrote: Jeff How many are more than a few? I don't know. What can you do today in commercial stuff, 16 processors? How many cores per die, two? Four? We're still talking 100 processors with access to the same chunk of memory. For the OP's problem that's still 10,000

Re: converting Word to MediaWiki

2005-09-28 Thread Jeff Schwab
ChiTownBob wrote: Perl just sucks, as all good Python hackers know! I disagree. Perl has saved my butt more times than I care to count. Python certainly has its advantages, but I won't be giving up Perl any time soon. -- http://mail.python.org/mailman/listinfo/python-list

Re: A rather unpythonic way of doing things

2005-09-29 Thread Jeff Schwab
Peter Corbett wrote: One of my friends has recently taken up Python, and was griping a bit about the language (it's too prescriptive for his tastes). In particular, he didn't like the way that Python expressions were a bit crippled. So I delved a bit into the language, and found some sources

Re: A rather unpythonic way of doing things

2005-09-29 Thread Jeff Schwab
fraca7 wrote: Richie Hindle a écrit : [Peter] http://www.pick.ucam.org/~ptc24/yvfc.html [Jeff] Yuma Valley Agricultural Center? Yaak Valley Forest Council? I went through the same process. My guess is Yes, Very F'ing Clever. Peter? print ''.join(map(lambda x: chrord(x) -

Re: 1 Million users.. I can't Scale!!

2005-09-29 Thread Jeff Schwab
Aahz wrote: In article [EMAIL PROTECTED], Jeff Schwab [EMAIL PROTECTED] wrote: Sure, multiple machines are probably the right approach for the OP; I didn't mean to disagree with that. I just don't think they are the only practical way for a multi-process application to scale beyond a few

Re: Distributing programs

2005-10-02 Thread Jeff Schwab
Jason wrote: A non-python programming friend of mine has said that any programs made with Python must be distributed with, or an alternative link, to the source of the program. Is this true? Sorta, but not really. Typically, you might distribute the source (.py) files, but if you

Re: Program help

2005-10-02 Thread Jeff Schwab
FX wrote: can anybody write a code for a program that reads from a /location/file according to file contents, it execute script. e.g. if file contains mp it runs media player. I hope the code is small .. plz help me out! You might be interested in the FileInfo class, defined and thoroughly

Re: Proposed new collection methods

2005-08-06 Thread Jeff Schwab
Robert Kern wrote: Robert Kern wrote: Christopher Subich wrote: Dear Zeus no. Find can be defined as: def find(self, test=lambda x:1): try: item = (s for s in iter(self) if test(s)).next() except StopIteration: raise ValueError('No matching items in list') I would

Re: Proposed new collection methods

2005-08-06 Thread Jeff Schwab
Robert Kern wrote: (s for s in iter(self) is test(s)) is a generator expression. It is roughly equivalent to def g(self, test=lambda x: True): for s in iter(self): if test(s): yield s Now, if I were to do item = g(self, test).next() the generator would

Re: Creating a virtual file system

2005-08-07 Thread Jeff Schwab
Atila Olah wrote: I'm working on a project to implement a simple cross-platform file sharing protocol (using Python) that is similar to HTTP, and I have to write a GUI for Windows and Linux. But let's start with the harder one: Windows. My question is: How do I implement a virtual partition

Re: Creating a virtual file system

2005-08-09 Thread Jeff Schwab
Bryan Olson wrote: Atila Olah wrote: My question is: How do I implement a virtual partition that acts like a real file-system and is compleatly transparent to other programs? Should I make a virtual file allocation table for a FAT32 partition or simulate an NTFS? Or even further:

Re: Recommendations for CVS systems

2005-08-09 Thread Jeff Schwab
Mike Meyer wrote: Well, the only thing that subversion does that I'd call bad is leave turds in my development directory. I'm tired of having to tell commands to ignore .svn files. Of course, Perforce is the only source control system I know of that doesn't do this. ClearCase is really good

Re: Is there a way of executing a command in a string?

2005-08-09 Thread Jeff Schwab
Jerry He wrote: Hi, suppose I have the following string cmdstr = b = lambda s: s*s Is there a way to execute this string other than copying it onto a file and then importing it? exec b = lambda s: s*s b function lambda at 0x4d69cc --

Re: Help with Regular Expressions

2005-08-10 Thread Jeff Schwab
Harlin Seritt wrote: I am trying to find some matches and have them put into a list when processing is done. I'll use a simple example like email addresses. My input is the following: wordList = ['myname1', '[EMAIL PROTECTED]', '[EMAIL PROTECTED]', '[EMAIL PROTECTED]', '[EMAIL PROTECTED]']

Re: how to write a line in a text file

2005-08-10 Thread Jeff Schwab
Calvin Spealman wrote: On 7/31/05, James Dennett [EMAIL PROTECTED] wrote: Peter Hansen wrote: Steven D'Aprano wrote: Given that ZODB and PySQLite are simply Python extension modules, which get bundled by your builder tool and are therefore installed transparently along with your app by your

Re: Regular expression to match a #

2005-08-11 Thread Jeff Schwab
John Machin wrote: Search for r'^something' can never be better/faster than match for r'something', and with a dopey implementation of search [which Python's re is NOT] it could be much worse. So please don't tell newbies to search for r'^something'. How else would you match the beginning

Re: Python Challenge on BBC

2005-08-11 Thread Jeff Schwab
Magnus Lie Hetland wrote: Just saw this on the BBC World program Click Online: http://bbcworld.com/content/template_clickonline.asp?pageid=665co_pageid=6 I must say, I think this is the first time I've heard Python discussed on TV at all... Cool :) (Now maybe I'll have to finish the

Re: How do these Java concepts translate to Python?

2005-08-11 Thread Jeff Schwab
Ray wrote: Devan L wrote: Fausto Arinos Barbuto wrote: Ray wrote: 1. Where are the access specifiers? (public, protected, private) AFAIK, there is not such a thing in Python. ---Fausto Well, technically you can use _attribute to mangle it, but technically speaking, there are no

Re: Running one Python program from another as a different user

2005-08-12 Thread Jeff Schwab
[EMAIL PROTECTED] wrote: Greetings- This is on Linux... I have a daemon running as root and I want to execute another Python program as another user (a regular user). I have the name of the user and can use the 'pwd' and 'grp' modules to get that user's user and group ids. What I don't

Re: Running one Python program from another as a different user

2005-08-12 Thread Jeff Schwab
[EMAIL PROTECTED] wrote: Thanks, that looks very promising... Is there a solution for pre-Python v2.4? I have to have code that works on 2.x, 0=x=4. Do I just use the os.popen instead? import os def run_as(username): pipe = os.popen(su %s % username, 'w') pipe.write(whoami)

Re: Spaces and tabs again

2005-08-13 Thread Jeff Schwab
[EMAIL PROTECTED] wrote: Hello, I know this topic was discussed a *lot* in the past, sorry if it bores you... From the Daily Python-URL I've seen this interesting Floating Point Benchmark: http://www.fourmilab.ch/fourmilog/archives/2005-08/000567.html This is the source pack:

Re: Spaces and tabs again

2005-08-13 Thread Jeff Schwab
Christopher Subich wrote: [EMAIL PROTECTED] wrote: Are you kidding? You are going to MANDATE spaces? Actually, future whitespace rules will be extensive. See: http://64.233.187.104/search?q=cache:k1w9oZr767QJ:www.artima.com/weblogs/viewpost.jsp%3Fthread%3D101968 (google cache of

Re: How can I exclude a word by using re?

2005-08-14 Thread Jeff Schwab
could ildg wrote: In re, the punctuation ^ can exclude a single character, but I want to exclude a whole word now. for example I have a string hi, how are you. hello, I want to extract all the part before the world hello, I can't use .*[^hello] because ^ only exclude single char h or e or l

Re: get the return code when piping something to a python script?

2005-08-16 Thread Jeff Schwab
mhenry1384 wrote: On WinXP, I am doing this nant.exe | python MyFilter.py This command always returns 0 (success) because MyFilter.py always succeeds. ... How do I set the return code from MyFilter.py based on the return of nant.exe? Is this possible? I have googled around for an

Re: Database of non standard library modules...

2005-08-19 Thread Jeff Schwab
Steve Holden wrote: Robert Kern wrote: Jon Hewer wrote: Is there an online database of non standard library modules for Python? http://cheeseshop.python.org/pypi While cheeseshop might resonate with the Monty Python fans I have to say I think the name sucks in terms of explaining

Re: stdin - stdout

2005-08-20 Thread Jeff Schwab
max(01)* wrote: i was wondering, what's the simplest way to echo the standard input to the standard output, with no modification. ... ps: in perl you ca do this: ... while ($line = STDIN) { print STDOUT ($line); } ... I guess you could, but there wouldn't be much point. In

Re: Please Criticize My Code

2005-08-20 Thread Jeff Schwab
Christoph Rackwitz wrote: i guess, it is pythonchallenge.com level 10? if so, i used this thing: import re def enc(s): return ''.join('%s%s' % (len(a[0]),a[0][0]) for a in re.findall('((.)\\2*)', s)) Don't do that! -- http://mail.python.org/mailman/listinfo/python-list

Re: last line chopped from input file

2005-08-21 Thread Jeff Schwab
Eric Lavigne wrote: Here is a shell command (MS-DOS): debug\curve-fit input.txt output.txt And here is a Python script that *should* do the same thing (and almost does): Python equivalent is roughly: import os import subprocess

Re: Gimp-Python

2005-08-21 Thread Jeff Schwab
danilo wrote: Salve, qualcuno sa se è ancora in fase di sviluppo e qual'è il sito di riferimento? Grazie Danilo Gesundheit. -- http://mail.python.org/mailman/listinfo/python-list

Re: Binary Trees in Python

2005-08-21 Thread Jeff Schwab
Jorgen Grahn wrote: On Sat, 20 Aug 2005 15:19:55 -0400, Roy Smith [EMAIL PROTECTED] wrote: In article [EMAIL PROTECTED], [diegueus9] Diego Andrés Sanabria [EMAIL PROTECTED] wrote: Hello!!! I want know if python have binary trees and more? Python does not come with a tree data structure.

Re: Doubt C and Python

2005-08-23 Thread Jeff Schwab
praba kar wrote: Dear All, I want to know the link between c and python. Some people with C background use Python instead of programming in C.why? For me, the choice is typically among C++, Perl, Python, and Java. The arguments for Python relative to these languages are:

Re: NooB Question

2005-08-29 Thread Jeff Schwab
APCass wrote: How do you execute a .py in Linux with KDE? If I double click on my program it opens Kwrite, for editing. Try inserting this as the first line of the file: #!/usr/bin/env python -- http://mail.python.org/mailman/listinfo/python-list

Re: getting text from WinXP console

2005-03-21 Thread Jeff Schwab
Lucas Raab wrote: Chris Maloof wrote: Hello, Does anyone know how I can read the ASCII text from a console window (from another application) in WinXP? It doesn't sound like a major operation, but although I can find the window via pywin32, I haven't been able to do anything with it. I'd really

Re: Getting the word to conventional programmers

2005-03-22 Thread Jeff Schwab
Peter Maas wrote: Peter Hansen schrieb: Cameron Laird wrote: *DevSource* profiles The State of the Scripting Universe in URL: http://www.devsource.com/article2/0,1759,1778141,00.asp . Which, sadly, doesn't seem to work with Firefox here, though IE shows it fine. :-( Mozilla 1.7.3 shows it fine,

Re: Why not a Python compiler?

2008-02-05 Thread Jeff Schwab
Steve Holden wrote: [EMAIL PROTECTED] wrote: Why not a Python COMPILER? What about a Python JIT hardware chip, so the CPU doesn't have to translate. Although it seems to me that with today's dual and quad core processors that this might be a mute point because you could just use one of the

Re: Looking for library to estimate likeness of two strings

2008-02-06 Thread Jeff Schwab
Tim Chase wrote: Are there any Python libraries implementing measurement of similarity of two strings of Latin characters? It sounds like you're interested in calculating the Levenshtein distance: http://en.wikipedia.org/wiki/Levenshtein_distance which gives you a measure of how

Re: Looking for library to estimate likeness of two strings

2008-02-06 Thread Jeff Schwab
Steven D'Aprano wrote: On Wed, 06 Feb 2008 17:32:53 -0600, Robert Kern wrote: Jeff Schwab wrote: ... If the strings happen to be the same length, the Levenshtein distance is equivalent to the Hamming distance. ... I'm afraid that it isn't. Using Magnus Lie Hetland's implementation

Re: Why not a Python compiler?

2008-02-08 Thread Jeff Schwab
Grant Edwards wrote: On 2008-02-08, Arnaud Delobelle [EMAIL PROTECTED] wrote: the compiler could do little else except translate it to something like: (python:add a b) [snip more interesting considerations about compiling python] Please get back on topic. This discussion is about

Re: Why not a Python compiler?

2008-02-08 Thread Jeff Schwab
Luis M. González wrote: On 8 feb, 22:15, Marc 'BlackJack' Rintsch [EMAIL PROTECTED] wrote: On Fri, 08 Feb 2008 17:45:36 +, Grant Edwards wrote: On 2008-02-08, Arnaud Delobelle [EMAIL PROTECTED] wrote: Please get back on topic. This discussion is about parsecs and wookies now. What's a

Re: sort functions in python

2008-02-08 Thread Jeff Schwab
Steven D'Aprano wrote: On Fri, 08 Feb 2008 17:00:27 -0800, t3chn0n3rd wrote: Do you think it is relatively easy to write sort algorithms such as the common Bubble sort in Python as compared to other high level programming langauges You realise that bubble sort is one of the worst

Re: OT: Speed of light [was Re: Why not a Python compiler?]

2008-02-09 Thread Jeff Schwab
Grant Edwards wrote: On 2008-02-09, Thomas Dybdahl Ahle [EMAIL PROTECTED] wrote: On Sat, 2008-02-09 at 14:56 +0100, Martin P. Hellwig wrote: Propagate, travel, what's the difference? Unfortunately, I didn't study any of this but I sure do remember the answer one drunk physic said to me in a

Re: sort functions in python

2008-02-09 Thread Jeff Schwab
Carl Banks wrote: On Feb 8, 10:09 pm, Jeff Schwab [EMAIL PROTECTED] wrote: If you expect your data to be pretty nearly sorted already, but you just want to make sure (e.g. because a small number of elements may have been inserted or removed since the last sort), bubble-sort is a good choice

Re: sort functions in python

2008-02-09 Thread Jeff Schwab
Steven D'Aprano wrote: On Fri, 08 Feb 2008 19:09:06 -0800, Jeff Schwab wrote: Steven D'Aprano wrote: On Fri, 08 Feb 2008 17:00:27 -0800, t3chn0n3rd wrote: Do you think it is relatively easy to write sort algorithms such as the common Bubble sort in Python as compared to other high level

Re: sort functions in python

2008-02-09 Thread Jeff Schwab
Steven D'Aprano wrote: On Sat, 09 Feb 2008 13:37:23 -0800, Jeff Schwab wrote: Carl Banks wrote: On Feb 8, 10:09 pm, Jeff Schwab [EMAIL PROTECTED] wrote: If you expect your data to be pretty nearly sorted already, but you just want to make sure (e.g. because a small number of elements may

Re: Is there an easy way to sort a list by two criteria?

2008-02-09 Thread Jeff Schwab
neocortex wrote: Hello! I am a newbie in Python. Recently, I get stuck with the problem of sorting by two criteria. In brief, I have a two-dimensional list (for a table or a matrix). Now, I need to sort by two columns, but I cannot figure out how to do that. I read somewhere that it is

Re: sort functions in python

2008-02-10 Thread Jeff Schwab
Steven D'Aprano wrote: On Sat, 09 Feb 2008 14:28:15 -0800, Jeff Schwab wrote: Steven D'Aprano wrote: On Sat, 09 Feb 2008 13:37:23 -0800, Jeff Schwab wrote: Carl Banks wrote: On Feb 8, 10:09 pm, Jeff Schwab [EMAIL PROTECTED] wrote: If you expect your data to be pretty nearly sorted already

Re: Turn off ZeroDivisionError?

2008-02-10 Thread Jeff Schwab
Neal Becker wrote: [EMAIL PROTECTED] wrote: Would a wrapper function be out of the question here? def MyDivision(num, denom): if denom==0: return NaN else return num / denom I bought a processor that has hardware to implement this. Why do I want software to

Re: Turn off ZeroDivisionError?

2008-02-10 Thread Jeff Schwab
Grant Edwards wrote: On 2008-02-10, Jeff Schwab [EMAIL PROTECTED] wrote: Neal Becker wrote: [EMAIL PROTECTED] wrote: Would a wrapper function be out of the question here? def MyDivision(num, denom): if denom==0: return NaN else return num / denom I bought

Re: OT: Speed of light [was Re: Why not a Python compiler?]

2008-02-11 Thread Jeff Schwab
Erik Max Francis wrote: Robert Bossy wrote: Grant Edwards wrote: After repeated attempts at the tasks set for them in the experiments, the subjects would learn strategies that would work in a Newtonian world, but the initial intuitive reactions were very non-Newtonian (regardless of how

Re: OT: Speed of light [was Re: Why not a Python compiler?]

2008-02-11 Thread Jeff Schwab
Erik Max Francis wrote: Jeff Schwab wrote: Erik Max Francis wrote: Robert Bossy wrote: I'm pretty sure we can still hear educated people say that free fall speed depends on the weight of the object without realizing it's a double mistake. Well, you have to qualify it better than

Re: OT: Speed of light [was Re: Why not a Python compiler?]

2008-02-11 Thread Jeff Schwab
Erik Max Francis wrote: Grant Edwards wrote: On 2008-02-12, Jeff Schwab [EMAIL PROTECTED] wrote: Fair enough! Dear me, what's Usenet coming to these days... I know, really. Sheesh! Jeff, I won't stand for that! Argue with me! :-) OK, uh... You're a poopy-head. Forgive the cliché

Re: OT: Star Wars and parsecs [was Re: Why not a Python compiler?]

2008-02-11 Thread Jeff Schwab
Grant Edwards wrote: On 2008-02-10, [EMAIL PROTECTED] [EMAIL PROTECTED] wrote: ? ? ? A Parsec is a fixed value (which, admittedly, presumes the culture developed a 360degree circle broken into degrees = minutes = seconds... or, at least, some units compatible with the concept of an arc

Re: OT: Speed of light [was Re: Why not a Python compiler?]

2008-02-11 Thread Jeff Schwab
Erik Max Francis wrote: Jeff Schwab wrote: So what's the double mistake? My understanding was (1) the misuse (ok, vernacular use) of the term free fall, and (2) the association of weight with free-fall velocity (If I tie an elephant's tail to a mouse's, and drop them both into free fall

Re: OT: Speed of light [was Re: Why not a Python compiler?]

2008-02-11 Thread Jeff Schwab
Erik Max Francis wrote: Jeff Schwab wrote: Erik Max Francis wrote: Grant Edwards wrote: On 2008-02-12, Jeff Schwab [EMAIL PROTECTED] wrote: Fair enough! Dear me, what's Usenet coming to these days... I know, really. Sheesh! Jeff, I won't stand for that! Argue with me! :-) OK

Re: Python equivt of __FILE__ and __LINE__

2008-02-12 Thread Jeff Schwab
Gabriel Genellina wrote: En Tue, 12 Feb 2008 14:41:20 -0200, Jeff Schwab [EMAIL PROTECTED] escribi�: def line(): try: raise Exception except: return sys.exc_info()[2].tb_frame.f_back.f_lineno def file

Re: mmap and shared memory

2008-02-12 Thread Jeff Schwab
greg wrote: Carl Banks wrote: In C you can use the mmap call to request a specific physical location in memory (whence I presume two different processes can mmap anonymous memory block in the same location) Um, no, it lets you specify the *virtual* address in the process's address space at

Re: Python equivt of __FILE__ and __LINE__

2008-02-12 Thread Jeff Schwab
Gabriel Genellina wrote: En Tue, 12 Feb 2008 16:20:12 -0200, Jeff Schwab [EMAIL PROTECTED] escribió: What about the following? Should the underscores be omitted from the method names, for consistency with inspect? I prefer the names_with_underscore, the current style recommended

Re: dream hardware

2008-02-12 Thread Jeff Schwab
On Feb 12, 2008 1:05 PM, [EMAIL PROTECTED] wrote: What is dream hardware for the Python interpreter? Warren Myers wrote: A Cray? What are you trying to do? dream hardware is a very wide question. The only dream hardware I know of is the human brain. I have a slightly used one myself,

Re: Python equivt of __FILE__ and __LINE__

2008-02-12 Thread Jeff Schwab
alain wrote: On Feb 11, 10:58 am, Bill Davy [EMAIL PROTECTED] wrote: Writing a quick and dirty assembler and want to give the user the location of an error. The assembly language is Python. If the user wants to generat some object code they write something like: Label(LoopLable)

Re: dream hardware

2008-02-12 Thread Jeff Schwab
Steven D'Aprano wrote: On Tue, 12 Feb 2008 10:05:59 -0800, castironpi wrote: What is dream hardware for the Python interpreter? I'm not sure that the Python interpreter actually does dream, but if it's anything like me, it's probably a giant computer the size of a bus, made out of

Re: OT: Speed of light [was Re: Why not a Python compiler?]

2008-02-13 Thread Jeff Schwab
Jeroen Ruigrok van der Werven wrote: -On [20080212 22:15], Dotan Cohen ([EMAIL PROTECTED]) wrote: Note that Google will give a calculator result for 1 kilogram in pounds, but not for 1 kilogram in inches. I wonder why not? After all, both are conversions of incompatible measurements, ie, they

Re: Python equivt of __FILE__ and __LINE__

2008-02-13 Thread Jeff Schwab
alain wrote: On Feb 12, 7:44 pm, Jeff Schwab [EMAIL PROTECTED] wrote: It still would be nice to have syntax as clean as __FILE__ and __LINE__. There exists an undocumented builtin called __file__, but unfortunately no corresponding __line__ Drat! So close! Thanks for the info. Oh well

Re: OT: Speed of light

2008-02-13 Thread Jeff Schwab
Hrvoje Niksic wrote: Jeff Schwab [EMAIL PROTECTED] writes: Jeroen Ruigrok van der Werven wrote: -On [20080212 22:15], Dotan Cohen ([EMAIL PROTECTED]) wrote: Note that Google will give a calculator result for 1 kilogram in pounds, but not for 1 kilogram in inches. I wonder why not? After

Re: Big time WTF with generators - bug?

2008-02-13 Thread Jeff Schwab
Steve Holden wrote: James Stroud wrote: [...] I then append the growing list of series generator into the serieses list (serieses is plural for series if your vocablulary isn't that big). Not as big as your ego, apparently ;-) And don't be coming back with any argumentses. Nasty

Re: OT: Speed of light [was Re: Why not a Python compiler?]

2008-02-13 Thread Jeff Schwab
Grant Edwards wrote: On 2008-02-13, Jeff Schwab [EMAIL PROTECTED] wrote: Eh? Last I checked both pound and kilogram are units of mass, so where is the incompatibility? I've never heard of pound as a unit of mass. At least where I went to school (Boston, MA), pound is the English unit

Re: OT: Speed of light

2008-02-13 Thread Jeff Schwab
David H Wild wrote: In article [EMAIL PROTECTED], Jeff Schwab [EMAIL PROTECTED] wrote: We (Americans) all measure our weight in pounds. People talk about how much less they would weigh on the moon, in pounds, or even near the equator (where the Earth's radius is slightly higher

Re: Floating point bug?

2008-02-13 Thread Jeff Schwab
[EMAIL PROTECTED] wrote: I've never had any call to use floating point numbers and now that I want to, I can't! *** Python 2.5.1 (r251:54863, May 1 2007, 17:47:05) [MSC v.1310 32 bit (Intel)] on win32. *** float (.3) 0.2 foo = 0.3 foo 0.2 A classic (if

Re: mmap and shared memory

2008-02-13 Thread Jeff Schwab
Nikita the Spider wrote: In article [EMAIL PROTECTED], Jeff Schwab [EMAIL PROTECTED] wrote: greg wrote: Carl Banks wrote: In C you can use the mmap call to request a specific physical location in memory (whence I presume two different processes can mmap anonymous memory block in the same

Re: Floating point bug?

2008-02-14 Thread Jeff Schwab
Dennis Lee Bieber wrote: On Wed, 13 Feb 2008 17:49:08 -0800, Jeff Schwab [EMAIL PROTECTED] declaimed the following in comp.lang.python: If you need a pretty string for use in code: def pretty_fp(fpnum, prec=8): ... return ('%.8f' % fpnum).rstrip('0

Re: Floating point bug?

2008-02-14 Thread Jeff Schwab
Christian Heimes wrote: Dennis Lee Bieber wrote: What's wrong with just str(0.3) that's what print invokes, whereas the interpreter prompt is using repr(0.3) No, print invokes the tp_print slot of the float type. Some core types have a special handler for print. The

Re: RELEASED Python 2.5.2, release candidate 1

2008-02-14 Thread Jeff Schwab
Carl Banks wrote: On Feb 14, 6:16 pm, Martin v. Löwis [EMAIL PROTECTED] wrote: On behalf of the Python development team and the Python community, I'm happy to announce the release of Python 2.5.2 (release candidate 1). Um. If it's only a release *candidate* of 2.5.2, and not yet a *release*

Re: RELEASED Python 2.5.2, release candidate 1

2008-02-14 Thread Jeff Schwab
Paul Rubin wrote: I join everyone else in thanking Martin for his work on this whole effort. This wording and naming thing is a trivial subtopic. Ditto! The list of fixes is impressive. Kudos to everyone who everyone responsible for the changes, and for keeping them organized and

Re: Floating point bug?

2008-02-14 Thread Jeff Schwab
Zentrader wrote: That's a misconception. The decimal-module has a different base (10 instead of 2), and higher precision. But that doesn't change the fact that it will expose the same rounding-errors as floats do - just for different numbers. import decimal as d d = d.Decimal d(1) /

Re: copying files through Python

2008-02-15 Thread Jeff Schwab
[EMAIL PROTECTED] wrote: On Feb 13, 10:50 pm, Lalit [EMAIL PROTECTED] wrote: I need to write a program which would transfer files under one folder structure (there are sub folders) to single folder. troll find /fromdir -exec mv {} /todir \; -print /troll -type f --

Re: QOTW: Re: dream hardware

2008-02-15 Thread Jeff Schwab
[EMAIL PROTECTED] wrote: On Feb 14, 10:50 pm, [EMAIL PROTECTED] (Aahz) wrote: In article [EMAIL PROTECTED], Steven D'Aprano [EMAIL PROTECTED] wrote: On Tue, 12 Feb 2008 10:05:59 -0800, castironpi wrote: What is dream hardware for the Python interpreter? I'm not sure that the Python

Re: What's the standard for code docs?

2008-02-15 Thread Jeff Schwab
Preston Landers wrote: Hey guys and gals. What are all the cool kids using these days to document their code? My goal is to create in-line documentation of each package/module/class/method and create some semi-nice looking (or at least usable) packaged documentation from it, in HTML and/or

Re: Turn off ZeroDivisionError?

2008-02-15 Thread Jeff Schwab
Steve Holden wrote: Mark Dickinson wrote: On Feb 14, 11:09 pm, John Nagle [EMAIL PROTECTED] wrote: You also need to think about how conditionals interact with quiet NANs. Properly, comparisons like have three possibilities: True. There was a recent change to Decimal to make

Re: linux disc space

2008-02-15 Thread Jeff Schwab
Chris wrote: On Feb 15, 7:10 pm, DataSmash [EMAIL PROTECTED] wrote: I simply want to capture the free disc space in a variable so that I can compare changes. I'm aware of a few commands like df -h or du - k, but I can't figure out how to capture those values as a variable. I also looked at

Re: Floating point bug?

2008-02-15 Thread Jeff Schwab
Zentrader wrote: I disagree with this statement quoteBut that doesn't change the fact that it will expose the same rounding-errors as floats do - just for different numbers. /quote The example used has no rounding errors. I think we're using the term rounding error to mean different things.

Re: linux disc space

2008-02-15 Thread Jeff Schwab
Christian Heimes wrote: Jeff Schwab wrote: I'm not sure how superuser-only space would be reserved in the first place. I don't see anything relevant in the fdisk man page. man mkfs :) Thank you. Looks like the feature is only supported by particular file systems. I don't see

Re: Looking for a Python Program/Tool That Will Add Line Numbers to a txt File

2008-02-15 Thread Jeff Schwab
W. Watson wrote: See Subject. It's a simple txt file, each line is a Python stmt, but I need up to four digits added to each line with a space between the number field and the text. Perhaps someone has already done this or there's a source on the web for it. I'm not yet into files with

Re: linux disc space

2008-02-15 Thread Jeff Schwab
DataSmash wrote: On Feb 15, 1:32 pm, Jeff Schwab [EMAIL PROTECTED] wrote: Chris wrote: On Feb 15, 7:10 pm, DataSmash [EMAIL PROTECTED] wrote: I simply want to capture the free disc space in a variable so that I can compare changes. I'm aware of a few commands like df -h or du - k, but I

Re: linux disc space

2008-02-15 Thread Jeff Schwab
Steve Holden wrote: Jeff Schwab wrote: I'm not sure how superuser-only space would be reserved in the first place. I don't see anything relevant in the fdisk man page. The UFS and ext2 filesystem space allocation routines become very inefficient when free space gets too low, so

Re: Floating point bug?

2008-02-15 Thread Jeff Schwab
Steven D'Aprano wrote: On Fri, 15 Feb 2008 10:55:47 -0800, Zentrader wrote: I disagree with this statement quoteBut that doesn't change the fact that it will expose the same rounding-errors as floats do - just for different numbers. /quote The example used has no rounding errors. Of

Re: seperate directory for .pyc files

2008-02-15 Thread Jeff Schwab
Amit Gupta wrote: Python'ites Is there an environment variable or some settings, that python can use to know the directory name for dumping .pyc files. Not a hard-requirement, I just don't like pyc files alongwith py files in my work area. Does this help? # ls.py import subprocess

Re: Turn off ZeroDivisionError?

2008-02-15 Thread Jeff Schwab
Paul Rubin wrote: Mark Dickinson [EMAIL PROTECTED] writes: But the IEEE standard only supports one of them, aleph(0). Technically two: plus and minus aleph(0). Not sure that alephs have anything to do with it. They really do not. The extended real line can be modelled in set theory, but

Re: Passing a callable object to Thread

2008-02-15 Thread Jeff Schwab
Paul Rubin wrote: Jeff Schwab [EMAIL PROTECTED] writes: Why not? They seem intuitive to me. I would find it weird if you couldn't have 0-tuple, and even weirder if you couldn't have a 1-tuple. Maybe my brain has been warped by too much C++ code. The idea is that a 2-tuple (of numbers

Re: Passing a callable object to Thread

2008-02-15 Thread Jeff Schwab
Steve Holden wrote: Paul Rubin wrote: Steve Holden [EMAIL PROTECTED] writes: Assuming you're right, what alternative would you suggest? Would it allow parenthesized expressions to retain their customary meaning? It is kind of weird that there is even such a thing as a 1-tuple. I agree

[OT] Re: TRAC - Trac, Project Leads, Python, and Mr. Noah Kantrowitz (sanitizer)

2008-02-16 Thread Jeff Schwab
Ilias Lazaridis wrote: Essence: snipSpam spam spam spam.../snip I just looked at your resume. What is Abstract Project Management? -- http://mail.python.org/mailman/listinfo/python-list

Re: TRAC - Trac, Project Leads, Python, and Mr. Noah Kantrowitz (sanitizer)

2008-02-16 Thread Jeff Schwab
Robert Klemme wrote: On 16.02.2008 13:16, Ilias Lazaridis wrote: snip/ Oh, it's him again. Please do not respond. http://dev.eclipse.org/newslists/news.eclipse.foundation/msg00167.html http://www.encyclopediadramatica.com/index.php/Ilias Thank you. I didn't recognize his name at

Re: QOTW: Re: dream hardware

2008-02-16 Thread Jeff Schwab
Aahz wrote: In article [EMAIL PROTECTED], Jeff Schwab [EMAIL PROTECTED] wrote: [EMAIL PROTECTED] wrote: On Feb 14, 10:50 pm, [EMAIL PROTECTED] (Aahz) wrote: In article [EMAIL PROTECTED], Steven D'Aprano [EMAIL PROTECTED] wrote: On Tue, 12 Feb 2008 10:05:59 -0800, castironpi wrote: What

Re: How about adding rational fraction to Python?

2008-02-16 Thread Jeff Schwab
Lie wrote: Would all these problems with floating points be a rational reason to add rational numbers support in Python or Py3k? (pun not intended) I agree, there are some numbers that is rationals can't represent (like pi, phi, e) but these rounding problems also exist in floating points,

  1   2   3   >