Re: wxPython newbie question, creating "mega widgets" , and DnD

2005-11-10 Thread Chris Cioffi
On 10 Nov 2005 07:19:30 -0800, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote: > I've made the switch from tKinter to wxPython. I'm slowly trying to > learn it, but I had a question - what is the appropriate object to > subclass to create a "mega widget" ie A listbox with it's add/delete > buttons a

Re: Script to export MySQL tables to csv

2005-11-10 Thread Gerhard Häring
Jandre wrote: > To anyone that can help > > I have 2 MySQL databases that contain large amounts of tables. I need > to be able to compare the data in the tables with older/newer versions > of the tables. I figured the easiest way would be to get the info in > csv format and then run a comparison.

Re: What do you use as symbols for Python ?

2005-11-10 Thread Gary Herron
Erik Max Francis wrote: >Pierre Barbier de Reuille wrote: > > > >>When you need some symbols in your program, what do you use in Python ? >> >>For example, an object get a state. This state is more readable if >>expressed as a symbols, for example "opened", "closed", "error". >>Typically, in C o

Re: Python obfuscation

2005-11-10 Thread The Eternal Squire
Come on! I was only just trying to accomodate the OP with a plausible method to fit his business model, based on techniques passed on to me by my various teachers at school and my senseis at workplaces.. Please don't judge me for attempting to pass on experience. It's his choice. While I'd like

Re: Newb ??

2005-11-10 Thread Steve Holden
Norman Silverstone wrote: > On Fri, 11 Nov 2005 01:39:40 +1100, Steven D'Aprano wrote: > > >>On Thu, 10 Nov 2005 13:30:05 +, Norman Silverstone wrote: >> >> In that case, think of "bisection". Originally, all the computer knows is that the number is in some range, say 0 to 100. It c

Re: Pythonising the vim (e.g. syntax popups) -> vimpst

2005-11-10 Thread [EMAIL PROTECTED]
Christoph Haas wrote: > But Vim scripting looked even evil for me... and > I've been working with Perl for a decade. :) Vim scripting is nasty, but thankfully you don't really need to use it any more. You can write all your code in python with just a one-line hook to map it to a key. On the topic

Re: Pythonising the vim (e.g. syntax popups) -> vimpst

2005-11-10 Thread [EMAIL PROTECTED]
[EMAIL PROTECTED] wrote: > 2. Failing that, look in a help dictionary; I generated mine from the > info version of the Python docs, using a simple Python script. Which is as follows (run on all the python-lib*info* files and it'll generate a file called "output"; rename that to ~/.vim/pyhelp.py)

Re: Newb ??

2005-11-10 Thread Fredrik Lundh
Norman Silverstone wrote: > > Heh, you will find that Python is practically executable pseudo-code! > > > > Untested: > > > > > > def guess_number(): > > # please don't cheat the poor computer... > > print "Guess a number." > > lo = 0 > > hi = 100 > > while True: > > gue

Re: Newb ??

2005-11-10 Thread Fredrik Lundh
Norman Silverstone wrote: > > Heh, you will find that Python is practically executable pseudo-code! > > > > Untested: > > > > > > def guess_number(): > > # please don't cheat the poor computer... > > print "Guess a number." > > lo = 0 > > hi = 100 > > while True: > > gu

help make it faster please

2005-11-10 Thread pkilambi
I wrote this function which does the following: after readling lines from file.It splits and finds the word occurences through a hash table...for some reason this is quite slow..can some one help me make it faster... f = open(filename) lines = f.readlines() def create_words(lines): cnt = 0

Is PEP 237 accepted?

2005-11-10 Thread malkarouri
I was just having a pass on the peps when I noticed that the Unifying Long Integers and Integers PEP is still draft. With most of it already implemented - I understand banning the trailing 'L' is the only thing left, shouldn't it at least be flagged as Accepted, if not Final? karouri -- http://m

Re: help make it faster please

2005-11-10 Thread [EMAIL PROTECTED]
why reload wordlist and sort it after each word processing ? seems that it can be done after the for loop. [EMAIL PROTECTED] wrote: > I wrote this function which does the following: > after readling lines from file.It splits and finds the word occurences > through a hash table...for some reason

Re: [ x for x in xrange(10) when p(x) ]

2005-11-10 Thread Colin J. Williams
Alex Martelli wrote: > George Sakkis <[EMAIL PROTECTED]> wrote: >... > FP functions like dropwhile/takewhile etc. >>> >>>No way -- the itertools module is and remains a PRECIOUS resource. >>>If you want an iterator rather than a list, itertools.ifilter is quite >>>appropriate here. >> >>Wh

Re: Python-based Document Management System?

2005-11-10 Thread B Mahoney
If you search for CONTENT management system, there is Plone: A user-friendly and powerful open source Content Management ... http://plone.org/ -- http://mail.python.org/mailman/listinfo/python-list

Re: Python as a HTTP Client

2005-11-10 Thread James Tanis
If you haven't discovered www.python.org yet I suggest going there :P. You will find there the documentation you need under the conspicuous name library reference. Specifically the modules you'd probably most be interested in are urllib/urllib2/httplib depending on what you need. Their may be other

Re: help make it faster please

2005-11-10 Thread pkilambi
Oh sorry indentation was messed here...the wordlist = countDict.keys() wordlist.sort() should be outside the word loop now def create_words(lines): cnt = 0 spl_set = '[",;<>{}_&?!():-[\.=+*\t\n\r]+' for content in lines: words=content.split() countDict={} wor

Re: help make it faster please

2005-11-10 Thread [EMAIL PROTECTED]
don't know your intend so have no idea what it is for. However, you are doing : wordlist=contDict.keys() wordlist.sort() for every word processed yet you don't use the content of x in anyway during the loop. Even if you need one fresh snapshot of contDict after each word, I don't see the need fo

Re: python + ODBC + Oracle + MySQL - money

2005-11-10 Thread Grig Gheorghiu
Yes, I did run into the difference in the parameter styles, so I deal with that in the database-specific classes. It's not a huge difficulty though. Grig -- http://mail.python.org/mailman/listinfo/python-list

Re: help make it faster please

2005-11-10 Thread Lonnie Princehouse
You're making a new countDict for each line read from the file... is that what you meant to do? Or are you trying to count word occurrences across the whole file? -- In general, any time string manipulation is going slowly, ask yourself, "Can I use the re module for this?" # disclaimer: unteste

Re: help make it faster please

2005-11-10 Thread bearophileHUGS
This can be faster, it avoids doing the same things more times: from string import maketrans, ascii_lowercase, ascii_uppercase def create_words(afile): stripper = """'[",;<>{}_&?!():[]\.=+-*\t\n\r^%0123456789/""" mapper = maketrans(stripper + ascii_uppercase, " "*le

Re: help make it faster please

2005-11-10 Thread Larry Bates
[EMAIL PROTECTED] wrote: > I wrote this function which does the following: > after readling lines from file.It splits and finds the word occurences > through a hash table...for some reason this is quite slow..can some one > help me make it faster... > f = open(filename) > lines = f.readlines() >

Re: help make it faster please

2005-11-10 Thread pkilambi
Actually I create a seperate wordlist for each so called line.Here line I mean would be a paragraph in future...so I will have to recreate the wordlist for each loop -- http://mail.python.org/mailman/listinfo/python-list

Re: Pythonising the vim (e.g. syntax popups) -> vimpst

2005-11-10 Thread Micah Elliott
On Nov 10, [EMAIL PROTECTED] wrote: > vim... I'll try to get it more polished/functional and put it up on > sourceforge or somewhere. Change "sourceforge or somewhere" to: http://www.vim.org/scripts/add_script.php -- _ _ ___ |V|icah |- lliott http://micah.elliott.name [EMAIL PROTECTED] " "

Re: Python as a HTTP Client

2005-11-10 Thread David Rasmussen
Fuzzyman wrote: > ``urllib2`` is the standard library module you need. > > I've written a guide to using it (although it's very easy - but some > attributes of the errors it can raise aren't documented) : > > http://www.voidspace.org.uk/python/articles/urllib2.shtml > > All the best, > > Fu

Re: What do you use as symbols for Python ?

2005-11-10 Thread Pierre Barbier de Reuille
Well, thank you all ! I still feel it could be good for Python to have some kind of symbols built in, and I will try to expose that to the python-dev list, to see their reaction. But in the different solutions proposed, the one I prefer is probably the definitions of contants in a class to group

Re: IE Temporary Internet Files & Python

2005-11-10 Thread rtilley
Tim Golden wrote: > [rtilley] > > >>Below is a script that recursively deletes files from a directory. It >>works well on the two directories that I'm currently using it on: > > >>C:\Documents and Settings\user\Cookies >>C:\Documents and Settings\user\Temp > > >>However, I'd like to use it o

Re: help make it faster please

2005-11-10 Thread pkilambi
ok this sounds much better..could you tell me what to do if I want to leave characters like @ in words.So I would like to consider this as a part of word -- http://mail.python.org/mailman/listinfo/python-list

Re: Python as a HTTP Client

2005-11-10 Thread David Rasmussen
James Tanis wrote: > If you haven't discovered www.python.org yet I suggest going there :P. > You will find there the documentation you need under the conspicuous > name library reference. Specifically the modules you'd probably most > be interested in are urllib/urllib2/httplib depending on what y

Re: help make it faster please

2005-11-10 Thread Lonnie Princehouse
The word_finder regular expression defines what will be considered a word. "[a-z0-9_]" means "match a single character from the set {a through z, 0 through 9, underscore}". The + means "match as many as you can, minimum of one" To match @ as well, add it to the set of characters to match: wor

Re: Python as a HTTP Client

2005-11-10 Thread Fredrik Lundh
David Rasmussen wrote: > I do know about www.python.org. I do an extensive amount of googling in > general and searching at python.org before I ask questions such as this. > I did stumble upon urllib, urllib2 and httplib in the documentation, but > let me assure you, as a newbie, that finding this

Re: ANN: P(x) 0.2 applet builder

2005-11-10 Thread Mike Meyer
Steve Holden <[EMAIL PROTECTED]> writes: > LB wrote: >>>The tarball can be found at >>http://www.mired.org/downloads/P(x)-0.2.tar.gz >. >> Something doesn't work with the link. >> LB >> > Copy the whole string up to and including the ".gz" at the end and > paste that into your browser's location wi

Re: help make it faster please

2005-11-10 Thread Fredrik Lundh
Lonnie Princehouse wrote: > "[a-z0-9_]" means "match a single character from the set {a through z, > 0 through 9, underscore}". "\w" should be a bit faster; it's equivalent to "[a-zA-Z0-9_]" (unless you specify otherwise using the locale or unicode flags), but is handled more efficiently by the R

Re: What do you use as symbols for Python ?

2005-11-10 Thread Scott David Daniels
Pierre Barbier de Reuille wrote: > Well, thank you all ! > > I still feel it could be good for Python to have some kind of symbols > built in, and I will try to expose that to the python-dev list, to see > their reaction. > > But in the different solutions proposed, the one I prefer is probably >

Re: Addressing the last element of a list

2005-11-10 Thread Mike Meyer
[Context recovered from top posting.] "[EMAIL PROTECTED]" <[EMAIL PROTECTED]> writes: > Daniel Crespo wrote: >> Well, I hope that newcomers to Python don't confuse himselves :) > This mutable/immutable object and name/variable is confusing. Only if you have to overcome a conviction that variables

Re: What do you use as symbols for Python ?

2005-11-10 Thread Lonnie Princehouse
I use custom classes and the "is" operator... that way, things don't get confused with integers, and I have an object where repr(state) will give me more than an integer. (the integer approach works well enough but seems like a case of "I can program C in ANY language!") opened = type('opened', (

Re: ANN: P(x) 0.2 applet builder

2005-11-10 Thread Fredrik Lundh
Mike Meyer wrote: > Since following standards is optional on the web, at least if things > work in the most popular browser of the day, I probably should have > seen this coming. IE has no problems handling that link, if that's what you mean. judging from [ Info] Unable to open input file:

Re: Addressing the last element of a list

2005-11-10 Thread [EMAIL PROTECTED]
After one knows the characteristic, it is no problem. But judging from the frequency of the same issue coming up from time to time, it does confuse people coming from certain programming background. Mike Meyer wrote: > Only if you have to overcome a conviction that variables behave in a > differen

Re: wxPython newbie question, creating "mega widgets" , and DnD

2005-11-10 Thread Lonnie Princehouse
Yes, wx.Panel. > A side question - why is their a EVT_LIST_BEGIN_DRAG but no > EVT_LIST_END_DRAG, unlike tree's which have BEGIN and END? I need a > draggable list box, and would prefer to not handle low level mouse > events. Dunno. There is an EVT_LIST_COL_END_DRAG, though, maybe that will hel

RE: IE Temporary Internet Files & Python

2005-11-10 Thread James Hu
Maybe the reason is ..\Content.IE5\index.dat can't be deleted! -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of rtilley Sent: Thursday, November 10, 2005 11:03 AM To: python-list@python.org Subject: Re: IE Temporary Internet Files & Python Laszlo Zsolt N

exceptions, internals (introspection?)

2005-11-10 Thread ej
I'm trying to figure out how to get at some of the internal interpreter state for exception handlers and debug statements in general. I just read through Section 8 of the Python Tutorial. I see how to catch an exception, and specify an optional argument to get ahold of the exception itself. For ex

Re: wxPython newbie question, creating "mega widgets" , and DnD

2005-11-10 Thread Max Erickson
"[EMAIL PROTECTED]" <[EMAIL PROTECTED]> wrote in news:[EMAIL PROTECTED]: > A side question - why is their a EVT_LIST_BEGIN_DRAG but no > EVT_LIST_END_DRAG, unlike tree's which have BEGIN and END? I > need a draggable list box, and would prefer to not handle low > level mouse events. My intuitio

Re: exceptions, internals (introspection?)

2005-11-10 Thread Fredrik Lundh
"ej" <"ej atwellkeepercom"@bag.python.org> wrote > try: >{}['foo'] > except Exception, x: >print "class of x =", x.__class__ >print "type(x) =", type(x) >print "dir(x) =", dir(x) > >If you don't handle an exception, the interpreter will quit and print a > stack trace. What I'm

Re: exceptions, internals (introspection?)

2005-11-10 Thread Paul Rubin
"ej" writes: > I have often wondered how to get at other internals, such as the name of > the current function, file, line number I am in? The arguments to the > current function, etc. It's messy. Look at sys.exc_info() and go from there. -- http://mail.python.org/mailman/listinfo/python-

Re: append to non-existing list

2005-11-10 Thread Mike Meyer
Yves Glodt <[EMAIL PROTECTED]> writes: > Which raises another question... :-) > > Is there a possibility to bring together apache and python in a way > that I can embed python into html? Lots of ways. Most of them aren't really Python, but look a lot like it. PSP is most like PHP/ASP/etc., and I

Re: exceptions, internals (introspection?)

2005-11-10 Thread Paul McNett
ej wrote: > I have often wondered how to get at other internals, such as the name of > the current function, file, line number I am in? The arguments to the > current function, etc. Others have given you information on how to get at the stack trace. But regarding getting at some of the othe

Python music interfaces

2005-11-10 Thread James Harris
Hi, I am wanting to develop some software that a) Reads existing files of music of a few well known types b) Displays the music in traditional notation - i.e. on a stave c) Displays the same music in my own notation that I am playing with d) Allows both to be printed I guess I ca

Re: Addressing the last element of a list

2005-11-10 Thread Donn Cave
In article <[EMAIL PROTECTED]>, Mike Meyer <[EMAIL PROTECTED]> wrote: ... > Most OO languages do the name/variable thing, but some of the popular > ones aren't consistent about it, giving some types "special" status, > so that sometimes "a = b" causes b to be copied onto a, and sometimes > it caus

Recompile AST?

2005-11-10 Thread chrisspen
Is it possible to recompile the AST generated by compiler.parse, back into code or an executable code object? My aim here is to allow a script to manipulate Python code as elements within a list. However, it doesn't look like the module has any native methods designed to do this. Chris -- http:/

Re: Python obfuscation

2005-11-10 Thread Bill Mill
On 10 Nov 2005 08:40:17 -0800, Ben Sizer <[EMAIL PROTECTED]> wrote: > Alex Martelli wrote: > > > This is (a minor) one of the many reasons that make webservices the way > > of the future (hey, even *MSFT* noticed that recently, it seems...). > > But they are not suitable for all applications, and p

Re: how to modify code while debugging it without having to stop and then restart debugger

2005-11-10 Thread Mike Meyer
Magnus Lycka <[EMAIL PROTECTED]> writes: > Mike Meyer wrote: >> In that case, you're using the wrong IDE. I run the Python interpeter >> inside of Emacs. I edit my code in another buffer. In the source code >> buffer, I hit M-C-x, and the current version of the function I'm >> currently editing ge

Stopping Execution

2005-11-10 Thread James Colannino
Hey everyone. I remember from my C programming that I can either use the exit() or return() functions to end execution of the main code block. My question is, is there a way for me to do this in Python? I know there has to be, but I can't for the life of me figure out what it is. The reason

Re: Recompile AST?

2005-11-10 Thread François Pinard
[EMAIL PROTECTED] > Is it possible to recompile the AST generated by compiler.parse, back > into code or an executable code object? My aim here is to allow > a script to manipulate Python code as elements within a list. However, > it doesn't look like the module has any native methods designed

Re: Python obfuscation

2005-11-10 Thread Mike Meyer
"petantik" <[EMAIL PROTECTED]> writes: > Perhaps a comprehensive protection for interpreted languages can never > be built because of their high level nature? Nah. Compiling/interpreting is an implementation detail, and orthogonal to the issue of "high level". There are compilers for high level la

Re: [Tutor] triangulation

2005-11-10 Thread Shi Mu
On 11/10/05, Alex Hunsley <[EMAIL PROTECTED]> wrote: > Alan Gauld wrote: > > >>As in Pythagoras? > >> > >> > > > > > > > >>Or as in triangulation on a 2D surface, navigation etc.? > >> > >> > > > > > > > >>Or, do you mean radio triangulation by directional signal propagation > >> > >> > > > > > > >

different binding behavior

2005-11-10 Thread Gabriel Zachmann
It seems to me that the following behavior of python (2.4.1) is inconsistent: >>> a=1 >>> b=a >>> a+=1 >>> b 1 >>> a 2 >>> a=[1,2] >>> b=a >>> b+=[3] >>> a [1, 2, 3] >>> b [1, 2, 3] Why was it implemented like this?? Best regards, Gabriel. -- /

Re: Stopping Execution

2005-11-10 Thread Fredrik Lundh
James Colannino wrote: > Hey everyone. I remember from my C programming that I can either use > the exit() or return() functions to end execution of the main code > block. My question is, is there a way for me to do this in Python? I > know there has to be, but I can't for the life of me figure

Re: Addressing the last element of a list

2005-11-10 Thread Steven D'Aprano
On Thu, 10 Nov 2005 08:19:36 -0800, [EMAIL PROTECTED] wrote: > This mutable/immutable object and name/variable is confusing. It is a source of confusion to newbies, because it is a distinction that may not be intuitively obvious, and it is a programming model that isn't quite the same as many peo

Re: Stopping Execution

2005-11-10 Thread robert . dowell
import sys sys.exit -- http://mail.python.org/mailman/listinfo/python-list

Re: Python obfuscation

2005-11-10 Thread Timothy Smith
> Reliability is >important but so is protecting your code in an effective manner > > there is no way to prevent people disassembling your code compiled or otherwise. once you give then the program they can easily take it apart. no if's, no but's; do NOT rely on binary's for security. > >the

Re: Python obfuscation

2005-11-10 Thread Steven D'Aprano
On Thu, 10 Nov 2005 08:23:07 -0800, petantik wrote: > Perhaps a comprehensive protection for interpreted languages can never > be built because of their high level nature? Dude, a comprehension protection for *any* software can never be built because of the fundamental nature of computers. Trying

RE: [ x for x in xrange(10) when p(x) ]

2005-11-10 Thread Delaney, Timothy (Tim)
Colin J. Williams wrote: > Are there generally accepted guidelines on what is appropriate for the > builtin namespace? Yes. If Guido can be convinced it should be in builtins, it should be. Tim Delaney -- http://mail.python.org/mailman/listinfo/python-list

Re: [ x for x in xrange(10) when p(x) ]

2005-11-10 Thread Bengt Richter
On 10 Nov 2005 04:56:34 -0800, "[EMAIL PROTECTED]" <[EMAIL PROTECTED]> wrote: > >Peter Hansen wrote: >> (I say "readable or somehow better" since you stated in another post "I >> just try to use list/generator expression when possible" but you didn't >> explain your reason for doing so. I assume

Re: different binding behavior

2005-11-10 Thread David Wahler
Gabriel Zachmann wrote: > It seems to me that the following behavior of python (2.4.1) is inconsistent: [snip] > Why was it implemented like this?? Lists are mutable objects; integers are not. For a list, a += b is equivalent to a.__iadd__(b), which is an in-place modification. For an integer, no

Re: Python obfuscation

2005-11-10 Thread Mike Meyer
"Ben Sizer" <[EMAIL PROTECTED]> writes: > For example, I'd like to write a game in Python. I'd like to give the > game away free and charge for extra content. In C++ I can make it > difficult for users to share content with others who haven't paid for > it, with cryptographic hashes and the like. N

Re: Python obfuscation

2005-11-10 Thread Carsten Haese
On Thu, 2005-11-10 at 16:53, Steven D'Aprano wrote: > Dude, a comprehension protection for *any* software can never be built > because of the fundamental nature of computers. Trying to stop bytes from > being copyable is like trying to stop water from being wet, and once > copied, all copies are id

Re: Python music interfaces

2005-11-10 Thread Lonnie Princehouse
Are you talking about audio files (wav, mp3) or MIDI? Converting audio files into discrete notes ("music recognition") is seriously non-trivial, although there are some commercial products you might be able to use for this. On the other hand, you could draw a spectrographs without too much troub

Re: How to set program name in Python? ($0 in Perl)

2005-11-10 Thread Bengt Richter
On Thu, 10 Nov 2005 08:06:27 +0100, "Fredrik Lundh" <[EMAIL PROTECTED]> wrote: >Steve Holden wrote: > >> > Is there a way to set the program name in Python, similar to $0 in >> > Perl? >> > >> >>From `man perlvar`: >> > >> > $0 Contains the name of the program being executed. On some oper- >

Re: exceptions, internals (introspection?)

2005-11-10 Thread ej
"Paul Rubin" wrote in message news:[EMAIL PROTECTED] > It's messy. Look at sys.exc_info() and go from there. Yeah, I think I am starting to see what you mean... #! /usr/local/bin/python import sys try: {}['foo'] except Exception, x: print "class of x =", x._

Re: Stopping Execution

2005-11-10 Thread Fredrik Lundh
[EMAIL PROTECTED] wrote: > import sys > sys.exit $ more test.py import sys print "should get here" sys.exit print "should never get here" $ python test.py should get here should never get here -- http://mail.python.org/mailman/listinfo/python-list

Re: exceptions, internals (introspection?)

2005-11-10 Thread ej
"Fredrik Lundh" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > the second example on this page shows you how to do that: > > http://effbot.org/librarybook/traceback I am looking at it. Thanks for your prompt reply, Mr. Lundh! :) -ej -- http://mail.python.org/mailman/listinf

testing C code with python

2005-11-10 Thread Bilgehan . Balban
Hi, A simple question - Is it common/good practice to test C code using Python? For example one could wrap individual C functions, and test each of them using python, maybe not for low-level things but at least for algorithmic correctness. Anyone effectively doing this as common practice? Thanks,

Re: different binding behavior

2005-11-10 Thread Fredrik Lundh
Gabriel Zachmann wrote: > It seems to me that the following behavior of python (2.4.1) is > inconsistent: > > >>> a=1 > >>> b=a > >>> a+=1 > >>> b > 1 > >>> a > 2 > >>> a=[1,2] > >>> b=a > >>> b+=[3] > >>> a > [1, 2, 3] > >>> b > [1, 2, 3] > > Why was it implemented like this?? assuming

Re: different binding behavior

2005-11-10 Thread Steven D'Aprano
On Thu, 10 Nov 2005 22:43:53 +0100, Gabriel Zachmann wrote: > It seems to me that the following behavior of python (2.4.1) is inconsistent: We've just had a HUGE thread arguing about this behaviour, just three or five days ago. Let's not start it again. In a nutshell, the behaviour is because i

Re: exceptions, internals (introspection?)

2005-11-10 Thread Paul Rubin
"ej" writes: > for key in dir(traceback_): > print "traceback_.%s =" % key, eval("traceback_.%s" % key) Don't use eval for this. Use getattr(traceback_, key). > traceback_.tb_frame = > traceback_.tb_lasti = 18 > traceback_.tb_lineno = 6 > traceback_.tb_next = None Yeah. As /F men

Re: How to set program name in Python? ($0 in Perl)

2005-11-10 Thread Fredrik Lundh
Bengt Richter wrote: > >> > Is there a way to set the program name in Python, similar to $0 in > >> > Perl? > >> > > >> >>From `man perlvar`: > >> > > >> > $0 Contains the name of the program being executed. On some oper- > >> > ating systems assigning to "$0" modifies the argument area that

Re: different binding behavior

2005-11-10 Thread Paul Rubin
Steven D'Aprano <[EMAIL PROTECTED]> writes: > Imagine that ints could be changed in place. Then you could do this: > > x = 0 > x += 1 No nothing like that. Nothing stops you from having multiple int objects with the same value. Lists, for example, are mutable, but x = [0,1] x += [2,3] doe

CherryPy not playing nicely with win32com?

2005-11-10 Thread infidel
I've been trying to get my CherryPy server to authenticate users against our network. I've managed to cobble together a simple function that uses our LDAP server to validate the username and password entered by the user: # ldap.py from win32com.client import GetObject ADS_SECURE_AUTHENTICATION =

Re: Stopping Execution

2005-11-10 Thread James Colannino
Fredrik Lundh wrote: > the usual way: > >sys.exit() # or "raise SystemExit" >[...] > Ah, thank you. I wasn't aware that I'd have to import a module to have that ability. I'm still very new, so I have a lot to get used to :-P James -- My blog: http://www.crazydrclaw.com/ My homepage: htt

Re: Newb ??

2005-11-10 Thread Steven D'Aprano
On Thu, 10 Nov 2005 17:31:18 +, Steve Holden wrote: > Effectively you want to start with a minposs and maxposs, which are set > to 0 and 100 respectively. Your guess should bisect the range (as nearly > as it can given that you are dealing with integers, and you have to be > careful to get

Re: [Tutor] triangulation

2005-11-10 Thread Robert Kern
Shi Mu wrote: > the Internet is down for one day and so wonderful to have so many > responses. i have checked all the links you guys mentioned. what i > want is delaunay triangulation and the available ones online are > written in C, Java and FORTRAN. I want to see some in Python because > it is h

derived / base class name conflicts

2005-11-10 Thread christopherlmarshall
Suppose you want to write a subclass of some existing class you are importing from a module you didn't write and that you don't want to study the internals of, and you want to define a data member i in your constructor. As in the following: from module1 import A class B(A): def __init__(self)

Re: Newb ??

2005-11-10 Thread Fredrik Lundh
Steven D'Aprano wrote: > Dude, that's what my code does, although I admit I took zero care to get > the awkward boundary conditions right, nor did I put code in to stop the > game after five attempts. as my simulator shows, your code needs 5.87 attempts to make a correct guess, on average. if yo

Re: derived / base class name conflicts

2005-11-10 Thread Steve Juranich
This should prove most enlightening: import Tkinter dir(Tkinter.Canvas) On 10 Nov 2005 14:53:04 -0800, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote: > Suppose you want to write a subclass of some existing class you are > importing from a module you didn't write and that you don't want to > study

Re: derived / base class name conflicts

2005-11-10 Thread Fredrik Lundh
[EMAIL PROTECTED] wrote: > Now, 'i' might have already been defined by A or by the call to > A.__init__() so if you define it without knowing that, you could be > changing the behavior of A's methods in unknown ways, which is > obviously a bad thing. http://docs.python.org/tut/node11.html#SECTION

thread variable scope with start_new_thread

2005-11-10 Thread Luxore
Hello, I am trying to create threaded python project and I'm running into some weird Python variable scoping. I am using the "thread" module (I know, it's old and I should be using threading)... but for example: import thread def extract_archive(session, user, archive, dest=None): job_id =

Re: Recompile AST?

2005-11-10 Thread Bengt Richter
On 10 Nov 2005 13:21:56 -0800, [EMAIL PROTECTED] wrote: >Is it possible to recompile the AST generated by compiler.parse, back >into code or an executable code object? My aim here is to allow a >script to manipulate Python code as elements within a list. However, it >doesn't look like the module h

Re: thread variable scope with start_new_thread

2005-11-10 Thread Fredrik Lundh
"Luxore" <[EMAIL PROTECTED]> wrote: > I am trying to create threaded python project and I'm running into some > weird Python variable scoping. the "weird scoping" you're seeing has nothing to do with threads (read on) > I am using the "thread" module (I know, it's old and I should be using > thr

Re: Recompile AST?

2005-11-10 Thread Paul Boddie
Bengt Richter wrote: > I've also posted sporadic musings about the possibilities for AST-transforming > custom import functions to do optimizations and macros and special forms etc., > but no one seemed much interested (or maybe they quietly went off to do > something of their own ;-) For an examp

Re: Circe

2005-11-10 Thread nick125
Actually, Circe was being developed before the emacs circe was developed. -- http://mail.python.org/mailman/listinfo/python-list

Re: ANN: P(x) 0.2 applet builder

2005-11-10 Thread Steve Holden
Fredrik Lundh wrote: > Mike Meyer wrote: > > >>Since following standards is optional on the web, at least if things >>work in the most popular browser of the day, I probably should have >>seen this coming. > > > IE has no problems handling that link, if that's what you mean. > > judging from >

Re: Recompile AST?

2005-11-10 Thread Leif K-Brooks
[EMAIL PROTECTED] wrote: > Is it possible to recompile the AST generated by compiler.parse, back > into code or an executable code object? Into a bytecode object: >>> from compiler.pycodegen import ModuleCodeGenerator >>> from compiler.misc import set_filename >>> from compiler import parse >

SuSe 10.0 missing Idle

2005-11-10 Thread Steve
Hello, Hopefully this is not to of topic. I just installed SuSe 10.0 and although python installed but no Idle. I can't seem to find it in the list of available packages either. I was wondering if someone might steer me in the right direction. I've just started learning python and would

Command-line tool able to take multiple commands at one time?

2005-11-10 Thread Peter A.Schott
Per subject - I realize I can copy/paste a line at a time into an interactive session when I'm trying to debug, but was wondering if there is any tool out there that allows me to copy sections of working Python scripts to paste into my interactive console and let those run so I don't have to copy l

Re: CherryPy not playing nicely with win32com?

2005-11-10 Thread Irmen de Jong
infidel wrote: > I've been trying to get my CherryPy server to authenticate users > against our network. I've managed to cobble together a simple function > that uses our LDAP server to validate the username and password entered > by the user: [...] > moniker, i, bindCtx = pythoncom.MkParseD

Re: Stopping Execution

2005-11-10 Thread Steve Holden
Fredrik Lundh wrote: > [EMAIL PROTECTED] wrote: > > >>import sys >>sys.exit > > > $ more test.py > import sys > print "should get here" > sys.exit > print "should never get here" > > $ python test.py > should get here > should never get here > Which is Fredrik's way of telling you you need to

Re: Python obfuscation

2005-11-10 Thread Yu-Xi Lim
Bill Mill wrote: > Your only solution, then, is to write unpopular code. Because, as Alex > said, it will otherwise be broken into. Let's look at two very popular > pieces of code: Half-Life 2 and Windows XP. How are they secured? > Previous version of these software products used sophisticated > c

Re: Command-line tool able to take multiple commands at one time?

2005-11-10 Thread Devan L
Peter A. Schott wrote: > Per subject - I realize I can copy/paste a line at a time into an interactive > session when I'm trying to debug, but was wondering if there is any tool out > there that allows me to copy sections of working Python scripts to paste into > my > interactive console and let

Re: Stopping Execution

2005-11-10 Thread gblais
surely you mean sys.exit() Gerry -- http://mail.python.org/mailman/listinfo/python-list

Printing current time to a file

2005-11-10 Thread zolaris
I am trying to print the current system time to a file. I know only a little bit about Python. I have gotten the very simple: Print time.time() to work properly. From what I gather the line to print it to a file should look like: self.log.write(time.ctime(time.time())) But that prints nothin

Re: SuSe 10.0 missing Idle

2005-11-10 Thread Joseph Garvin
Steve wrote: >Hello, > >Hopefully this is not to of topic. I just installed SuSe 10.0 > and although python installed but no Idle. I can't seem to find it in >the list of available packages either. I was wondering if someone might >steer me in the right direction. I've just started learni

<    1   2   3   >