Re: DOS or not? [was Re: How to tell Script to use pythonw.exe ?]

2013-07-03 Thread Jeff Schwab
On 2013-07-03 13:19:26 +, Steven D'Aprano said: On Wed, 03 Jul 2013 14:00:49 +0100, Tim Golden wrote: Goodness, I doubt if you'll find anyone who can seriously make a case that the Windows command prompt is all it might be. I'm not a Powershell user myself but people speak highly of it.

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 > > >>>&

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'

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&

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 thes

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. Som

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. > > Jere

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

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 sour

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? >> > > pri

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

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 thorou

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 i

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 generato

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 part

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 fu

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 goo

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 at 0x4d69cc> -- http://mail.python.org/mailman/listinfo/p

Re: Creating a virtual file system

2005-08-09 Thread Jeff Schwab
Bryan Olson wrote: > Jeff Schwab wrote: > > You don't have to pay Microsoft to develop a Windows-compatible > > filesystem. See http://ubiqx.org/cifs/. > > That's a different usage of "filesystem" than what is at issue > here. I agree that you &

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 PROTECT

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 alon

Re: What is Python?!

2005-08-10 Thread Jeff Schwab
bruno modulix wrote: > bash is a scripting language, Bash is a shell. It is frequently used for scripting, but that is only a secondary purpose. > javascript is a scripting language, Yes, but it's a particularly specialized one. > perl is a scripting language, Blasphemy! Perl is a dynamic l

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 beginn

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=665&co_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 fini

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 technic

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 un

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("w

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: > ht

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

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 "

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

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 ter

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 = ) > { > print STDOUT ("$line"); > } > ... I guess you could, but there wouldn't be much point.

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 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 subprocess.Popen([os.path.join("debug", "

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 wi

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: 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

[OT] Re: Hi Guys. First Time Poster

2005-03-20 Thread Jeff Schwab
sheldon279 wrote: Hi guys. First time poster long time reader. Just wanted to say "Hi" ;) On a side note my Hubby is REAL excited about this new IPO stock GRDX. They just started trading this one like 2 days ago. It's already almost doubled in just 2 days! My Husband is really excited about this st

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 ju

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 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, too

Re: Does anyone else use this little idiom?

2008-02-02 Thread Jeff Schwab
How [EMAIL PROTECTED] wrote: > Ruby has a neat little convenience when writing loops where you don't > care about the loop index: you just do n.times do { ... some > code ... } where n is an integer representing how many times you want > to execute "some code." > > In Python, the direct translatio

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 >> u

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 ho

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

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 discu

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

Re: sort functions in python

2008-02-08 Thread Jeff Schwab
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 http://www.codecodex.com/wiki/index.php?title=Bubble_sort -- http://mail.python.org/mailman/listinfo/python-list

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 wo

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 phys

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

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

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 >>>

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 po

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 Sch

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

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,

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 (regardle

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&#

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!

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 t

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 a

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

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: >> retu

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

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_wit

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

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(Loop

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 o

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,

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

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 >>

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.

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 wher

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 (

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.299

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

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): >>

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 hand

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

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 document

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

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. > > > > find /fromdir -exec mv {} /todir \; -print > > -type f -- http://mail.py

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 tha

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/o

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

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 al

Re: Floating point bug?

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

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

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 P

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 com

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 > inefficien

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 >> But that doesn't change the fact that it will expose the same >> rounding-errors as floats do - just for different numbers. The >> example used has no rounding errors. > > Of cour

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 >

  1   2   3   >