Re: What kind of program is this

2006-10-03 Thread Peter Otten
Dennis Lee Bieber wrote: > ##aJAPy = "%s %s %s" % ('J' 'A' 'Py','','') > #   That should fail -- three format codes, and five output values No. 'JAPy' is a single string, oddly written: >>> 'J' 'A' 'Py' 'JAPy' Peter -- http://mail.python.org/mailman/listinfo/python-list

Re: Python to use a non open source bug tracker?

2006-10-03 Thread Martin v. Löwis
Paul Rubin schrieb: > "Martin v. Löwis" <[EMAIL PROTECTED]> writes: >> It is a fork of an old version. Existence of this version hasn't helped >> a bit when we tried to get our data out of sf.net. > > Yeah, I'd guessed it might be a fork. Is there stuff in sf.net that a > web robot can't retrieve

Re: How to get keyboard event in Linux console?

2006-10-03 Thread Sybren Stuvel
Jia,Lu enlightened us with: > I want to deal keyboard event in Linux console. > Example: I Create a deamon at background and when I press F1 key > then print Hello at Console. Type "who" and see which PTY you're connected to: sybren pts/02006-10-04 07:55 (klappie.stuvel.eu) So I'm conn

Re: switching to numpy and failing, a user story

2006-10-03 Thread Robert Kern
[EMAIL PROTECTED] wrote: > After using numeric for almost ten years, I decided to attempt to > switch a large codebase (python and C++) to using numpy. Here's are > some comments about how that went. > > - The code to automatically switch python stuff over just kind of > works. But it was a 90% so

switching to numpy and failing, a user story

2006-10-03 Thread [EMAIL PROTECTED]
After using numeric for almost ten years, I decided to attempt to switch a large codebase (python and C++) to using numpy. Here's are some comments about how that went. - The code to automatically switch python stuff over just kind of works. But it was a 90% solution, I could do the rest by hand.

Re: python html rendering

2006-10-03 Thread Fredrik Lundh
Pierre Imbaud wrote: > I rather thought of some module built on python parser, generating html > or xml, ideally customizable. see "colorizer.py" and "element_colorizer.py" in this directory: http://svn.effbot.python-hosting.com/stuff/sandbox/pythondoc -- http://mail.python.org/mailman

Compiling binaries

2006-10-03 Thread Henrique Nakashima
Hi, I'm trying to find a way to compile .py files into linux binaries, so that i can distribute a program without having the user install python itself. Is there a way to do that?I tried pypack but since im new with linux, i couldn't install it from source. There was also py2exe, but this makes onl

ctypes, arrays and pointers

2006-10-03 Thread Richard Jones
Does anyone know how to do the equivalent of this using ctypes? image_data = malloc(width * height * components); row_pointers = png_get_rows(png_ptr, info_ptr); for (y = 0; y < height; y++) memcpy(&image_data[width * components * y], row_pointers[height-y-1],

What kind of program is this

2006-10-03 Thread John Smith
what kind of program is this? I would like to know. import win32api from win32api import * import win32con from win32con import *; from string \ import split aJAPy = 'C:/Program Files/Python/Lib/ \ JAPy.py' if split(aJAPy,'.')[-1] in ('py','pyw'\ ): aJAPy = "%s %s %s" % ('J' 'A' 'Py'\ ,

Re: python html rendering

2006-10-03 Thread Mark Peters
> Hi, Im looking for a way to display some python code > in html: with correct indentation, possibly syntax hiliting, dealing > correctly with multi-line comment, and... generating valid html code if > the python code itself deals with html (hence manipulates tag litterals. > Thanks for your help!

Re: can't open chm files all of a sudden

2006-10-03 Thread John Salerno
John Salerno wrote: > Hi all. I apologize since this is only remotely Python related, but I > hope someone might now the solution. > > I tried opening my Python chm docs just now, as well as the one for > wxPython, and both are giving me an error dialog when I double-click > them and I can't op

can't open chm files all of a sudden

2006-10-03 Thread John Salerno
Hi all. I apologize since this is only remotely Python related, but I hope someone might now the solution. I tried opening my Python chm docs just now, as well as the one for wxPython, and both are giving me an error dialog when I double-click them and I can't open them. This happened apparentl

Re: A Universe Set

2006-10-03 Thread Steve Holden
[EMAIL PROTECTED] wrote: > Has the addition of a Universe Set object ever been suggested. Like U > = set(0), so that any object was a member of U? Maybe this gets into > some crazy Cantorian stuff since U is in U. But it seems like it would > be useful and would have a nice symmetry with emptyse

Re: A Universe Set

2006-10-03 Thread Robert Kern
[EMAIL PROTECTED] wrote: > Has the addition of a Universe Set object ever been suggested. Like U > = set(0), so that any object was a member of U? In [61]: class UniverseSet(object): : def __contains__(self, x): : return True : In [62]: U = UniverseSet

Re: Manipulate PDFs

2006-10-03 Thread Cameron Laird
In article <[EMAIL PROTECTED]>, I misled the newsgroup by writing: . . . >On a large, Very Important Zope site I maintain, though, one which >delivers thousands of dynamically-generated PDF images (not to be >confused with the

Re: Need help with syntax on inheritance.

2006-10-03 Thread jordan . nick
SpreadTooThin wrote: > If you are deriving a new class from another class, > that you must (I assume) know the initializer of the other class. > > So in myClass > > import array > class myClass(arrary.array): >def __init__(self, now here I need to put array's constructor > parameters..., then

Re: Roundup Issue Tracker release 1.1.3

2006-10-03 Thread Richard Jones
Richard Jones wrote: > I'm proud to release version 1.1.3 of Roundup. That's supposed to say 1.2.0. Sigh. -- http://mail.python.org/mailman/listinfo/python-list

Re: Can't get around "IndexError: list index out of range"

2006-10-03 Thread Steve Holden
[EMAIL PROTECTED] wrote: > Hi all, > > I'm sorry about the newbie question, but I've been searching all > afternoon and can't find the answer! > > I'm trying to get this bit of code to work without triggering the > IndexError. > > import shutil, os, sys > > if sys.argv[1] != None: > ver = s

How to get keyboard event in Linux console?

2006-10-03 Thread Jia,Lu
Hi all, I want to deal keyboard event in Linux console. Example: I Create a deamon at background and when I press F1 key then print Hello at Console. Can python do it? with which module? Thanks. -- http://mail.python.org/mailman/listinfo/python-list

A Universe Set

2006-10-03 Thread jordan . nick
Has the addition of a Universe Set object ever been suggested. Like U = set(0), so that any object was a member of U? Maybe this gets into some crazy Cantorian stuff since U is in U. But it seems like it would be useful and would have a nice symmetry with emptyset:set([]), that is: for any obje

Re: Python to use a non open source bug tracker?

2006-10-03 Thread Terry Reedy
"Ben Finney" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > If we *know* that we can always get all the data out of the product, As I understood B.C.'s announcement, that was one of the judging criteria, and the plan is for PSF to get a daily backup dump of the data. tjr --

Re: python html rendering

2006-10-03 Thread Pierre Imbaud
Colin J. Williams wrote: > Josh Bloom wrote: > >>Hey Pierre, >> >>I'm using this plug-in for wordpress to display Python code. >>http://blog.igeek.info/wp-plugins/igsyntax-hiliter/ >>It works pretty well and can display a lot of other languages as well. >> >>-Josh >> >> >>On 10/3/06, *Pierre Imb

Re: PEP 358 and operations on bytes

2006-10-03 Thread Steve Holden
Ben Finney wrote: > Steve Holden <[EMAIL PROTECTED]> writes: > > >>This would just be bloat > > > How would it be bloat? I'm describing a situation where the existing > methods merely move, being implemented in a common ancestor rather > than directly in the concrete sequence classes. > > >>w

Roundup Issue Tracker release 1.1.3

2006-10-03 Thread Richard Jones
I'm proud to release version 1.1.3 of Roundup. Feature: - supports Python 2.5, including the sqlite3 module - full timezone support (sf patch 1465296) - handle connection loss when responding to web requests - match incoming mail In-Reply-To against existing messages when no issue id is specifie

understanding htmllib

2006-10-03 Thread David Bear
I'm trying to understand how to use the HTMLParser in htmllib but I'm not seeing enough examples. I just want to grab the contents of everything enclosed in a '' tag, i.e. items from where begins to where ends. I start by doing class HTMLBody(HTMLParser): def __init__(self): self.conte

Re: python html rendering

2006-10-03 Thread Pierre Imbaud
hanumizzle wrote: > On 10/3/06, Colin J. Williams <[EMAIL PROTECTED]> wrote: > > >>Another approach is to use PyScripter (an editor and IDE). One can >>generate documentation and then save the generated html doc. >> >>Also PyDoc can be used directly. > > > And if you want to go the traditional

Re: Can't get around "IndexError: list index out of range"

2006-10-03 Thread John Machin
Terry Reedy wrote bloated code: > if sys.argv[1:2] != []: if sys.argv[1:2]: :-) -- http://mail.python.org/mailman/listinfo/python-list

Re: PEP 358 and operations on bytes

2006-10-03 Thread John Machin
Gerrit Holl wrote: > Hi, > > In Python 3, reading from a file gives bytes rather than characters. > Some operations currently performed on strings also make sense when > performed on bytes, either if it's binary data or if it's text of > unknown or mixed encoding. Those include of course slicing a

Re: Can't get around "IndexError: list index out of range"

2006-10-03 Thread Terry Reedy
"Leif K-Brooks" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > [EMAIL PROTECTED] wrote: >> I'm trying to get this bit of code to work without triggering the >> IndexError. >> >> import shutil, os, sys >> >> if sys.argv[1] != None: >> ver = sys.argv[1] >> else: >> ver = '2.1

Re: PEP 358 and operations on bytes

2006-10-03 Thread Ben Finney
Steve Holden <[EMAIL PROTECTED]> writes: > This would just be bloat How would it be bloat? I'm describing a situation where the existing methods merely move, being implemented in a common ancestor rather than directly in the concrete sequence classes. > without any use cases being demonstrated.

Re: Python to use a non open source bug tracker?

2006-10-03 Thread Ben Finney
Steve Holden <[EMAIL PROTECTED]> writes: > Like others I have my doubts about using commercial products to > support open source development I'm all in favour of using commercial products to support Python development. What I'm not in favour of is using non-free products to do so. If we *know* t

Re: Strange sorting error message

2006-10-03 Thread Steve Holden
Dustan wrote: > I'm hiding some of the details here, because I don't want to say what > I'm actually doing. > [...] I have the answer to your problem but I don't actually want to tell you what it is. regards Steve -- Steve Holden +44 150 684 7255 +1 800 494 3119 Holden Web LLC/Ltd

Re: PEP 358 and operations on bytes

2006-10-03 Thread Steve Holden
Ben Finney wrote: > Gabriel G <[EMAIL PROTECTED]> writes: > > >>At Tuesday 3/10/2006 21:52, Ben Finney wrote: >> >> >>>Gerrit Holl <[EMAIL PROTECTED]> writes: >>> - str methods endswith, find, partition, replace, split(lines), startswith, - Regular expressions >>> >>>Loo

RE: CGI -> mod_python

2006-10-03 Thread Damjan
> I'm confused. > > is WSGI only a specification, or are there implementations, and if so > which ones WSGI is only a specification. There are a lot of implementations: servers, middleware and almost all new Python web apps and frameworks are WSGI applications. Here is a list of WSGI servers (se

Re: Python to use a non open source bug tracker?

2006-10-03 Thread Steve Holden
Paul Rubin wrote: > "Istvan Albert" <[EMAIL PROTECTED]> writes: > >>But this will definitely not happen over a short period of time and >>even in the worst case scenario there will be a few years in which the >>development can take place in an awesome environment. I've looked at >>the JIRA demo, a

Need help with syntax on inheritance.

2006-10-03 Thread SpreadTooThin
If you are deriving a new class from another class, that you must (I assume) know the initializer of the other class. So in myClass import array class myClass(arrary.array): def __init__(self, now here I need to put array's constructor parameters..., then mine): array.array.__init__(self

Dr. Dobb's Python-URL! - weekly Python news and links (Oct 4)

2006-10-03 Thread Cameron Laird
QOTW: "If you want your objects to know their name, give them a name as an attribute." - Georg Brandl "Unfortunately forty years of programming experience has taught me that there's an essentially infinite supply of mistakes to make ... your mistakes just get smarter most of the time." - Steve

Re: python threading and timing

2006-10-03 Thread Cameron Laird
In article <[EMAIL PROTECTED]>, Laurent Pointal <[EMAIL PROTECTED]> wrote: . . . >May use Python for some -non realtime- parts, but I would not use any >scripting language (not specific to Python) for real-time work (prefer >C

Re: Manipulate PDFs

2006-10-03 Thread Cameron Laird
In article <[EMAIL PROTECTED]>, Simon Brunning <[EMAIL PROTECTED]> wrote: >On 10/3/06, Weko Altamirano <[EMAIL PROTECTED]> wrote: >> Hi Everyone, am a developer using Zope and wanted to know if any of you have >> ever implemented a pdf generating/creating system using python? This just >> means mos

Re: Python to use a non open source bug tracker?

2006-10-03 Thread Paul Rubin
"Istvan Albert" <[EMAIL PROTECTED]> writes: > But this will definitely not happen over a short period of time and > even in the worst case scenario there will be a few years in which the > development can take place in an awesome environment. I've looked at > the JIRA demo, and wow, it really seems

Re: Python to use a non open source bug tracker?

2006-10-03 Thread Paul Rubin
"Martin v. Löwis" <[EMAIL PROTECTED]> writes: > It is a fork of an old version. Existence of this version hasn't helped > a bit when we tried to get our data out of sf.net. Yeah, I'd guessed it might be a fork. Is there stuff in sf.net that a web robot can't retrieve? -- http://mail.python.org/m

Re: Python to use a non open source bug tracker?

2006-10-03 Thread Paul Rubin
Fredrik Lundh <[EMAIL PROTECTED]> writes: > > Sure. But what's the similarity to the fiasco part of the BitKeeper fiasco? > > depends on what you consider being the cause of that fiasco. I'm not > sure it was quite as simple as people are trying to make it sound... I remember there being some ur

Chief Software Architect Position

2006-10-03 Thread devs
RadioSherpa is an early-stage self-funded startup that is looking to change the way people listen to the radio. Central to the RadioSherpa solution is a real-time electronic program guide. A beta online version of our product is available at www.radiosherpa.com. Further details about the RadioSh

Re: PEP 358 and operations on bytes

2006-10-03 Thread Ben Finney
Gabriel G <[EMAIL PROTECTED]> writes: > At Tuesday 3/10/2006 21:52, Ben Finney wrote: > > >Gerrit Holl <[EMAIL PROTECTED]> writes: > > > - str methods endswith, find, partition, replace, split(lines), > > > startswith, > > > - Regular expressions > > > >Looking at those, I don't see

ANN: Urwid 0.9.7.1 - Console UI Library

2006-10-03 Thread Ian Ward
Announcing Urwid 0.9.7.1 Urwid home page: http://excess.org/urwid/ Tarball: http://excess.org/urwid/urwid-0.9.7.1.tar.gz About this release: === This release fixes bugs introduced in the Padding and Overlay classes in the previous release. These

RE: CGI -> mod_python

2006-10-03 Thread Sells, Fred
I'm confused. is WSGI only a specification, or are there implementations, and if so which ones -- http://mail.python.org/mailman/listinfo/python-list

Re: PEP 358 and operations on bytes

2006-10-03 Thread Gabriel G
At Tuesday 3/10/2006 21:52, Ben Finney wrote: Gerrit Holl <[EMAIL PROTECTED]> writes: > operations that aren't currently defined in PEP 358, like: > > - str methods endswith, find, partition, replace, split(lines), > startswith, > - Regular expressions > > I think those can be use

Re: split()

2006-10-03 Thread Gabriel Genellina
At Tuesday 3/10/2006 11:53, Bryan Leber wrote: Gabriel, actually what I did was go ahead and write the whole sequence of the commit(i.e. PATCH_NUMBER, BUG_NUMBER, etc) to a file, and then I read in that file and put them into a list. Then I used line.startswith() to go through and pull out the

Re: PEP 358 and operations on bytes

2006-10-03 Thread Ben Finney
Gerrit Holl <[EMAIL PROTECTED]> writes: > operations that aren't currently defined in PEP 358, like: > > - str methods endswith, find, partition, replace, split(lines), > startswith, > - Regular expressions > > I think those can be useful on a bytes type. Perhaps bytes and str > coul

Re: Resuming a program's execution after correcting error

2006-10-03 Thread hanumizzle
On 3 Oct 2006 16:58:17 -0700, MRAB <[EMAIL PROTECTED]> wrote: > > I like your idea Matthew but I don't know how to pickle the many > > variables in one file. Do I need to pickle each and every variable into > > a seperate file? > > var1,var2 > > pickle.dump(var1,f) > > pickle.dump(var2,f2) > > > U

Re: Resuming a program's execution after correcting error

2006-10-03 Thread MRAB
Sheldon wrote: > MRAB wrote: > > Sheldon wrote: > > > Hi. > > > > > > Does anyone know if one can resume a python script at the error point > > > after the error is corrected? > > > I have a large program that take forever if I have to restart from > > > scratch everytime. The error was the data w

Re: python html rendering

2006-10-03 Thread hanumizzle
On 10/3/06, Colin J. Williams <[EMAIL PROTECTED]> wrote: > Another approach is to use PyScripter (an editor and IDE). One can > generate documentation and then save the generated html doc. > > Also PyDoc can be used directly. And if you want to go the traditional way, Emacs and Vim can both be us

kudos

2006-10-03 Thread hanumizzle
After a long hiatus, I finally found *something* as a vehicle to learn Python. My friends and I are (hopefully) getting together to play FEAR RPG and I decided to use Python to write chargen utilities and such. What do I have to say? Except for not having TrueClosures, which can be emulated with o

Re: python html rendering

2006-10-03 Thread Colin J. Williams
Josh Bloom wrote: > Hey Pierre, > > I'm using this plug-in for wordpress to display Python code. > http://blog.igeek.info/wp-plugins/igsyntax-hiliter/ > It works pretty well and can display a lot of other languages as well. > > -Josh > > > On 10/3/06, *Pierre Imbaud* <[EMAIL PROTECTED]

Re: array tofile fromfile tosocket? fromsocket?

2006-10-03 Thread SpreadTooThin
Thomas Jollans wrote: > On Tue, 03 Oct 2006 10:29:00 -0700, "SpreadTooThin" <[EMAIL PROTECTED]> > let this slip: > > > I was under the impression that a file and socket were interchangable > > (like a file descriptor). Does anyone have an idea that might help me > > minimize the impact on my cod

Re: Running scripts in a sandbox

2006-10-03 Thread Diez B. Roggisch
Samuel schrieb: > Hi, > > I currently have two files: > > core.py > Runs the application, provides APIs to plugins > > untrusted-plugin.py > Executes code using the API from core.py > > I would like to run the code of untrusted-plugin.py in a sandbox, but > still provide it with some hooks

Re: Strange sorting error message

2006-10-03 Thread Dustan
Diez B. Roggisch wrote: > Dustan schrieb: > > I'm hiding some of the details here, because I don't want to say what > > I'm actually doing. > > > I have a special-purpose class with a __cmp__ method all set up and > > ready to go for sorting. Then I have a special class that is based on > > the bu

Re: python html rendering

2006-10-03 Thread Josh Bloom
Hey Pierre,I'm using this plug-in for wordpress to display Python code. http://blog.igeek.info/wp-plugins/igsyntax-hiliter/It works pretty well and can display a lot of other languages as well. -JoshOn 10/3/06, Pierre Imbaud <[EMAIL PROTECTED]> wrote: Hi, Im looking for a way to display some pytho

Running scripts in a sandbox

2006-10-03 Thread Samuel
Hi, I currently have two files: core.py Runs the application, provides APIs to plugins untrusted-plugin.py Executes code using the API from core.py I would like to run the code of untrusted-plugin.py in a sandbox, but still provide it with some hooks to the core API. My environment does not

Re: Strange sorting error message

2006-10-03 Thread Diez B. Roggisch
Dustan schrieb: > I'm hiding some of the details here, because I don't want to say what > I'm actually doing. > I have a special-purpose class with a __cmp__ method all set up and > ready to go for sorting. Then I have a special class that is based on > the builtin type list (though I didn't actua

Strange sorting error message

2006-10-03 Thread Dustan
I'm hiding some of the details here, because I don't want to say what I'm actually doing. I have a special-purpose class with a __cmp__ method all set up and ready to go for sorting. Then I have a special class that is based on the builtin type list (though I didn't actually inherit list; I probab

Re: Can't get around "IndexError: list index out of range"

2006-10-03 Thread Steven Bethard
[EMAIL PROTECTED] wrote: > I'm trying to get this bit of code to work without triggering the > IndexError. > > import shutil, os, sys > > if sys.argv[1] != None: > ver = sys.argv[1] > else: > ver = '2.14' Something like:: if len(sys.argv) > 1: ver = sys.argv[1] else:

Re: Can't get around "IndexError: list index out of range"

2006-10-03 Thread Leif K-Brooks
[EMAIL PROTECTED] wrote: > I'm trying to get this bit of code to work without triggering the > IndexError. > > import shutil, os, sys > > if sys.argv[1] != None: > ver = sys.argv[1] > else: > ver = '2.14' Catch it: try: ver = sys.argv[1] except IndexError: ver = '2.14' -- htt

Re: Instantiating an object when the type is only known at runtime

2006-10-03 Thread Samuel
Thanks, that's what I was looking for. > >>> m = __import__( "StringIO" ) > >>> x = getattr( m, "StringIO" )() > >>> x > > >>> For the records: If the module is already loaded, this also works: if my_type_is_not_yet_loaded: module = __import__(type) obj= getattr(module, type) else:

Re: was python implemented as a object oriented langage at the beginning ?

2006-10-03 Thread has
MonkeeSage wrote: > [...] just because a language doesn't implement OO in the > exact same way as another doesn't mean it isn't OO -- it just means > it's a different language. I've a suspicion that folk who aren't familiar with the Python object system automatically assume the phrase 'Python type

Can't get around "IndexError: list index out of range"

2006-10-03 Thread erikwickstrom
Hi all, I'm sorry about the newbie question, but I've been searching all afternoon and can't find the answer! I'm trying to get this bit of code to work without triggering the IndexError. import shutil, os, sys if sys.argv[1] != None: ver = sys.argv[1] else: ver = '2.14' Of course, whe

Re: Strange xml.parsers.expat import problem [corrected subject]

2006-10-03 Thread [EMAIL PROTECTED]
I was able to fix (i.e., work around) this issue by using the import: import xml.parsers.expat as expat and then referring to: expat.ExpatError I have no idea why this makes it work, seems like a bug in Python to me. -Don [EMAIL PROTECTED] wrote: > Sorry, that should have been "xml.parsers.e

Re: What value should be passed to make a function use the default argument value?

2006-10-03 Thread Rob De Almeida
LaundroMat wrote: > Suppose I have this function: > > def f(var=1): > return var*2 > > What value do I have to pass to f() if I want it to evaluate var to 1? > I know that f() will return 2, but what if I absolutely want to pass a > value to f()? "None" doesn't seem to work.. If you *absolutely* w

python html rendering

2006-10-03 Thread Pierre Imbaud
Hi, Im looking for a way to display some python code in html: with correct indentation, possibly syntax hiliting, dealing correctly with multi-line comment, and... generating valid html code if the python code itself deals with html (hence manipulates tag litterals. Thanks for your help! -- htt

Checking dependencies with distutils

2006-10-03 Thread Etienne Marcel
Hello, I would like to know if there is something in distutils (or in Python stdlib) which allow me to check for dependencies (shared libraries, headers or any other progs) before building/installing ? I am aware of this nice utility : http://trentm.com/projects/which/ which is useful (and cross

Re: What value should be passed to make a function use the default argument value?

2006-10-03 Thread Bruno Desthuilliers
LaundroMat a écrit : > Suppose I have this function: > > def f(var=1): > return var*2 > > What value do I have to pass to f() if I want it to evaluate var to 1? > > I know that f() will return 2, but what if I absolutely want to pass a > value to f()? "None" doesn't seem to work.. Have you trie

Re: What value should be passed to make a function use the default argument value?

2006-10-03 Thread Stan Graves
LaundroMat wrote: > Suppose I have this function: > > def f(var=1): > return var*2 > > What value do I have to pass to f() if I want it to evaluate var to 1? > I know that f() will return 2, but what if I absolutely want to pass a > value to f()? "None" doesn't seem to work.. What about this? >>

Re: What value should be passed to make a function use the default argument value?

2006-10-03 Thread Thomas Jollans
On Tue, 03 Oct 2006 13:16:57 -0700, "LaundroMat" <[EMAIL PROTECTED]> let this slip: > Suppose I have this function: > > def f(var=1): > return var*2 > > What value do I have to pass to f() if I want it to evaluate var to 1? > I know that f() will return 2, but what if I absolutely want to pass a

Re: What value should be passed to make a function use the default argument value?

2006-10-03 Thread Larry Bates
LaundroMat wrote: > Suppose I have this function: > > def f(var=1): > return var*2 > > What value do I have to pass to f() if I want it to evaluate var to 1? > I know that f() will return 2, but what if I absolutely want to pass a > value to f()? "None" doesn't seem to work.. > > Thanks in advan

Re: ** NEW SCIENTIFIC AND FORENSIC JOURNAL LAUNCHED ** and 1MILLION reward

2006-10-03 Thread Non Existence
http://www.childpastlives.org/library.htm http://www.odemagazine.com/article.php?aID=4207 http://www.nderf.org/vonlommel_consciousness.htm -- http://mail.python.org/mailman/listinfo/python-list

Re: Python to use a non open source bug tracker?

2006-10-03 Thread Istvan Albert
Giovanni Bajo wrote: > Does this smell "Bitkeeper fiasco" to anyone else than me? well, no company will spend money/effort/resources unless it benefits them some way. Once that benefit (or the perception of it) disappears the company will cut the lifeline. It's just common business sense. But th

Re: What value should be passed to make a function use the default argument value?

2006-10-03 Thread Tim Chase
> def f(var=1): > return var*2 > > What value do I have to pass to f() if I want it to evaluate var to 1? > I know that f() will return 2, but what if I absolutely want to pass a > value to f()? "None" doesn't seem to work.. >>> def f(var=1): ... return var*2 ... >>> f() 2 >>> f(0.5) 1.0

Re: What value should be passed to make a function use the default argument value?

2006-10-03 Thread Lawrence Oluyede
LaundroMat <[EMAIL PROTECTED]> wrote: > What value do I have to pass to f() if I want it to evaluate var to 1? > I know that f() will return 2, but what if I absolutely want to pass a > value to f()? "None" doesn't seem to work.. I don't know if I understand correctly here but: def f(v=1): re

Re: What value should be passed to make a function use the default argument value?

2006-10-03 Thread Fredrik Lundh
LaundroMat wrote: > Suppose I have this function: > > def f(var=1): > return var*2 > > What value do I have to pass to f() if I want it to evaluate var to 1? > I know that f() will return 2, but what if I absolutely want to pass a > value to f()? f(1) > "None" doesn't seem to work.. None is

Re: array tofile fromfile tosocket? fromsocket?

2006-10-03 Thread Thomas Jollans
On Tue, 03 Oct 2006 10:29:00 -0700, "SpreadTooThin" <[EMAIL PROTECTED]> let this slip: > I was under the impression that a file and socket were interchangable > (like a file descriptor). Does anyone have an idea that might help me > minimize the impact on my code? are you looking for sockets' m

What value should be passed to make a function use the default argument value?

2006-10-03 Thread LaundroMat
Suppose I have this function: def f(var=1): return var*2 What value do I have to pass to f() if I want it to evaluate var to 1? I know that f() will return 2, but what if I absolutely want to pass a value to f()? "None" doesn't seem to work.. Thanks in advance. -- http://mail.python.org/mailma

PEP 358 and operations on bytes

2006-10-03 Thread Gerrit Holl
Hi, In Python 3, reading from a file gives bytes rather than characters. Some operations currently performed on strings also make sense when performed on bytes, either if it's binary data or if it's text of unknown or mixed encoding. Those include of course slicing and other operators that exist i

Re: String constants (was "Looping over a list question")

2006-10-03 Thread Tim Chase
> I'd also love to see string constants implemented some day too > (like str.whitespace and str.ascii_letters). You mean like the "string" module provides? :) >>> import string >>> print '\n'.join(["%s -> %s" % (s, repr(eval('string.%s' % s))) for s in dir(string) if isinstance(eval('string.%s

Re: Looping over a list question

2006-10-03 Thread Fredrik Lundh
[EMAIL PROTECTED] wrote: > My "print" line is actually a long 40 line block. and? if your editor isn't horribly broken, that shouldn't be much of a problem. (but you may want to refactor the code; if you have a processing block that large, it's probably better to move all or parts of it into a

Re: Python to use a non open source bug tracker?

2006-10-03 Thread Martin v. Löwis
Paul Rubin schrieb: > Ben Finney <[EMAIL PROTECTED]> writes: >> The existing SourceForge system runs on non-free software, which is a >> significant differentiator from Bugzilla. > > The SourceForge software, at least in some versions, is free software. > See for example http://savannah.gnu.org fo

Re: Looping over a list question

2006-10-03 Thread Leif K-Brooks
Tim Williams wrote: > Maybe > def myfunc(txt): > ... print txt > ... datafiles = ['1.txt','2.txt','3.txt','4.tst'] null = [myfunc(i) for i in datafiles if '.txt' in i] > 1.txt > 2.txt > 3.txt Ew. List comprehensions with side effects are very icky. -- http://mail.python.or

Re: Looping over a list question

2006-10-03 Thread stephen
Fredrik Lundh wrote: [snip] > probably. but unless your editor or keyboard is horribly broken, you > can of course press return at the right place instead: > >for i in datafiles: > if '.txt' in i: > print 'Processing datafile %s' % f > > (for this specific case, "endswi

Re: Python to use a non open source bug tracker?

2006-10-03 Thread Robert Kern
Fredrik Lundh wrote: > Robert Kern wrote: > >> Sure. But what's the similarity to the fiasco part of the BitKeeper fiasco? > > depends on what you consider being the cause of that fiasco. I'm not > sure it was quite as simple as people are trying to make it sound... > > (and your assertion tha

Re: Survival of the fittest

2006-10-03 Thread Dieter Maurer
Dennis Lee Bieber <[EMAIL PROTECTED]> writes on Thu, 28 Sep 2006 23:57:51 GMT: > On 28 Sep 2006 22:48:21 +0200, Dieter Maurer <[EMAIL PROTECTED]> > declaimed the following in comp.lang.python: > > > We learn: a C/C++ implementation can in some cases be drastically > > more efficient than a Python

Re: Python to use a non open source bug tracker?

2006-10-03 Thread Fredrik Lundh
Robert Kern wrote: > Sure. But what's the similarity to the fiasco part of the BitKeeper fiasco? depends on what you consider being the cause of that fiasco. I'm not sure it was quite as simple as people are trying to make it sound... (and your assertion that nobody but giovanni has made that

** NEW SCIENTIFIC AND FORENSIC JOURNAL LAUNCHED ** and 1MILLION reward

2006-10-03 Thread thermate
= Journal of 911 studies: http://www.journalof911studies.com/ = $1 Million Challenge/REWARD Details regarding 9/11: http://reopen911.org/Contest.htm ==

Re: Howto pass Array/Hash into Function

2006-10-03 Thread Fredrik Lundh
Wijaya Edward wrote: > Thanks for your understanding Steve. > > Furthermore, my related concern > is how does Python actually deal with 'reference' in Perl. > But now, it is clear to me now that Python simply treats > them as object. sounds like you really need to reset your brain: http

Re: Looping over a list question

2006-10-03 Thread mdsteele
[EMAIL PROTECTED] wrote: > I found myself writing: > > for f in [i for i in datafiles if '.txt' in i]: > print 'Processing datafile %s' % f > > but I was wishing that I could have instead written: > > for f in in datafiles if '.txt' in f: > print 'Processing datafile %s' % f > > Has there

Re: Best way to handle large lists?

2006-10-03 Thread Fredrik Lundh
Hari Sekhon wrote: > That is surprising since I read on this list recently that lists were > faster than dicts depends on what you're doing with them, of course. > It was one reason that was cited as to why local vars are better than > global vars. L[int] is indeed a bit faster than D[string]

Re: Looping over a list question

2006-10-03 Thread Fredrik Lundh
[EMAIL PROTECTED] wrote: > I found myself writing: > > for f in [i for i in datafiles if '.txt' in i]: > print 'Processing datafile %s' % f > > but I was wishing that I could have instead written: > > for f in in datafiles if '.txt' in f: > print 'Processing datafile %s' % f > > Has th

Re: Looping over a list question

2006-10-03 Thread Tim Williams
On 3 Oct 2006 10:50:04 -0700, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote: > I found myself writing: > > for f in [i for i in datafiles if '.txt' in i]: > print 'Processing datafile %s' % f > > but I was wishing that I could have instead written: > > for f in in datafiles if '.txt' in f: >

Re: PATCH: Speed up direct string concatenation by 20+%!

2006-10-03 Thread Terry Reedy
"> Forgot to mention this, in case you haven't done so post your original > message/patch on the python-dev lists since that's where the decisions > are made. This group is more end-user oriented. > > http://mail.python.org/pipermail/python-dev/2006-October/thread.html It is often good to get com

Re: Pythonic API design: detailed errors when you usually don't care

2006-10-03 Thread John J. Lee
"Simon Willison" <[EMAIL PROTECTED]> writes: > Hi all, > > I have an API design question. I'm writing a function that can either > succeed or fail. Most of the time the code calling the function won't > care about the reason for the failure, but very occasionally it will. > > I can see a number

Re: Looping over a list question

2006-10-03 Thread Christoph Haas
On Tuesday 03 October 2006 19:50, [EMAIL PROTECTED] wrote: > I found myself writing: > > for f in [i for i in datafiles if '.txt' in i]: > print 'Processing datafile %s' % f > > but I was wishing that I could have instead written: > > for f in in datafiles if '.txt' in f: > print 'Processin

Re: Python to use a non open source bug tracker?

2006-10-03 Thread Robert Kern
Fredrik Lundh wrote: > Robert Kern wrote: > >>> Does this smell "Bitkeeper fiasco" to anyone else than me? >> No. > > that's just not true. lots of people have voiced concerns over using > closed-sourced stuff originally designed for enterprise-level Java users > for an application domain wher

  1   2   3   >