Getting a function name from string

2005-11-02 Thread David Rasmussen
If I have a string that contains the name of a function, can I call it? As in: def someFunction(): print "Hello" s = "someFunction" s() # I know this is wrong, but you get the idea... /David -- http://mail.python.org/mailman/listinfo/python-list

Re: convert COM obj to integer

2005-11-02 Thread Steve M
I don't know exactly what a COM object is, but those aren't them. The win32com package takes care of converting everything to Python types. The excel call returns a tuple of tuples. That is, the outer tuple is the sequence of rows, and each such row is itself a tuple with one member per column requ

Re: Getting a function name from string

2005-11-02 Thread Paul McGuire
"David Rasmussen" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > If I have a string that contains the name of a function, can I call it? > As in: > > def someFunction(): > print "Hello" > > s = "someFunction" > s() # I know this is wrong, but you get the idea... > > /David Lookup th

Re: Python and MySQL

2005-11-02 Thread Thomas Bartkus
"Steve Holden" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > Thomas Bartkus wrote: > > Well, I'm looking at the source for the ever popular MySQLdb library. It > > appears to be nothing but straight up Python source code. I see no reason > > why you couldn't just take these modules

lists <-> tuple

2005-11-02 Thread Peter Notebaert
I am new to Python and have to create an import library in C that uses matrices. These matrices can be one-dimensional (vectors) or two-dimensional. If I look in the ActivePython 2.4 documentation at data structures, then I see at least 2 posibilities to represent them: Lists and Tuples. The d

Re: reading internet data to generate random numbers.

2005-11-02 Thread Neil Schemenauer
Grant Edwards <[EMAIL PROTECTED]> wrote: > Doesn't your OS have an entropy-gathering RN generator built-in? Alternatively, if you want lots of high-quality random numbers, buy a cheap web camera: http://www.lavarnd.org/ . Using data from the Internet is just a bad idea. Neil -- http://mail.

RE: convert COM obj to integer

2005-11-02 Thread Bell, Kevin
Well that looks quite nice, so I'll work that into my script. Thanks!!! That 1-tuple business was confusing me, and I was getting errors stating something about converting an object, so as you can see, I was grasping at straws. -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL

Re: Most efficient way of storing 1024*1024 bits

2005-11-02 Thread Dan Bishop
Tor Erik Sønvisen wrote: > Hi > > I need a time and space efficient way of storing up to 6 million bits. The most space-efficient way of storing bits is to use the bitwise operators on an array of bytes: import array class BitList(object): def __init__(self, data=None): self._data = arr

Re: lists <-> tuple

2005-11-02 Thread Jim
> Tuples or lists for matrix-like functionality? Use lists. Tuples are meant for small immutable sets of things that go together. Lists are more like arrays, and you can assign to one existing element if you want. One exception, is a short vector is often a tuple like (x, y, z) and you might wa

pyzeroconf on windows

2005-11-02 Thread matt
Since I'm on the topic of pyzeroconf today, I might as well keep posting ;) So on to another platform... windows. Has anyone used pyzeroconf on Windows recently? It doesn't appear to work (and it isn't the 127.0.0.1 thing either). Running python Zeroconf.py gives the following: Multicast DNS Ser

Re: An FAQ Please Respond

2005-11-02 Thread Larry Bates
You can certainly have more than one version loaded. You may find it easier to fall back to Python 2.3. Unless you are using 2.4 specific features, it won't cost you much. You have to mess with path, associations, etc. in Windows registry to switch between the two. -Larry Bates clinton Brandt

Re: lists <-> tuple

2005-11-02 Thread Robert Kern
Peter Notebaert wrote: > I am new to Python and have to create an import library in C that uses > matrices. > > These matrices can be one-dimensional (vectors) or two-dimensional. If I > look in the ActivePython 2.4 documentation at data structures, then I see at > least 2 posibilities to repre

Re: An FAQ Please Respond

2005-11-02 Thread Terry Hancock
On Wednesday 02 November 2005 04:58 pm, clinton Brandt wrote: > Hey I am Learning Blender for 3D mesh design and the current Relese doesnt > recognize my python 2.4.1 it stopped at python 2.3. there alpha test of > their next release supports py 2.4 but as a noob id like to learn an a less > bu

Re: Burrows-Wheeler (BWT) Algorithm in Python

2005-11-02 Thread Michael J. Fromberger
In article <[EMAIL PROTECTED]>, "DENG" <[EMAIL PROTECTED]> wrote: > Hi, all > > I've used Python Bz2 module for times and want to kown something about > Burrows-Wheeler (BWT) algorithm, the Bz2 module is wrriten in C, is > there a version in Python too? > > BWT > http://gatekeeper.dec.com/pub/D

Re: An FAQ Please Respond

2005-11-02 Thread SPE - Stani's Python Editor
Hi Clinton, If I was you, I would stick for a little while with python 2.3 untill Blender 2.40 gets stable. In the meantime you can use Movable Python (python on an usb stick) to program in Python 2.4: http://www.voidspace.org.uk/python/movpy/ But I guess Blender will become stable soon. Stani

Re: Getting a function name from string

2005-11-02 Thread Mike Meyer
"Paul McGuire" <[EMAIL PROTECTED]> writes: > "David Rasmussen" <[EMAIL PROTECTED]> wrote in message > news:[EMAIL PROTECTED] >> If I have a string that contains the name of a function, can I call it? >> As in: >> >> def someFunction(): >> print "Hello" >> >> s = "someFunction" >> s() # I know this

Re: Xah's edu corner: the Journey of Foreign Characters thru Internet

2005-11-02 Thread Brandon K
So just stop talking. It's funny that you guys are having a conversations about not responding to a guys post. First of all, freedom of speech, blah blah, who cares, just let him alone. But certainly don't go on his post, reply, telling people not to reply. That's like saying EVEN THOUGH I'M

How to print random strings

2005-11-02 Thread theboringdays
Im at the end of chapter 3 of "Python Programming For The Absolute Beginner, Michael Dawson " and he asks to make a fortune program that displays a fortune each time its ran, and to have 5 unique fortunes. Whats confusing is that, he never discussed how to do this. The only thing he talked about w

Re: Most efficient way of storing 1024*1024 bits

2005-11-02 Thread Brandon K
BTW, it'd be 6 megabits or 750kb ;) > Six megabytes is pretty much nothing on a modern computer. == Posted via Newsgroups.com - Usenet Access to over 100,000 Newsgroups == Get Anonymous, Uncensored, Access to West and East Coast Server Farms! == Highest Retention and Completion Rat

Re: computer programming

2005-11-02 Thread Brandon K
what is .tk? Turkmenistan? or is it just some arbitrary suffix. > www.javaholics.tk == Posted via Newsgroups.com - Usenet Access to over 100,000 Newsgroups == Get Anonymous, Uncensored, Access to West and East Coast Server Farms! == Highest Retention and Completion Rates! HTTP:/

Re: How to print random strings

2005-11-02 Thread Jorge Godoy
[EMAIL PROTECTED] writes: > Im at the end of chapter 3 of "Python Programming For The Absolute > Beginner, Michael Dawson " and he asks to make a fortune program that > displays a fortune each time its ran, and to have 5 unique fortunes. > > Whats confusing is that, he never discussed how to do t

Re: Rich __repr__

2005-11-02 Thread Donn Cave
In article <[EMAIL PROTECTED]>, Ben Finney <[EMAIL PROTECTED]> wrote: > Erik Max Francis <[EMAIL PROTECTED]> wrote: > > Ben Finney wrote: > > > If I want to implement a __repr__ that's reasonably "nice" to the > > > programmer, what's the Right Way? Are there recipes I should look > > > at? > >

PEP submission broken?

2005-11-02 Thread Bryan Olson
Though I tried to submit a (pre-) PEP in the proper form through the proper channels, it has disappeared into the ether. In building a class that supports Python's slicing interface, http://groups.google.com/group/comp.lang.python/msg/8f35464483aa7d7b I encountered a Python bug, which, upon

Re: Python for .NET and IronPython

2005-11-02 Thread hrh1818
For more information on Iron Python see http://www.ironpython.com/ My take on Iron Python is the new job the develolper of Iron Python started last year takes up just about all of his time and the developer is currently spending very little time actively developing Iron Python. I suspect it will be

Re: How to print random strings

2005-11-02 Thread Mike Meyer
[EMAIL PROTECTED] writes: > Im at the end of chapter 3 of "Python Programming For The Absolute > Beginner, Michael Dawson " and he asks to make a fortune program that > displays a fortune each time its ran, and to have 5 unique fortunes. > > Whats confusing is that, he never discussed how to do th

Re: Python and MySQL

2005-11-02 Thread Steve Holden
Thomas Bartkus wrote: > "Steve Holden" <[EMAIL PROTECTED]> wrote in message > news:[EMAIL PROTECTED] > >>Thomas Bartkus wrote: >> >>>Well, I'm looking at the source for the ever popular MySQLdb library. It >>>appears to be nothing but straight up Python source code. I see no > > reason > >>>why

Re: Python for .NET and IronPython

2005-11-02 Thread James
IronPython is good if you want to bring in Python into a .NET world. Python for .NET is good if you want to bring in .NET into a Python world. As for your learning concerns, there need be none. There is really nothing to learn extra for the integration. They just work. Once you learn the .NET fra

Re: PEP submission broken?

2005-11-02 Thread Steve Holden
Bryan Olson wrote: > Though I tried to submit a (pre-) PEP in the proper form through the proper > channels, it has disappeared into the ether. > > > In building a class that supports Python's slicing interface, > >http://groups.google.com/group/comp.lang.python/msg/8f35464483aa7d7b > > I e

install warning

2005-11-02 Thread python473
I downloaded python 2.4. When attempting to run python interpreter, I get following: warning: strop functions are obsolete; use string methods How do I correct this? Did I do install incorrectly? Thanks - John -- http://mail.python.org/mailman/listinfo/python-list

how to write a blog system with Python

2005-11-02 Thread ice
I am a fresh here , and I have no idea of it. Do you have any comments? -- http://mail.python.org/mailman/listinfo/python-list

Re: Microsoft Hatred FAQ

2005-11-02 Thread John W. Kennedy
entropy wrote: > [EMAIL PROTECTED] wrote... > >>On Tue, 25 Oct 2005 16:54:13 +, John Wingate wrote: >> >> >>>Steven D'Aprano <[EMAIL PROTECTED]> wrote: >>> That would be a good guess, except that Microsoft's predatory and illegal behaviour began long before OS/2 was even planned. It be

Re: install warning

2005-11-02 Thread jepler
You are importing and using, directly or indirectly, the "strop" module. Here's an example from the interactive interpreter which triggers the warning: $ python2.3 Python 2.3.3 (#1, May 7 2004, 10:31:40) [GCC 3.3.3 20040412 (Red Hat Linux 3.3.3-7)] on linux2 Type "help", "copyright", "credits"

Re: reading internet data to generate random numbers.

2005-11-02 Thread Grant Edwards
On 2005-11-02, Neil Schemenauer <[EMAIL PROTECTED]> wrote: > Grant Edwards <[EMAIL PROTECTED]> wrote: >> Doesn't your OS have an entropy-gathering RN generator built-in? > > Alternatively, if you want lots of high-quality random numbers, buy > a cheap web camera: http://www.lavarnd.org/. The therm

Re: Python for .NET and IronPython

2005-11-02 Thread Brett Hoerner
hrh1818 wrote: > For more information on Iron Python see http://www.ironpython.com/ > My take on Iron Python is the new job the develolper of Iron Python > started last year takes up just about all of his time and the developer > is currently spending very little time actively developing Iron Pyth

Re: how to write a blog system with Python

2005-11-02 Thread Peter Hansen
ice wrote: > I am a fresh here , and I have no idea of it. > Do you have any comments? Why do you want to write your own system? There are already lots of blog programs written in Python which you could just use, or customize. -Peter -- http://mail.python.org/mailman/listinfo/python-list

Re: Running autogenerated code in another python instance

2005-11-02 Thread Paul Cochrane
On Wed, 02 Nov 2005 06:33:28 +, Bengt Richter wrote: > On Wed, 2 Nov 2005 06:08:22 + (UTC), Paul Cochrane <[EMAIL PROTECTED]> > wrote: > >>Hi all, >> >>I've got an application that I'm writing that autogenerates python code >>which I then execute with exec(). I know that this is not the

Re: reading internet data to generate random numbers.

2005-11-02 Thread Mike Meyer
Grant Edwards <[EMAIL PROTECTED]> writes: > On 2005-11-02, Neil Schemenauer <[EMAIL PROTECTED]> wrote: >> Grant Edwards <[EMAIL PROTECTED]> wrote: >> Using data from the Internet is just a bad idea. > I think that the timing of certain network events is one of the > Linux kernel's entropy sources.

weakrefs to functions for observer pattern

2005-11-02 Thread Michael Schneider
Hello All, I am comming back to python after being away for several years. I would like to use weak refs in an observer pattern implementation. The problme that I have seems to be that weakrefs can't manage functions. --- from docs: http://www.python.org/doc/current/lib/module-

Re: Python for .NET and IronPython

2005-11-02 Thread Alex Martelli
hrh1818 <[EMAIL PROTECTED]> wrote: > For more information on Iron Python see http://www.ironpython.com/ > My take on Iron Python is the new job the develolper of Iron Python > started last year takes up just about all of his time and the developer > is currently spending very little time actively

[OT] Gmane/Tunderbird users: is g.c.p.general too big?

2005-11-02 Thread Steve Holden
Sorry about this almost off-topic post, but I am guessing there must be other readers of this group who use Thunderbird (in my case 1.0.2) to access it as gmane.comp.general.python. I'm currently showing 344,548 articles in the group due to the gmane policy of permanent retention, and lately it

Re: Most efficient way of storing 1024*1024 bits

2005-11-02 Thread Alex Martelli
Brandon K <[EMAIL PROTECTED]> wrote [inverting his topposting!]: > > Six megabytes is pretty much nothing on a modern computer. > BTW, it'd be 6 megabits or 750kb ;) ...but Mike was proposing using one digit per bit, hence, 6 megabytes. That makes it easy to search for bitpatterns with re or str

another beginner sort of question

2005-11-02 Thread John Salerno
Ok, like I mentioned before, I'm learning C# for fun. I'm interested in learning Python sort of as a "supplement" (by that, I mean a language with scripting capabilities that can do things maybe simpler than C# might). One concern I have about learning them simultaneously is that I'll start to

XML DOM: XML/XHTML inside a text node

2005-11-02 Thread noahlt
In my program, I get input from the user and insert it into an XHTML document. Sometimes, this input will contain XHTML, but since I'm inserting it as a text node, xml.dom.minidom escapes the angle brackets ('<' becomes '<', '>' becomes '>'). I want to be able to override this behavior cleanly.

Re: Suggestion for (re)try statement

2005-11-02 Thread Alex Martelli
Sori Schwimmer <[EMAIL PROTECTED]> wrote: ... > 2) Rocco Morreti wrote: > > What is so repugnant about the equivalent, currently > valid way of writing it? > Nothing "repugnant". We have in almost all procedural > languages an "if-else" construct, and a "case" or > "elif" as well. Python has no

Re: Python's website does a great disservice to the language

2005-11-02 Thread Alex Martelli
The Eternal Squire <[EMAIL PROTECTED]> wrote: ... > 2) Consider what he really wants for a supervisor of software > engineers. Ideally such a person should be a software engineer with > at least 3 times the experience of the most junior member. Such a I like the general idea but not your fo

Nested List Question

2005-11-02 Thread Newsfeeds
Hello All, Could anyone tell me why this code produces the output it does? noAdjacencies = 2 gridsPerAdj = 3 rows = 4 columns = 5 gridSystemId = [[None]*columns]*rows for row in range(rows): for column in range(columns): gridSystemId[row][column] = "%d-%d" % (row,column) print gr

Re: weakrefs to functions for observer pattern

2005-11-02 Thread Alex Martelli
Michael Schneider <[EMAIL PROTECTED]> wrote: > I would like to use weak refs in an observer pattern implementation. > The problme that I have seems to be that weakrefs can't manage functions. They can manage just fine functions written in *Python*, just not "builtin functions*, i.e., ones written

Re: Nested List Question

2005-11-02 Thread Alex Martelli
Newsfeeds <[EMAIL PROTECTED]> wrote: > Hello All, > > Could anyone tell me why this code produces the output it does? ... > gridSystemId = [[None]*columns]*rows You've made gridSystemID a list of `rows` references to the SAME "inner" list, so the behavior you observe is the only possible on

Re: Nested List Question

2005-11-02 Thread Chris McCoy
Thank you! I've been banging my head against the wall! Chris M. "Alex Martelli" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > Newsfeeds <[EMAIL PROTECTED]> wrote: > >> Hello All, >> >> Could anyone tell me why this code produces the output it does? > ... >> gridSystemId = [[

Re: [OT] Gmane/Tunderbird users: is g.c.p.general too big?

2005-11-02 Thread Robert Kern
Steve Holden wrote: > Sorry about this almost off-topic post, but I am guessing there must be > other readers of this group who use Thunderbird (in my case 1.0.2) to > access it as gmane.comp.general.python. > > I'm currently showing 344,548 articles in the group due to the gmane > policy of pe

Re: another beginner sort of question

2005-11-02 Thread Mike Meyer
John Salerno <[EMAIL PROTECTED]> writes: [Wants to learn C# and Python simultaneously.] > So my question is, is this feasible? Should be. It might be faster to do them sequentually. > Or does learning Python require (or entail) learning all the details > behind it? Not really. There are some tra

Re: XML DOM: XML/XHTML inside a text node

2005-11-02 Thread Roman Suzi
On Thu, 2 Nov 2005 [EMAIL PROTECTED] wrote: > In my program, I get input from the user and insert it into an XHTML > document. Sometimes, this input will contain XHTML, but since I'm > inserting it as a text node, xml.dom.minidom escapes the angle brackets > ('<' becomes '<', '>' becomes '>'). I

Pychecker Re: Nested List Question

2005-11-02 Thread Roman Suzi
On Thu, 3 Nov 2005, Chris McCoy wrote: > Thank you! I've been banging my head against the wall! > > Chris M. >> gridSystemId = [[None]*columns]*rows > > You've made gridSystemID a list of `rows` references to the SAME "inner" > list, so the behavior you observe is the only possible one. > > If y

how can I run python interactively?

2005-11-02 Thread questions?
I need to stop the program in the middle and pause there. Are there anyway I can stop the program in the middle and have something like: please press y to continue. Thanks -- http://mail.python.org/mailman/listinfo/python-list

Re: Getting a function name from string

2005-11-02 Thread Steven D'Aprano
David Rasmussen wrote: > If I have a string that contains the name of a function, can I call it? > As in: > > def someFunction(): > print "Hello" > > s = "someFunction" > s() # I know this is wrong, but you get the idea... py> eval("someFunction()") 'Hello' py> eval(s)() # note the second

Re: Windows - Need to process quotes in string...

2005-11-02 Thread Tim Roberts
>Ernesto enlightened us with: >> >>I'm trying to use a $ delimeter, but it doesn't seem to work. Here is >>the code: >> >> >>launchWithoutConsole("devcon.exe",d'$enable >> "@USB\VID_0403&PID_6010&MI_00\7&15E4F68&1&"$) Where did you get the idea that this would work? I can't find any referen

Re: String Identity Test

2005-11-02 Thread Tim Roberts
"Richard Brodie" <[EMAIL PROTECTED]> wrote: > >"Roy Smith" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > >> On the other hand, I can't imagine any reason why you would want to >> define such a class, > >PEP 754? My congratulations on a very subtle and somewhat multicultural joke...

Re: how can I run python interactively?

2005-11-02 Thread Fredrik Lundh
"questions?" wrote: > I need to stop the program in the middle and pause there. > > Are there anyway I can stop the program in the middle and have > something like: > > please press y to continue. portable: raw_input("please press return to continue.") to get a single character, you

Re: reading internet data to generate random numbers.

2005-11-02 Thread Steven D'Aprano
Mike Meyer wrote: > Grant Edwards <[EMAIL PROTECTED]> writes: > >>On 2005-11-02, Neil Schemenauer <[EMAIL PROTECTED]> wrote: >> >>>Grant Edwards <[EMAIL PROTECTED]> wrote: >>>Using data from the Internet is just a bad idea. >> >>I think that the timing of certain network events is one of the >>Li

Re: how can I run python interactively?

2005-11-02 Thread Graham
You could use either: s = raw_input("Please Hit a Key...") s being the string they typed before hitting enter. or you could use print "Please hit a key..." s = sys.stdin.readline() the only reason i recommend the second is because i believe i saw in a PEP that raw_input was being de

Re: how to write a blog system with Python

2005-11-02 Thread Graham
Are you fresh to Python or just to this group? There are quite a few python frameworks that provide functionality for blogs. You'll just have to decide which one you want to try out. -- http://mail.python.org/mailman/listinfo/python-list

Re: Pychecker Re: Nested List Question

2005-11-02 Thread Chris McCoy
It may, but I haven't been using Pychecker yet. I'm still fairly new to Python. Thanks, Chris M. "Roman Suzi" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > On Thu, 3 Nov 2005, Chris McCoy wrote: > >> Thank you! I've been banging my head against the wall! >> >> Chris M. > >>> g

Re: Nested List Question

2005-11-02 Thread Fredrik Lundh
"Newsfeeds" <[EMAIL PROTECTED]> wrote: > Could anyone tell me why this code produces the output it does? http://www.python.org/doc/faq/programming.html#how-do-i-create-a-multidimensional-list has the full story. -- http://mail.python.org/mailman/listinfo/python-list

Re: Pychecker Re: Nested List Question

2005-11-02 Thread Mike Meyer
Roman Suzi <[EMAIL PROTECTED]> writes: > On Thu, 3 Nov 2005, Chris McCoy wrote: >>> gridSystemId = [[None]*columns]*rows >> You've made gridSystemID a list of `rows` references to the SAME "inner" >> list, so the behavior you observe is the only possible one. >> If you want copies instead, ASK for

Re: how can I run python interactively?

2005-11-02 Thread questions?
Thanks guys for the reply. This is very helpful -- http://mail.python.org/mailman/listinfo/python-list

Re: how can I run python interactively?

2005-11-02 Thread [EMAIL PROTECTED]
try something like -> s = raw_input("Please Press a button...") #s is the string they type. Although i believe i remember a PEP that said they were removing raw_input so perhaps print "Please Press A button..." s = sys.stdin.readline() would be better, note the above requires yo

Re: reading internet data to generate random numbers.

2005-11-02 Thread Robert Kern
Steven D'Aprano wrote: > Mike Meyer wrote: >>BSD as well. The key word is "one". While network events don't make a >>good source of random data, proplery combining such sources can create >>good random data. > > > > Depends on what you mean by "random". In particular, > the randomness of netw

Re: Python and Lotus Notes

2005-11-02 Thread Grzegorz Ślusarek
thank you Graham Now I know how to get it thru And i have last question is it possible send mail from Lotus via Python/COM? Once Again Thanks -- http://mail.python.org/mailman/listinfo/python-list

<    1   2   3