Re: Retrieve Tkinter listbox item by string, not by index

2006-12-23 Thread Godson
On 12/23/06, Kevin Walzer <[EMAIL PROTECTED]> wrote: I'm trying to set the active item in a Tkinter listbox to my application's currently-defined default font. Here's how I get the fonts loaded into the listbox: self.fonts=list(tkFont.families()) self.fonts.sort() for item in self.font

Re: httplib and socket.getaddrinfo

2006-12-23 Thread Gabriel Genellina
At Saturday 23/12/2006 04:21, [EMAIL PROTECTED] wrote: I noticed the following lines from the connect() method of the HTTPConnection class within httplib: for res in socket.getaddrinfo(self.host, self.port, 0, socket.SOCK_STREAM): af, so

Re: attribute decorators

2006-12-23 Thread Fredrik Lundh
Doug Holton wrote: > Don't mind Fredrik's trolling. Your examples are perfectly clear if you understand how they would work, can you explain the semantics? > however, a similar call for extending the use of decorators to other > structures besides functions was rejected: > http://lambda-the-

Re: One module per class, bad idea?

2006-12-23 Thread stdazi
Matias Jansson wrote: > I come from a background of Java and C# where it is common practise to have > one class per file in the file/project structure. As I have understood it, > it is more common practice to have many classes in a Python module/file. > What is the motivation behind it, would it b

Gdmodule

2006-12-23 Thread Timothy Wu
Hi, Is Gdmodule used much at all in the Python community or are there alternative packages more suitable for the purpose? I seem to find documentation for Gdmodule ( http://newcenturycomputers.net/projects/gd-ref.html) to require prior experience with the GD library in another language. Or at lea

Multi-line docstrings

2006-12-23 Thread Lawrence D'Oliveiro
The Python docs recommend the use of triple-quoted string literals for docstrings, e.g. def Meet(Alice, Bob) : """arranges a meeting between Alice and Bob. Returns a reference to the meeting booking object.""" ... #end Meet However, these tend to get messed up by i

Question on regex

2006-12-23 Thread Prabhu Gurumurthy
Hello all - I have a file which has IP address and subnet number and I use regex to extract the IP separately from subnet. pattern used for IP: \d{1,3}(\.\d{1,3}){3} pattern used for subnet:((\d{1,3})|(\d{1,3}(\.\d{1,3}){1,3}))/(\d{1,2}) so I have list of ip/subnets strewn around like this 1

Re: Xah's Edu Corner: Introduction to 3D Graphics Programing

2006-12-23 Thread Boris Borcic
Xah Lee wrote: > Of Interest: to which of comp.lang.perl.misc, comp.lang.python, comp.lang.lisp, comp.lang.java.programmer, comp.lang.functional ? -- http://mail.python.org/mailman/listinfo/python-list

Re: Multi-line docstrings

2006-12-23 Thread Duncan Booth
Lawrence D'Oliveiro <[EMAIL PROTECTED]> wrote: > The Python docs recommend the use of triple-quoted string literals for > docstrings, e.g. > > def Meet(Alice, Bob) : > """arranges a meeting between Alice and Bob. > Returns a reference to the meeting booking object.""" >

Re: Generating all permutations from a regexp

2006-12-23 Thread Chris Johnson
BJörn Lindqvist wrote: > With regexps you can search for strings matching it. For example, > given the regexp: "foobar\d\d\d". "foobar123" would match. I want to > do the reverse, from a regexp generate all strings that could match > it. > > The regexp: "[A-Z]{3}\d{3}" should generate the strings

ANN: eric3 3.9.3 released

2006-12-23 Thread Detlev Offenbach
Hi, this is to inform you about the availability of eric3 version 3.9.3. This release fixes a few bugs and enhances compatibility with subversion 1.4. It is available via http://sourceforge.net/project/showfiles.php?group_id=119070. What is eric3? -- eric3 is an IDE for Python and Ru

Newbie: what is a usefull IDE for Python on Windows ?

2006-12-23 Thread Osiris
what is a usefull IDE for Python on Windows ? I saw Eric mentioned.. is that WinXP or Linux ? What does "everybody" use ? I was considering using old and very stable C-code in a new web application via Python/Plone/Zope. -- http://mail.python.org/mailman/listinfo/python-list

Re: Question on regex

2006-12-23 Thread Felix Benner
Prabhu Gurumurthy schrieb: > to fix this problem, i used negative lookahead with ip pattern: > so the ip pattern now changes to: > \d{1,3}(\.\d{1,3}){3}(?!/\d+) > > now the problem is 10.150.100.0 works fine, 10.100.4.64 subnet gets > matched with ip pattern with the following result: > > 10.10

Re: Newbie: what is a usefull IDE for Python on Windows ?

2006-12-23 Thread Fredrik Lundh
Osiris wrote: > what is a usefull IDE for Python on Windows ? > > I saw Eric mentioned.. is that WinXP or Linux ? > > What does "everybody" use ? http://effbot.org/pyfaq/tutor-whats-the-best-editor-ide-for-python -- http://mail.python.org/mailman/listinfo/python-list

Re: Multi-line docstrings

2006-12-23 Thread bearophileHUGS
Duncan Booth: > Not spuriously included: included by design, but sometimes annoying. Then it's a design decision I don't understand... Bye, bearophile -- http://mail.python.org/mailman/listinfo/python-list

Re: Decorator for Enforcing Argument Types

2006-12-23 Thread Bruno Desthuilliers
George Sakkis a écrit : > John Machin wrote: > > >>Peter Wang wrote: >> >>>Bruno Desthuilliers wrote: >>> Python is dynamic, and fighting against the language is IMHO a really bad idea. The only places where theres a real need for this kind of stuff are when dealing with the "ou

Re: Confusion over calling a nested function inside a parent function

2006-12-23 Thread Bruno Desthuilliers
MacDonald a écrit : > Pyenos wrote: > >>[code] >>class WORK: >>def getwork(self): >>def choosetable(self):pass >>choosetable() #TypeError: choosetable() takes exactly 1 >> #argument (0 given) >>[/code] >> >>Calling choosetable() at the above location gives

Re: Newbie: what is a usefull IDE for Python on Windows ?

2006-12-23 Thread Osiris
btw: my system is an AMD 1.8 GHz, 512 Mbyte with WinXPSP2. I saw that a system like Wing would be sluggish ... -- http://mail.python.org/mailman/listinfo/python-list

Re: Confusion over calling a nested function inside a parent function

2006-12-23 Thread Bruno Desthuilliers
Pyenos a écrit : > [code] You already got the answer - just a pair of stylistic advices: > class WORK: 1/ By convention, ALL_UPPER names denote (pseudo) symbolic constants. The convention for class names is CamelCase. 2/ better to use new-style classes. => class Work(object): ... -- http:

Re: Newbie: what is a usefull IDE for Python on Windows ?

2006-12-23 Thread Osiris
ok, thnx. Thread closed :-) -- http://mail.python.org/mailman/listinfo/python-list

Re: Multi-line docstrings

2006-12-23 Thread Duncan Booth
[EMAIL PROTECTED] wrote: > Duncan Booth: >> Not spuriously included: included by design, but sometimes annoying. > > Then it's a design decision I don't understand... > I think the decision is that the doc string should reflect exactly what you entered in the string. i.e. the system shouldn't t

Re: [ANN] pyparsing 1.4.5 released

2006-12-23 Thread Richard Townsend
On 22 Dec 2006 19:59:53 -0800, Paul McGuire wrote: > > Download pyparsing 1.4.5 at http://pyparsing.sourceforge.net. The > pyparsing Wiki is at http://pyparsing.wikispaces.com > When I click on the sourceforge link above, I get redirected to the wiki. However, http://sourceforge.net/projects/

Elliptic Curve Library

2006-12-23 Thread Mike Tammerman
Hi, I need an elliptic curve library that can be used by python. I googled but couldn't find a one. I'll appreciate, if you could show me. Mike -- http://mail.python.org/mailman/listinfo/python-list

Re: How a script can know if it has been called with the -i command line option?

2006-12-23 Thread vasudevram
Peter Wang wrote: > Michele Simionato wrote: > > The subject says it all, I would like a script to act differently when > > called as > > $ python script.py and when called as $ python -i script.py. I looked > > at the sys module > > but I don't see a way to retrieve the command line flags, where

Re: Elliptic Curve Library

2006-12-23 Thread vasudevram
Mike Tammerman wrote: > Hi, > > I need an elliptic curve library that can be used by python. I googled > but couldn't find a one. I'll appreciate, if you could show me. > > Mike What is the library you need supposed to do? Vasudev Ram Dancing Bison Enterprises www.dancingbison.com -- http://ma

Re: How a script can know if it has been called with the -i command line option?

2006-12-23 Thread vasudevram
vasudevram wrote: > Peter Wang wrote: > > Michele Simionato wrote: > > > The subject says it all, I would like a script to act differently when > > > called as > > > $ python script.py and when called as $ python -i script.py. I looked > > > at the sys module > > > but I don't see a way to retrie

Re: pyparsing 1.4.5 released

2006-12-23 Thread Paul McGuire
On Dec 23, 9:07 am, Richard Townsend <[EMAIL PROTECTED]> wrote: > On 22 Dec 2006 19:59:53 -0800, Paul McGuire wrote: > > > > > Download pyparsing 1.4.5 athttp://pyparsing.sourceforge.net. The > > pyparsing Wiki is athttp://pyparsing.wikispaces.comWhen I click on the > > sourceforge link above, I

Re: Elliptic Curve Library

2006-12-23 Thread Mike Tammerman
I will try to implement an ID-Based Cryptography. I also need bilinear pairing operations. Mike vasudevram wrote: > Mike Tammerman wrote: > > Hi, > > > > I need an elliptic curve library that can be used by python. I googled > > but couldn't find a one. I'll appreciate, if you could show me. > >

Add/Remove Channels in Asyncore?

2006-12-23 Thread Chris
I've implemented a real basic IRC client class in 100 lines using asynchat (yes I know about Twisted). The problem I'm having is arbitrarily starting and stopping multiple instances of this class after I call loop(). The asyncore docs seem to imply everything's fixed in stone once loop() is called

Re: let me simplify my question on scope of vars

2006-12-23 Thread Colin J. Williams
Pyenos wrote: > "code" > var=1 > class CLASS: > def METHOD1: > def METHOD2: > var+=var > return var > METHOD2() #line8 > return var > METHOD1()

Re: Add/Remove Channels in Asyncore?

2006-12-23 Thread Fredrik Lundh
Chris wrote: > I've implemented a real basic IRC client class in 100 lines using > asynchat (yes I know about Twisted). The problem I'm having is > arbitrarily starting and stopping multiple instances of this class > after I call loop(). > > The asyncore docs seem to imply everything's fixed in s

Re: removing the header from a gzip'd string

2006-12-23 Thread debarchana . ghosh
Bjoern Schliessmann wrote: > Rajarshi wrote: > > > Does anybody know how I can remove the header portion of the > > compressed bytes, such that I only have the compressed data > > remaining? (Obviously I do not intend to perform the > > decompression!) > > Just curious: What's your goal? :) A home

Re: removing the header from a gzip'd string

2006-12-23 Thread Bjoern Schliessmann
[EMAIL PROTECTED] wrote: > Actually I was implementing the use of the normalized compression > distance to evaluate molecular similarity as described in an > article in J.Chem.Inf.Model (http://dx.doi.org/10.1021/ci600384z, > subscriber access only, unfortunately). Interesting. Thanks for the rep

Re: Newbie: what is a usefull IDE for Python on Windows ?

2006-12-23 Thread BartlebyScrivener
in addition to the effbot link, search the group http://tinyurl.com/yyuxco -- http://mail.python.org/mailman/listinfo/python-list

Re: Xah's Edu Corner: Introduction to 3D Graphics Programing

2006-12-23 Thread Jon Harrop
Xah Lee wrote: > Introduction to 3D Graphics Programing > http://xahlee.org/3d/index.html You will probably find it more rewarding to use a more modern graphics system, such as OpenGL or DirectX, with a suitable programming language rather than Mathematica's. I would recommend any of OCaml, F#, Ha

Re: Elliptic Curve Library

2006-12-23 Thread Jaap Spies
Mike Tammerman wrote: > I need an elliptic curve library that can be used by python. I googled > but couldn't find a one. I'll appreciate, if you could show me. > You could look at http://sage.scipy.org/sage/ http://sage.scipy.org/sage/features.html Jaap -- http://mail.python.org/mailman/listi

Re: textwrap.dedent replaces tabs?

2006-12-23 Thread Tom Plunket
Frederic Rentsch wrote: > Following a call to dedent () it shouldn't be hard to translate leading > groups of so many spaces back to tabs. Sure, but the point is more that I don't think it's valid to change to tabs in the first place. E.g.: input = ' ' + '\t' + 'hello\n' + '\t' + 'wo

Re: Xah's Edu Corner: Introduction to 3D Graphics Programing

2006-12-23 Thread J�rgen Exner
Boris Borcic wrote: > Xah Lee wrote: >> Of Interest: > > to which of comp.lang.perl.misc, comp.lang.python, comp.lang.lisp, > comp.lang.java.programmer, comp.lang.functional ? You must be new. Otherwise you would be familiar with this troll already. jue -- http://mail.python.org/mailman/listi

Re: merits of Lisp vs Python

2006-12-23 Thread Fuzzyman
Lars Rune Nøstdal wrote: > On Fri, 08 Dec 2006 03:07:09 -0800, Mark Tarver wrote: > > > How do you compare Python to Lisp? What specific advantages do you > > think that one has over the other? > > > > Note I'm not a Python person and I have no axes to grind here. This is > > just a question for

Re: PyExcelerator: how to set colours?

2006-12-23 Thread Waldemar Osuch
Gerry wrote: > I'd like some cell to be a Blue "ABCDE". > > Here's come code thatv tries various values for pattern_for_colour and > font.colour_index, to no avail. > > Can anyone suggest the right way to set colours? > > Thanks! > > Gerry > > == > > from pyExcelerator import *

Re: merits of Lisp vs Python

2006-12-23 Thread defcon8
All of you are nazis! -- http://mail.python.org/mailman/listinfo/python-list

Re: merits of Lisp vs Python

2006-12-23 Thread Fuzzyman
defcon8 wrote: > All of you are nazis! Hmmm... that might work. :-) Fuzzyman http://www.voidspace.org.uk/python/articles.shtml -- http://mail.python.org/mailman/listinfo/python-list

Getting the name of an assignment

2006-12-23 Thread Adam Atlas
Is it possible for an object, in its __init__ method, to find out if it is being assigned to a variable, and if so, what that variable's name is? I can think of some potentially ugly ways of finding out using sys._getframe, but if possible I'd prefer something less exotic. (Basically I have a class

Re: Generating all permutations from a regexp

2006-12-23 Thread Thomas Ploch
Fredrik Lundh wrote: > Nick Craig-Wood wrote: > >> A regular expression matcher uses a state machine to match strings. > > unless it's the kind of regular expression matcher that doesn't use a > state machine, like the one in Python. > > > How is the matching engine implemented then? I thou

Re: Fall of Roman Empire

2006-12-23 Thread Thomas Ploch
Delaney, Timothy (Tim) wrote: > Hendrik van Rooyen wrote: > >> naaah - you don't have to worry - for real control He uses assembler. >> with jump statements. >> so the loops are closed. >> >> Unfortunately its not open source. Yet. > > People are working hard on reverse-engineering it though. I

Re: Getting the name of an assignment

2006-12-23 Thread BJörn Lindqvist
On 23 Dec 2006 14:38:19 -0800, Adam Atlas <[EMAIL PROTECTED]> wrote: > Is it possible for an object, in its __init__ method, to find out if it > is being assigned to a variable, and if so, what that variable's name > is? I can think of some potentially ugly ways of finding out using > sys._getframe

Re: Generating all permutations from a regexp

2006-12-23 Thread Chris Johnson
Thomas Ploch wrote: > Fredrik Lundh wrote: > > Nick Craig-Wood wrote: > > > >> A regular expression matcher uses a state machine to match strings. > > > > unless it's the kind of regular expression matcher that doesn't use a > > state machine, like the one in Python. > > > > > > > > How is the ma

Re: Getting the name of an assignment

2006-12-23 Thread Adam Atlas
On Dec 23, 5:58 pm, "BJörn Lindqvist" <[EMAIL PROTECTED]> wrote: > On 23 Dec 2006 14:38:19 -0800, Adam Atlas <[EMAIL PROTECTED]> wrote: > > > Is it possible for an object, in its __init__ method, to find out if it > > is being assigned to a variable, and if so, what that variable's name > > is? I c

Re: Getting the name of an assignment

2006-12-23 Thread Steven D'Aprano
On Sat, 23 Dec 2006 14:38:19 -0800, Adam Atlas wrote: > Is it possible for an object, in its __init__ method, to find out if it > is being assigned to a variable, and if so, what that variable's name > is? What should the variable name be set to if you do one of the following? john = eric = gr

Re: Class constant for extension

2006-12-23 Thread Martin Miller
[EMAIL PROTECTED] wrote: > Hi, > > I have written a small prototype Python extension for a C-library. > > I have the methods all sorted out and it is working fine. > > In the C-library, they are various constants of types like string, > integer, float and matrix. I'd like to expose them as RE

Re: Use a Thread to reload a Module?

2006-12-23 Thread Gregory Piñero
On 12/23/06, Hendrik van Rooyen <[EMAIL PROTECTED]> wrote: > have you looked at putting the data into a persistent dict? > > - Hendrik > What is that exactly? -Greg -- http://mail.python.org/mailman/listinfo/python-list

Help please using telnetlib module

2006-12-23 Thread dudds
Hi Guys, I just started learning Python a couple of days ago and to put some of what I learnt into practice. As such I thought I might try and write a simple program (based on examples I had seen) that would allow me to log into a Cisco router, enter configuration mode, change an interface descrip

Re: regular expression

2006-12-23 Thread Joe Kesselman
Reminder: anything crossposted across this many newsgroups, especially asking an inherently bogus question, is probably just trolling. If it's equally on topic everywhere, that means it's on topic nowhere. -- () ASCII Ribbon Campaign | Joe Kesselman /\ Stamp out HTML e-mail! | System architext

Re: Getting the name of an assignment

2006-12-23 Thread Steven Bethard
Adam Atlas wrote: > Is it possible for an object, in its __init__ method, to find out if it > is being assigned to a variable, and if so, what that variable's name > is? I can think of some potentially ugly ways of finding out using > sys._getframe, but if possible I'd prefer something less exotic.

split string with hieroglyphs

2006-12-23 Thread Belize
Hi. Essence of problem in the following: Here is lines in utf8 of this form "BZ?ツーリTV%ツキDVD" Is it possible to split them into the fragments that contain only latin printable symbols (aplhabet + "?#" etc) and fragments with the hieroglyphs, so it could be like this ['BZ?', '\xe3\x83\x84\xe3\x83\xbc

Re: Getting the name of an assignment

2006-12-23 Thread Adam Atlas
Thanks, Steven and Steven. @Bethard: Isn't it a bit convoluted to use metaclasses? someinstance.__class__.__name__ does the same thing. @D'Aprano: Thanks for the advice to rethink my data model. I'm doing so right now, and I've already come up with a way that makes more sense. :) -- http://mail

some OT: how to solve this kind of problem in our program?

2006-12-23 Thread oyster
1. first of all, what is the English jargon (Optimize? But I think this is not a very good keyword :( )for this problem? So I can use it to search on the internet 2. is there any free/open lib for this? 3. I know for some questions(case 1, case 2, and sudoku), we can use bundles of "FOR...NEXT" loo

Re: split string with hieroglyphs

2006-12-23 Thread Steven D'Aprano
On Sat, 23 Dec 2006 19:28:48 -0800, Belize wrote: > Hi. > Essence of problem in the following: > Here is lines in utf8 of this form "BZ???TV%??DVD" > Is it possible to split them into the fragments that contain only latin > printable symbols (aplhabet + "?#" etc) Of course it is possible, but the

Re: some OT: how to solve this kind of problem in our program?

2006-12-23 Thread John Machin
oyster wrote: [snip] > I have written the case 1 in python, it needs 90 seconds on my pc, and > the same approach in www.freebasic.net takes less than 1 seconds > [code for python] > import sets > import time > try: > import psyco > psyco.full() > except: > pass > > d0, d1=1, 2 > > st=time.t

Re: Getting the name of an assignment

2006-12-23 Thread Steven Bethard
Adam Atlas wrote: > Isn't it a bit convoluted to use metaclasses? Yep. It's a well known fact that putting "convoluted" and "metaclasses" in the same sentence is repetitively redundant. ;-) > someinstance.__class__.__name__ does the same thing. No, not really:: >>> class C(object): .

Re: Fall of Roman Empire

2006-12-23 Thread Hendrik van Rooyen
"Thomas Ploch" <[EMAIL PROTECTED]> wrote: > Delaney, Timothy (Tim) wrote: > > Hendrik van Rooyen wrote: > > > >> naaah - you don't have to worry - for real control He uses assembler. > >> with jump statements. > >> so the loops are closed. > >> > >> Unfortunately its not open source. Yet. > >

Re: Use a Thread to reload a Module?

2006-12-23 Thread Hendrik van Rooyen
"Gregory Piñero" <[EMAIL PROTECTED]> wrote: > On 12/23/06, Hendrik van Rooyen <[EMAIL PROTECTED]> wrote: > > have you looked at putting the data into a persistent dict? > > > > - Hendrik > > > What is that exactly? > > -Greg from the docs: 3.17 shelve -- Python object persistence A ``shelf'' i

Re: Use a Thread to reload a Module?

2006-12-23 Thread Gregory Piñero
On 12/24/06, Hendrik van Rooyen <[EMAIL PROTECTED]> wrote: > "Gregory Piñero" <[EMAIL PROTECTED]> wrote: ... > open( filename[,flag='c'[,protocol=None[,writeback=False[,binary=None) > > Open a persistent dictionary. The filename specified is the base filename for > the underlying database. As a