Re: appwsgi

2008-02-14 Thread gert
On Feb 15, 8:23 am, Stephan Diehl <[EMAIL PROTECTED]> wrote: > gert wrote: > > can myhttp://appwsgi.googlecode.com/be on thehttp://wsgi.org/page > > somewhere please :) > > you are free to register yourself on wsgi.org and put a link to your > software at the appropriate place. It's a wiki, after a

Re: Write ooxml .ods (spreadsheat) from python?

2008-02-14 Thread Rob Wolfe
Neal Becker napisał(a): > I'd like to output some data directly in .ods format. This format appears > to be quite complex. Is there any python software available to do this? I > did look at pyuno briefly. It looks pretty complicated also, and it looks > like it uses it's own private version o

Re: appwsgi

2008-02-14 Thread Stephan Diehl
gert wrote: > can my http://appwsgi.googlecode.com/ be on the http://wsgi.org/ page > somewhere please :) you are free to register yourself on wsgi.org and put a link to your software at the appropriate place. It's a wiki, after all. -- http://mail.python.org/mailman/listinfo/python-list

appwsgi

2008-02-14 Thread gert
can my http://appwsgi.googlecode.com/ be on the http://wsgi.org/ page somewhere please :) -- http://mail.python.org/mailman/listinfo/python-list

RELEASED: Pymacs 0.23

2008-02-14 Thread François Pinard
Hello to everybody, and Emacs users in the Python community. Here is Pymacs 0.23! There has been a while, so I advise current Pymacs users to switch with caution. All reported bugs have been squashed, if we except one about Emacs quit (C-g) not being obeyed gracefully. A few suggestions have be

QOTW: Re: dream hardware

2008-02-14 Thread Aahz
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 interpreter actually does dream, but if it's >anything like me, it's probably

Re: Turn off ZeroDivisionError?

2008-02-14 Thread John Nagle
Mark Dickinson wrote: > On Feb 10, 7:07 pm, Grant Edwards <[EMAIL PROTECTED]> wrote: >> On 2008-02-10, Christian Heimes <[EMAIL PROTECTED]> wrote: >> from somemodule import ieee754 >> with ieee754: >>> ...r = a/0 >>> ...print r >>> inf >> That would be great. > > Seriously, in some

a question in python curses modules

2008-02-14 Thread Marco
Hi, I wanna write a simple curses program, but somethings confuse me, my code here: #!/usr/bin/python import os import sys import time import curses class CursesObject( object ): def __init__(self): self.STDSCR = curses.initscr() curses.noecho() curses.cbreak()

Re: Write ooxml .ods (spreadsheat) from python?

2008-02-14 Thread johnf
Neal Becker wrote: > I'd like to output some data directly in .ods format. This format appears > to be quite complex. Is there any python software available to do this? > I > did look at pyuno briefly. It looks pretty complicated also, and it looks > like it uses it's own private version of py

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: Floating point bug?

2008-02-14 Thread Zentrader
> 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: 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: XML pickle

2008-02-14 Thread castironpi
> I cannot tell if the above approach will solve your problem or not. Well, declare me a persistent object. from lxml import etree SS= '{urn:schemas-microsoft-com:office:spreadsheet}' book= etree.Element( 'Workbook' ) book.set( 'xmlns', 'urn:schemas-microsoft-com:office:spreadsheet' ) sheet= etr

Re: RELEASED Python 2.5.2, release candidate 1

2008-02-14 Thread Paul Rubin
Jeff Schwab <[EMAIL PROTECTED]> writes: > > I think it's fine as it is. You can "release" a release candidate. > > You can, but it's confusing terminology. In the context of software > development, a release (PRODUCT_VERSION-RELEASE) is a different beast > from a release candidate (PRODUCT_VERSI

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 Ben Finney
"Terry Reedy" <[EMAIL PROTECTED]> writes: > "Ben Finney" <[EMAIL PROTECTED]> wrote in message > news:[EMAIL PROTECTED] > > | Rather, it might just say "[ANN] Python 2.5.2, release candidate 1". > > So I agree, for the future (and no apologies for the present > needed), that this is a slightly b

Please help help ..... for threading

2008-02-14 Thread silkenpy
Hi, please help me to find a solution to run this program correctlly or tell me my basic mistake. import thread import threading import time from jpype import * def sleepFunction(): print"ya ali" classpath = "-Djava.class.path=praat.jar" startJVM(getDefaultJVMPath(

Re: XML pickle

2008-02-14 Thread castironpi
Great! --  \          "I moved into an all-electric house. I forgot and left the |   `\   porch light on all day. When I got home the front door wouldn't | _o__)                                         open."  -- Steven Wright | Ben Finney -- http://mail.python.org/mailman/listinfo/python-list

Re: RELEASED Python 2.5.2, release candidate 1

2008-02-14 Thread Terry Reedy
"Ben Finney" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] | It would be better if it didn't say "released" at all, since (as | discussed above) this isn't "released" except in the trivial | always-true sense that it is available. I think this is slightly picky, but also correct.

Re: RELEASED Python 2.5.2, release candidate 1

2008-02-14 Thread Carl Banks
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* o

Re: XML pickle

2008-02-14 Thread Ben Finney
[EMAIL PROTECTED] writes: > Minimize redundancy. Please do so by trimming the quoted material; remove anything not relevant to people reading your reply. -- \ "I moved into an all-electric house. I forgot and left the | `\ porch light on all day. When I got home the front door wou

Re: RELEASED Python 2.5.2, release candidate 1

2008-02-14 Thread Ben Finney
Ben Finney <[EMAIL PROTECTED]> writes: > "Martin v. Löwis" <[EMAIL PROTECTED]> writes: > > I'm not a native speaker, so "to release" means to me what the > > dictionary says it means: m-w's fourth meaning, "make available to > > the public". That's what I did - I made the release candidate > > ava

Re: RELEASED Python 2.5.2, release candidate 1

2008-02-14 Thread Ben Finney
Paul Rubin writes: > I thought the original announcement text was fine, but that may be > because I'm accustomed to the Python release cycle including the RC > releases. I think it's needlessly confusing to refer to a "release candidate release"; that's almost an oxymor

Re: XML pickle

2008-02-14 Thread castironpi
On Feb 14, 5:31 pm, [EMAIL PROTECTED] wrote: > On Feb 14, 1:49 pm, Stefan Behnel <[EMAIL PROTECTED]> wrote: > > > > > > > Hi, > > > [EMAIL PROTECTED] wrote: > > > Stefan Behnel wrote: > > >> What I meant was: please state what you are trying to do. What you > > >> describe > > >> are the environme

Re: RELEASED Python 2.5.2, release candidate 1

2008-02-14 Thread Ben Finney
"Martin v. Löwis" <[EMAIL PROTECTED]> writes: > Please accept my apologies. Thanks, but not needed. I'm merely trying to address the confusing terminology in this announcement and future ones. > I'm not a native speaker, so "to release" means to me what the > dictionary says it means: m-w's four

Re: XML pickle

2008-02-14 Thread castironpi
On Feb 14, 1:49 pm, Stefan Behnel <[EMAIL PROTECTED]> wrote: > Hi, > > [EMAIL PROTECTED] wrote: > > Stefan Behnel wrote: > >> What I meant was: please state what you are trying to do. What you describe > >> are the environmental conditions and possible solutions that you are > >> thinking of, but i

Re: RELEASED Python 2.5.2, release candidate 1

2008-02-14 Thread Paul Rubin
"Martin v. Löwis" <[EMAIL PROTECTED]> writes: > >> happy to announce the release of Python 2.5.2 (release candidate 1). > So is the subject incorrect as well? If so, what should it say? Neither place is technically incorrect, but both are written in a way that could give a slightly wrong impressi

Re: File object wrapper for a String?

2008-02-14 Thread David Erickson
On Feb 14, 3:16 pm, "Diez B. Roggisch" <[EMAIL PROTECTED]> wrote: > David Erickson schrieb: > > > I am using the Popen class from subprocess and would like to feed a > > string in as the stdin parameter, however primarily it only takes a > > File object. Does there exist a wrapper for a string to

Re: File object wrapper for a String?

2008-02-14 Thread David Erickson
On Feb 14, 3:07 pm, Christian Heimes <[EMAIL PROTECTED]> wrote: > David Erickson wrote: > > I am using the Popen class from subprocess and would like to feed a > > string in as the stdin parameter, however primarily it only takes a > > File object. Does there exist a wrapper for a string to do thi

Re: RELEASED Python 2.5.2, release candidate 1

2008-02-14 Thread Kevin Walzer
Ben Finney wrote: > "Martin v. Löwis" <[EMAIL PROTECTED]> writes: > >> 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* of

Re: File object wrapper for a String?

2008-02-14 Thread Christian Heimes
Diez B. Roggisch wrote: > Christian told you how to work with popen. Just for the record thogh: > there are the StringIO and cStringIO-modules. IIRC subprocess requires a real file with a file descriptor for the standard streams. An object with a write or read method isn't enough. Christian --

Re: RELEASED Python 2.5.2, release candidate 1

2008-02-14 Thread Martin v. Löwis
>> 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* of 2.5.2, could you please announce it as something other > than a "relea

Re: File object wrapper for a String?

2008-02-14 Thread Diez B. Roggisch
David Erickson schrieb: > I am using the Popen class from subprocess and would like to feed a > string in as the stdin parameter, however primarily it only takes a > File object. Does there exist a wrapper for a string to do this? I > know I can just dump the string to a temp file and feed that i

Re: File object wrapper for a String?

2008-02-14 Thread Christian Heimes
David Erickson wrote: > I am using the Popen class from subprocess and would like to feed a > string in as the stdin parameter, however primarily it only takes a > File object. Does there exist a wrapper for a string to do this? I > know I can just dump the string to a temp file and feed that in

File object wrapper for a String?

2008-02-14 Thread David Erickson
I am using the Popen class from subprocess and would like to feed a string in as the stdin parameter, however primarily it only takes a File object. Does there exist a wrapper for a string to do this? I know I can just dump the string to a temp file and feed that in but that is pretty hacky. Tha

Re: InstanceType tests in Python-3.0

2008-02-14 Thread Carl Banks
On Feb 14, 10:26 am, Robin Becker <[EMAIL PROTECTED]> wrote: > I'm in the process of porting some code. I have 2.x code that looks like this > > t = type(e) > if t==InstanceType: > return f0(e) > elif t in (float,int): > return f1(e) > else: > return str(e) > > In python 3.0 everything

Re: How to tell if I'm being run from a shell or a module

2008-02-14 Thread dg . google . groups
On Feb 14, 11:06 pm, "Gabriel Genellina" <[EMAIL PROTECTED]> wrote: > It depends on what you mean by "an interactive shell"? If you start your > script with: > python -i whatever.py > is it an interactive shell or not? > > I tried these two criteria: > a) See if the __main__ module has a __file__ a

Re: RELEASED Python 2.5.2, release candidate 1

2008-02-14 Thread Ben Finney
"Martin v. Löwis" <[EMAIL PROTECTED]> writes: > 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* of 2.5.2, could you please announc

Re: InstanceType tests in Python-3.0

2008-02-14 Thread Robin Becker
Steven D'Aprano wrote: > On Thu, 14 Feb 2008 17:21:20 +, Robin Becker wrote: > > > > The way I see it, your code don't really care about the distinction > between "user-generated classes" and "built-in types", it cares about the > distinction between "classes I know about" and "othe

Re: RELEASED Python 2.5.2, release candidate 1

2008-02-14 Thread Martin v. Löwis
> The Mac binary is giving a 404. Thanks for pointing that out - it's fixed now. Regards, Martin -- http://mail.python.org/mailman/listinfo/python-list

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

2008-02-14 Thread Gabriel Genellina
> Gabriel Genellina wrote: >> En Thu, 14 Feb 2008 04:54:56 -0200, W. Watson <[EMAIL PROTECTED]> >> escribió: >> >>> 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. >

Re: InstanceType tests in Python-3.0

2008-02-14 Thread Steven D'Aprano
On Thu, 14 Feb 2008 17:21:20 +, Robin Becker wrote: > Steven D'Aprano wrote: >> On Thu, 14 Feb 2008 15:26:08 +, Robin Becker wrote: >> >>> I'm in the process of porting some code. I have 2.x code that looks >>> like this >>> >>> t = type(e) >>> if t==InstanceType: >>> return f0(e) >>>

Re: RELEASED Python 2.5.2, release candidate 1

2008-02-14 Thread hcs
The Mac binary is giving a 404. When/if it's supposed to work, will it upgrade the Leopard standard framework install, or will we need to mess around with the PATH? -- http://mail.python.org/mailman/listinfo/python-list

Re: How to tell if I'm being run from a shell or a module

2008-02-14 Thread Gabriel Genellina
En Thu, 14 Feb 2008 19:09:10 -0200, <[EMAIL PROTECTED]> escribió: > Thanks for the replies, but it's not what I meant. What I want to be > able to determine is whether or not the user is running from an > interactive shell (like IPython or IDLE). Checking if > __name__=='__main__' checks if the

Req: PYTHON 2.4 PROGRAMMER(Direct Client)

2008-02-14 Thread sarosh
Friends , I need a Python Developer Please send resume with rate and contact to [EMAIL PROTECTED] Duration : Long term Location: NYC Interview : Immediately Rate: open Experience with: Required Skills: Python 2.4 or greater Twisted Matrix 2.5 Object Oriented Programming Threade

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

2008-02-14 Thread Jaap Spies
Gabriel Genellina wrote: > En Thu, 14 Feb 2008 04:54:56 -0200, W. Watson <[EMAIL PROTECTED]> > escribió: > >> 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

Re: Is there a way to use .NET DLL from Python

2008-02-14 Thread Fuzzyman
On Feb 13, 6:58 pm, "Luis M. González" <[EMAIL PROTECTED]> wrote: > On 13 feb, 00:26, Dino Viehland <[EMAIL PROTECTED]> wrote: > > > >> Oh, I know what you mean. > > >> But that was exactly the reason for having a .DLLs folder, isn't it? > > >> When you place an assembly into this folder, you avoid

RELEASED Python 2.5.2, release candidate 1

2008-02-14 Thread Martin v. Löwis
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). This is the second bugfix release of Python 2.5. Python 2.5 is now in bugfix-only mode; no new features are being added. According to the release notes, over

Re: SAGE for FPGA development

2008-02-14 Thread Stef Mientki
Blubaugh, David A. wrote: > because labview is neither free nor open source. Labview is not the > route to go for someone like me who has no real capital. > > I thought you were doing your master thesis ? And LabView is almost for free, for people linked in anyway to an educational institut

Re: How to tell if I'm being run from a shell or a module

2008-02-14 Thread dg . google . groups
Thanks for the replies, but it's not what I meant. What I want to be able to determine is whether or not the user is running from an interactive shell (like IPython or IDLE). Checking if __name__=='__main__' checks if the current module is the one being run, but suppose you have two modules A and B

RE: SAGE for FPGA development

2008-02-14 Thread Blubaugh, David A.
because labview is neither free nor open source. Labview is not the route to go for someone like me who has no real capital. David Blubaugh -Original Message- From: Stef Mientki [mailto:[EMAIL PROTECTED] Sent: Thursday, February 14, 2008 1:25 PM To: python-list@python.org Sub

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

2008-02-14 Thread W. Watson
Good grief! You go a long way back. Want to try for an IBM 650 with a drum memory? Gabriel Genellina wrote: > En Thu, 14 Feb 2008 04:54:56 -0200, W. Watson <[EMAIL PROTECTED]> > escribió: > >> See Subject. It's a simple txt file, each line is a Python stmt, but I >> need >> up to four digits a

Re: mmap and shared memory

2008-02-14 Thread Nikita the Spider
In article <[EMAIL PROTECTED]>, Jeff Schwab <[EMAIL PROTECTED]> wrote: > 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 loca

Re: XML pickle

2008-02-14 Thread Stefan Behnel
Hi, [EMAIL PROTECTED] wrote: > Stefan Behnel wrote: >> What I meant was: please state what you are trying to do. What you describe >> are the environmental conditions and possible solutions that you are >> thinking of, but it doesn't tell me what problem you are actually trying >> to solve. http:

Re: Dynamic method parameter access?

2008-02-14 Thread Peter Otten
Dennis Kempin wrote: > Chris schrieb: >> On Feb 12, 9:38 pm, Dennis Kempin <[EMAIL PROTECTED]> wrote: >>> Hello, >>> >>> I have a set of some objects. With these objects I want to call a Python >>> method. But the writer of the method shall have the option to select >>> from these objects as metho

Re: pyinstall and matplotlib

2008-02-14 Thread John Henry
Thank you for the response. I am having trouble using the script. I am assuming the TUI is the application this script was developed for and did my best to replace that with the name of my own. To make things simple, let's say we take one of the sample matplotlib program MULTICOLOR.PY and place

Re: XML pickle

2008-02-14 Thread castironpi
On Feb 14, 12:31 pm, Stefan Behnel <[EMAIL PROTECTED]> wrote: > [EMAIL PROTECTED] wrote: > > On Feb 14, 12:45 am, Stefan Behnel <[EMAIL PROTECTED]> wrote: > >> [EMAIL PROTECTED] wrote: > >>> Readability of the Pickle module.  Can one export to XML, from cost of > >>> speed and size, to benefit of u

Re: Dynamic method parameter access?

2008-02-14 Thread Dennis Kempin
Chris schrieb: > On Feb 12, 9:38 pm, Dennis Kempin <[EMAIL PROTECTED]> wrote: >> Hello, >> >> I have a set of some objects. With these objects I want to call a Python >> method. But the writer of the method shall have the option to select >> from these objects as method parameter. >> >> At the mome

Re: Floating point bug?

2008-02-14 Thread Duncan Booth
Jeff Schwab <[EMAIL PROTECTED]> wrote: > 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

Re: Copying weakrefs

2008-02-14 Thread Rick Harris
On Feb 14, 12:31 pm, Rick Harris <[EMAIL PROTECTED]> wrote: > I am working with an object, Context, that maintains an identity map > by using the weakref.WeakValueDictionary. I would like to clone this > Context object (and objects that may have a Context object) using > copy.deepcopy(). When I try

Re: Floating point bug?

2008-02-14 Thread robinsiebler
I did try searching, but I never found what I was looking for. This thread has been very useful and informative. Thanks for all your help! I was able to fix my problem. :) -- http://mail.python.org/mailman/listinfo/python-list

Re: Copying weakrefs

2008-02-14 Thread Rick Harris
On Feb 14, 12:31 pm, Rick Harris <[EMAIL PROTECTED]> wrote: > I am working with an object, Context, that maintains an identity map > by using the weakref.WeakValueDictionary. I would like to clone this > Context object (and objects that may have a Context object) using > copy.deepcopy(). When I try

Outlook .NK2 record processing

2008-02-14 Thread babycode
How do I process records in MS Outlook.NK2 files? -- http://mail.python.org/mailman/listinfo/python-list

Re: XML pickle

2008-02-14 Thread Stefan Behnel
[EMAIL PROTECTED] wrote: > On Feb 14, 12:45 am, Stefan Behnel <[EMAIL PROTECTED]> wrote: >> [EMAIL PROTECTED] wrote: >>> Readability of the Pickle module. Can one export to XML, from cost of >>> speed and size, to benefit of user-readability? >> Regarding pickling to XML, lxml.objectify can do tha

[OT] Looking for a Python Program/Tool That Will Add Line Numbers to a txt File

2008-02-14 Thread Gabriel Genellina
En Thu, 14 Feb 2008 04:54:56 -0200, W. Watson <[EMAIL PROTECTED]> escribió: > 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

Re: SAGE for FPGA development

2008-02-14 Thread Stef Mientki
Blubaugh, David A. wrote: > Bill, > > > Let me first say that my FPGA experiences are of the following nature: > > 1.) Developed control algorithms onto a FPGA that were utilized to > control a switch-reluctance motor (three-phase as well six-phase). > > 2.) I am currently in the process of dev

Re: Getting Wireless Signal Strength / Windows XP

2008-02-14 Thread Tim Golden
[Somehow got stuck in my outbox... ] [EMAIL PROTECTED] wrote: > Hello, > > I'm looking for a way to get wireless signal strength on Windows XP > with Python. I see there's a library for Linux, but I can't find > anything for windows. However, I see that using WMI I can access it in > theory at lea

Re: XML pickle

2008-02-14 Thread castironpi
On Feb 14, 12:45 am, Stefan Behnel <[EMAIL PROTECTED]> wrote: > Hi, > > [EMAIL PROTECTED] wrote: > > Readability of the Pickle module.  Can one export to XML, from cost of > > speed and size, to benefit of user-readability? > > Regarding pickling to XML, lxml.objectify can do that: > > http://codes

RE: SAGE for FPGA development

2008-02-14 Thread Blubaugh, David A.
Bill, Let me first say that my FPGA experiences are of the following nature: 1.) Developed control algorithms onto a FPGA that were utilized to control a switch-reluctance motor (three-phase as well six-phase). 2.) I am currently in the process of developing a specialized Multidimensional F

Re: How to tell if I'm being run from a shell or a module

2008-02-14 Thread Chris
On Feb 14, 7:21 pm, [EMAIL PROTECTED] wrote: > Hi all, > > Is there any standard way to tell if the user is running from a module > or from an interactive shell like IDLE or IPython? The best I've come > up with so far is for a function to look at > getouterframes(currentframe())[1][1] (the filenam

Re: Floating point bug?

2008-02-14 Thread Gabriel Genellina
En Thu, 14 Feb 2008 15:22:41 -0200, Jeff Schwab <[EMAIL PROTECTED]> escribió: > Christian Heimes wrote: >> No, print invokes the tp_print slot of the float type. Some core types >> have a special handler for print. The tp_print slot is not available >> from Python code and most people don't know

Re: How to tell if I'm being run from a shell or a module

2008-02-14 Thread Jeff McNeil
Check to see what the value of '__name__' is, for example: if __name__ == '__main__': execute_interactive_code() else: I_am_just_a_lowly_module() The value of __name__ will correspond to the name of your module: $ cat a.py print __name__ $ $ python Python 2.5.1 (r251:54863, Oct 30 2007, 1

Re: InstanceType tests in Python-3.0

2008-02-14 Thread Christian Heimes
Robin Becker wrote: > except that unfortunately python 3.0 doesn't have type.InstanceType and > module > types doesn't have those old style ones any more :( Old style classes and hence InstanceType are gone in py3k. Christian -- http://mail.python.org/mailman/listinfo/python-list

Re: Regular Expression for Prime Numbers (or How I came to fail at them, and love the bomb)

2008-02-14 Thread castironpi
On Feb 14, 5:26 am, [EMAIL PROTECTED] wrote: > cokofree: > > > Sadly that is pretty slow though... > > It's quadratic, and it's not even short, you can do (quadratic still): > > print [x for x in range(2, 100) if all(x%i for i in range(2, x))] > > In D you can write similar code. > Bye, > bearophil

Copying weakrefs

2008-02-14 Thread Rick Harris
I am working with an object, Context, that maintains an identity map by using the weakref.WeakValueDictionary. I would like to clone this Context object (and objects that may have a Context object) using copy.deepcopy(). When I try to do this, the deep copy operation recurses down to the WeakValueD

Re: How to tell if I'm being run from a shell or a module

2008-02-14 Thread Jeff
Conventionally, you use: if __name__ == '__main__': # do something as a script -- http://mail.python.org/mailman/listinfo/python-list

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

How to tell if I'm being run from a shell or a module

2008-02-14 Thread dg . google . groups
Hi all, Is there any standard way to tell if the user is running from a module or from an interactive shell like IDLE or IPython? The best I've come up with so far is for a function to look at getouterframes(currentframe())[1][1] (the filename in the frame record of the frame that called the funct

Re: InstanceType tests in Python-3.0

2008-02-14 Thread Robin Becker
Steven D'Aprano wrote: > On Thu, 14 Feb 2008 15:26:08 +, Robin Becker wrote: > >> I'm in the process of porting some code. I have 2.x code that looks like >> this >> >> t = type(e) >> if t==InstanceType: >> return f0(e) >> elif t in (float,int): >> return f1(e) >> else: >> return s

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

2008-02-14 Thread J Peyret
On Feb 14, 8:50 am, "W. Watson" <[EMAIL PROTECTED]> wrote: (snip) > I thought this might be more difficult judging by a long ago experience with > Java. (snip) +1 QOTW -- http://mail.python.org/mailman/listinfo/python-list

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

2008-02-14 Thread W. Watson
Thanks. I found this to work: input_file=open('junkin.txt','r') output_file=open('junkout.txt','w') for (line_cnt, each_line) in enumerate(input_file): output_file.write('%4d '%(line_cnt+1)+each_line) output_file.close() input_file.close() I removed the print, but ran into trouble with zfill

SAGE for FPGA development

2008-02-14 Thread Blubaugh, David A.
Bill, The potential idea that I had in store for SAGE would be to first be able to develop complicated algorithms onto hardware. What I mean by this is to take for example, a FFT and then be able to map the entire algorithm into hardware, in a reasonable amount of time. It currently takes a few

Re: SAGE for FPGA development

2008-02-14 Thread Bill Hart
David, I see that if MyHDL was in SAGE, then it could be used to do what you suggest. But why not get a python interpreter and still do what you suggest. I don't see the advantage to putting it into SAGE. Who else would use it? Is there a large group of mathematicians who have access to FPGA hardw

Re: Exception on keypress

2008-02-14 Thread bockman
On 14 Feb, 14:27, Michael Goerz <[EMAIL PROTECTED]> wrote: > Hi, > > I'm writing a command line program that watches a file, and recompiles > it when it changes. However, there should also be a possibility of doing > a complete clean restart (cleaning up temp files, compiling some > dependencies, e

dictionary of operators

2008-02-14 Thread rbossy
Hi, In the standard library module "operator", it would be nice to have a dictionary mapping operators strings with their respective functions. Something like: { '+': add, '-': sub, 'in': contains, 'and': and_, 'or': or_, ... } Rationale: Recently I had to implemen

Re: InstanceType tests in Python-3.0

2008-02-14 Thread Steven D'Aprano
On Thu, 14 Feb 2008 15:26:08 +, Robin Becker wrote: > I'm in the process of porting some code. I have 2.x code that looks like > this > > t = type(e) > if t==InstanceType: > return f0(e) > elif t in (float,int): > return f1(e) > else: > return str(e) What happens if e is an insta

Re: Floating point bug?

2008-02-14 Thread Duncan Booth
Christian Heimes <[EMAIL PROTECTED]> wrote: > Bruno Desthuilliers wrote: >> I Must have miss something... > > Yeah, You have missed the beginning of the third sentence: "The tp_print > slot is not available from Python code". The tp_print slot is only > available in C code and is part of the C d

Re: Running CGI from within CGI

2008-02-14 Thread Bruno Desthuilliers
rodmc a écrit : (top-post corrected - rod, please learn to quote, thanks !-) > On Feb 14, 3:26 pm, Bruno Desthuilliers [EMAIL PROTECTED]> wrote: >> rodmc a écrit : (snip) >>> However I would like to execute a script instead so calling for >>> example myscript.py - thus populating the existing for

InstanceType tests in Python-3.0

2008-02-14 Thread Robin Becker
I'm in the process of porting some code. I have 2.x code that looks like this t = type(e) if t==InstanceType: return f0(e) elif t in (float,int): return f1(e) else: return str(e) In python 3.0 everything has been unified and people say use attributes to tell what should be done in su

Re: Parallel port control with USB->Parallel converter

2008-02-14 Thread c d saunter
Doh! It's been a while since I used these. I was slightly wrong; actually both the 232 and 245 devices can be accessed either via a serial port interface (COMx on windows, /dev/??? on linux etc.) or via a direct API. The 245 provides a parallel FIFO and the 232 a serial data link, so you'd wa

Re: Floating point bug?

2008-02-14 Thread Bruno Desthuilliers
Christian Heimes a écrit : > Bruno Desthuilliers wrote: >> I Must have miss something... > > Yeah, You have missed the beginning of the third sentence: "The tp_print > slot is not available from Python code". oops, my bad ! I missed the "not" !-) -- http://mail.python.org/mailman/listinfo/pytho

Re: Parallel port control with USB->Parallel converter

2008-02-14 Thread c d saunter
Soren, I don't know about the USB parallel port converters but there are variousways you can add USB connectivity yourself. A simple way are the USB devices from FTDI (http://www.ftdichip.com/FTProducts.htm) Either the FT232R or the FT245R. These are both single chip solutions that

Re: Parallel port control with USB->Parallel converter

2008-02-14 Thread Soren
Hey Diez, thanks for your answer! > You could try and see how far you get with pyusb, the wrapping for libusb. > However, any decent usb2-adapter should register itself as device > of the mapped kind. For example, usb2serial-converters appear as > COMx:-ports. That was my thought too, and that's

Re: Running CGI from within CGI

2008-02-14 Thread rodmc
Thanks for the details, is execfile full of security issues or something? You are right about exploring templates, I may explore that later. However I need to integrate the forms in with another system, which will not be using templates. I suspect I may have taken the long way round but I suppose

Re: Floating point bug?

2008-02-14 Thread Duncan Booth
Bruno Desthuilliers <[EMAIL PROTECTED]> wrote: > I Must have miss something... Perhaps you missed the part where Christian said "The tp_print slot is not available from Python code"? -- http://mail.python.org/mailman/listinfo/python-list

Re: Floating point bug?

2008-02-14 Thread Christian Heimes
Bruno Desthuilliers wrote: > I Must have miss something... Yeah, You have missed the beginning of the third sentence: "The tp_print slot is not available from Python code". The tp_print slot is only available in C code and is part of the C definition of a type. Hence tp_ as type. Search for float

Re: ANN: NUCULAR B3 Full text indexing (now on Win32 too)

2008-02-14 Thread Aaron Watters
On Feb 14, 3:50 am, Paul Rubin wrote: > The main thing killing most of the search apps that I'm involved with > is disk latency. If Aaron is listening, I might suggest offering a > config option to redundantly recording the stored search fields with > every search term i

Re: Running CGI from within CGI

2008-02-14 Thread Bruno Desthuilliers
rodmc a écrit : > I am new to using Python as a CGI platform, so please excuse me if > this is a dumb question. > > Anyway I have written a series of web forms (with Python scripts) > which allow the user input but also retrieve data from a database. The > data entry stage works fine however retri

Running CGI from within CGI

2008-02-14 Thread rodmc
I am new to using Python as a CGI platform, so please excuse me if this is a dumb question. Anyway I have written a series of web forms (with Python scripts) which allow the user input but also retrieve data from a database. The data entry stage works fine however retrieving data is a little more

Re: CGI with URL problem

2008-02-14 Thread rodmc
Thanks for your reply, no one is running locally on my PC and the other as the default user which occurs when the script is run through a browser. Best, rod -- http://mail.python.org/mailman/listinfo/python-list

  1   2   >