Re: Set an environment variable

2005-10-20 Thread Mike Meyer
"Eric Brunel" <[EMAIL PROTECTED]> writes: > -myScript.py-- > print 'export MY_VARIABLE=value' > -- > > -myScript.sh-- > python myScript.py > /tmp/chgvars.sh > . /tmp/chgvars.sh I

Re: Modules and Namespaces

2005-10-20 Thread jelle
Ooops, Larry, forgive me being to overhauled here: Actually self.RS = RS does not make the RS object available in the module, Steve's method does however. -Jelle -- http://mail.python.org/mailman/listinfo/python-list

Re: sort problem

2005-10-20 Thread Michele Petrazzo
Lasse Vågsæther Karlsen wrote: > How about: > > list.sort(key=lambda x: x[3]) > > Does that work? > Yes, on my linux-test-box it work, but I my developer pc I don't have the 2.4 yet. I think that this is a good reason for update :) Thanks, Michele -- http://mail.python.org/mailman/listinfo/py

Re: Microsoft Hatred FAQ

2005-10-20 Thread T Beck
Peter T. Breuer wrote: > In comp.os.linux.misc David Schwartz <[EMAIL PROTECTED]> wrote: > > > "Peter T. Breuer" <[EMAIL PROTECTED]> wrote in message > > news:[EMAIL PROTECTED] > > >> Not if they abuse a monopoly position in doing so, which is where we > >> started. [snip] > O/ses on PC platforms,

Re: best way to replace first word in string?

2005-10-20 Thread Micah Elliott
On Oct 20, [EMAIL PROTECTED] wrote: > I am looking for the best and efficient way to replace the first word > in a str, like this: > "aa to become" -> "/aa/ to become" > I know I can use spilt and than join them > but I can also use regular expressions > and I sure there is a lot ways, but I need r

Re: __getattr__, __setattr__

2005-10-20 Thread Thomas Heller
"[EMAIL PROTECTED]" <[EMAIL PROTECTED]> writes: > for new style classes __getattribute__ is defined, see eg. > http://www.python.org/2.2.3/descrintro.html Steve Holden <[EMAIL PROTECTED]> writes: > >>> object.__getattribute__ > > > Ring any bells? Yes, of course. Thanks ;-) Thomas -- http

Re: best way to replace first word in string?

2005-10-20 Thread Mike Meyer
"[EMAIL PROTECTED]" <[EMAIL PROTECTED]> writes: > I am looking for the best and efficient way to replace the first word > in a str, like this: > "aa to become" -> "/aa/ to become" > I know I can use spilt and than join them > but I can also use regular expressions > and I sure there is a lot ways,

Re: need some advice on x y plot

2005-10-20 Thread nephish
i have thought about doing this, just a little different. i was going to list the value pairs. take the start time and end time and plot 100 empty plots between them. add the value pairs, sort by time, and then draw it. The only thing is it get kinda complicated when the times change a lot. they co

Re: Searching for txt file and importing to ms access

2005-10-20 Thread Mike Meyer
"Mark Line" <[EMAIL PROTECTED]> writes: > I'm managed to get some code to download a message from the email account > and save it to a text file, does any one have a link to some sample code to > search though a file until a string of characters is matched? Or could > point me to some functions

Cursor Location

2005-10-20 Thread Samantha
Is there any code that would allow a person to click a location on the screen and have that location saved for a future use? For example to imbed a watermark on an image or text, etc. S -- http://mail.python.org/mailman/listinfo/python-list

Re: How to extract a part of html file

2005-10-20 Thread Joe
Thanks Mike that is just what I was looking for, I have looked at beautifulsoup but it doesn't really do what I want it to do, maybe I'm just new to python and don't exactly know what it is doing just yet. However string find woks. Thanks On Thu, 20 Oct 2005 09:47:37 -0400, Mike Meyer wrote: > Be

Re: need some advice on x y plot

2005-10-20 Thread Grant Edwards
On 2005-10-20, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote: > i have tried to use unix timestamps, That has always worked for me. What happened? > and i have also tried with DateTime objects Never tried that. > do i need to use a scale that isn't linear (default in most) ? No. > how do i pu

Re: need some advice on x y plot

2005-10-20 Thread Grant Edwards
On 2005-10-20, Larry Bates <[EMAIL PROTECTED]> wrote: > I would try to live with time scale being fixed I don't understand what you mean by "the time scale being fixed". It's not. If you just pass the time,value pairs to gnuplot, it does exactly what it should. > and insert > None (or whatever

Re: Would there be support for a more general cmp/__cmp__

2005-10-20 Thread Tim Peters
[Toby Dickenson] > ... > ZODB's BTrees work in a similar way but use the regular python comparison > function, and the lack of a guarantee of a total ordering can be a liability. > Described here in 2002, but I think same is true today: > http://mail.zope.org/pipermail/zodb-dev/2002-February/002304

Re: need some advice on x y plot

2005-10-20 Thread Grant Edwards
On 2005-10-20, Grant Edwards <[EMAIL PROTECTED]> wrote: >> and insert None (or whatever value is used by charting >> package) for times where observations were not taken. This >> will mean that you have to preprocess your data by determining >> a time step step value that will fit your data. If

Re: best way to replace first word in string?

2005-10-20 Thread Fredrik Lundh
Micah Elliott wrote: > And the regex is comparatively slow, though I'm not confident this one > is optimally written: > > $ python -mtimeit -s'import re' ' > re.sub(r"^(\w*)", r"/\1/", "a b c")' > 1 loops, best of 3: 44.1 usec per loop the above has to look the pattern up in the

Re: need some advice on x y plot

2005-10-20 Thread Kent Johnson
[EMAIL PROTECTED] wrote: > how ? > i have tried to use unix timestamps, and i have also tried with > DateTime objects > do i need to use a scale that isn't linear (default in most) ? > how do i putt this off ? Here is some code that works for me. It plots multiple datasets against time. The input

Re: Microsoft Hatred FAQ

2005-10-20 Thread Peter T. Breuer
In comp.os.linux.misc T Beck <[EMAIL PROTECTED]> wrote: > Peter T. Breuer wrote: >> In comp.os.linux.misc David Schwartz <[EMAIL PROTECTED]> wrote: >> >> > "Peter T. Breuer" <[EMAIL PROTECTED]> wrote in message >> > news:[EMAIL PROTECTED] >> >> >> Not if they abuse a monopoly position in doing so,

Re: need some advice on x y plot

2005-10-20 Thread nephish
ok, yeah, thats exactly what i am looking for. i will give it a go. thanks a whole lot. putt this off is a typo, pull this off is what i was meaning to type. this is cool. -- http://mail.python.org/mailman/listinfo/python-list

Re: sort problem

2005-10-20 Thread Kent Johnson
Michele Petrazzo wrote: > Lasse Vågsæther Karlsen wrote: > >> How about: >> >> list.sort(key=lambda x: x[3]) Better to use key=operator.itemgetter(3) > Yes, on my linux-test-box it work, but I my developer pc I don't have > the 2.4 yet. I think that this is a good reason for update :) or learn

A macro editor

2005-10-20 Thread jau
Hello mates. I'm part of a big project's developer team. We are writting an application in Java and we are planning to add scripting functionality to it. What we exactly are planning is to give a kind of tool that would allow our users to write their own scripts to perform their special operat

Question on re.IGNORECASE

2005-10-20 Thread chemag
Hi, I'm having some problems with basic RE in python. I was wondering whether somebody could provide a hint on what's going wrong with the following script. Comments are included. TIA. -myself > python2.3 Python 2.3.4 (#1, Nov 18 2004, 13:39:30) [GCC 3.2.3 20030502 (Red Hat Linux 3.2.3-39)] on l

bypassing web forms hardcoding login and password

2005-10-20 Thread cgian31
I need to hide the complexity from users to access an information webpage, which is normally accessible after filling in a web form with the correct data. The address of the information webpage is like https://external.address.com/info.asp? where is a number generated by the server. This number

Re: A macro editor

2005-10-20 Thread Diez B. Roggisch
> My teammates and I were talking about to use one of Python, Ruby or > Groovy. But, we haven't decided which to use. > > What seems to be easier is to use Python, you know.. because of the > Jython thing. But, it is probably a mistake to take Jython without a > extensive analysis of the all po

Re: Question on re.IGNORECASE

2005-10-20 Thread Kent Johnson
[EMAIL PROTECTED] wrote: > Hi, > > I'm having some problems with basic RE in python. I was wondering > whether > somebody could provide a hint on what's going wrong with the following > script. Comments are included. > > TIA. > -myself > > >>python2.3 > > Python 2.3.4 (#1, Nov 18 2004, 13:39:3

Re: Question on re.IGNORECASE

2005-10-20 Thread chemag
OK, I got it. - The re module search function syntax is: search( pattern, string[, flags]) where re.IGNORECASE is a valid flag. - The RE Object search method syntax is: search( string[, pos[, endpos]]) where "The optional second parameter pos gives an index in the string where

Re: Question on re.IGNORECASE

2005-10-20 Thread chemag
Thanks for your help. -myself -- http://mail.python.org/mailman/listinfo/python-list

classmethods, class variables and subclassing

2005-10-20 Thread Andrew Jaffe
Hi, I have a class with various class-level variables which are used to store global state information for all instances of a class. These are set by a classmethod as in the following (in reality the setcvar method is more complicated than this!): class sup(object): cvar1 = None cvar

Fund raising for SPE (Python IDE) on Mac Os X is great success!!

2005-10-20 Thread SPE - Stani's Python Editor
Hi, I'd like to thank everyone who contributed, especially Richard Brown from Dartware and Rick Thomas. I'm highly impressed that the smallest user base of SPE collected the largest donation ever to SPE. Now it's my turn to impress the SPE Mac users. As such the light is green for SPE on the Mac.

Re: sqlstring -- a library to build a SELECT statement

2005-10-20 Thread Pierre Quentel
[EMAIL PROTECTED] a écrit : > > > My solution is sqlstring. A single-purpose library: to create SQL > statement objects. These objects (such as sqlstring.Select), represent > complex SQL Statements, but as Python objects. The benefit is that you > can, at run-time, "build" the statement pythonica

Re: best way to replace first word in string?

2005-10-20 Thread Hagai Cohen
Realy Thanks, I will try this Hagai -- http://mail.python.org/mailman/listinfo/python-list

Re: Popularity of blogging tools used by python programmers

2005-10-20 Thread Bruno Desthuilliers
Stewart Midwinter a écrit : > I've made a comparison of the relative popularity of blogging tools > used by python programmers. I was surprised by the number of python > developers not using python for their blogs; isn't that like GM > employees driving Toyota cars? > > See my post at: > > http:

Re: Python vs Ruby

2005-10-20 Thread Amol Vaidya
Thank you for all the great information and links! I think I will do what a lot of you reccomended and try both for myself, the only problem is finding time with homework, college applications, and SATs coming up. I'll let you know how it turns out. Again, thank you all for the help. -- http

Re: Microsoft Hatred FAQ

2005-10-20 Thread Tim Slattery
"Peter T. Breuer" <[EMAIL PROTECTED]> wrote: >No - they got the deal with IBM when they were a garage startup. Not quite a garage startup. They had initial success in Albuquerque, NM, writing a Basic interpreter for the MITS Altair machine. By the time IBM came to them, they had moved to Seattle

create user message for wxPython

2005-10-20 Thread James Hu
Hi, There are 2 wxPython application, A and B and need to exchange msg. Sending WM_CLOSE, wxEVT_MOUSEWHEEL to B is OK, and sending user message like 1225 from A to B is also OK. But B didn't catch this message, note, B is running before A sends msg and can receive "WM_CLOSE". Do I have to make

Re: Python Doc Error: os.makedirs

2005-10-20 Thread Xah Lee
Thomas Bellman wrote: >try: > os.makedirs("/tmp/trh/spam/norwegian/blue/parrot/cheese") >except os.error, e: > if e.errno != errno.EEXIST: > raise This is what i want. Thanks. (the doc needs quite some improvement...) Xah [EMAIL PROTECTED] ∑ http://xahlee.org/ -

First Person View with Python

2005-10-20 Thread quietwarlock
Hey, For a bit, I've been trying to create a first person view in Python, currently using the Soya engine. And while I can make the camera, and where I want it, how do I link it to controls? So that I can use WASD, etc. to move the camera? -- http://mail.python.org/mailman/listinfo/python-list

Re: Python vs Ruby

2005-10-20 Thread Amol Vaidya
"Casey Hawthorne" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > What languages do you know already? > > What computer science concepts do you know? > > What computer programming concepts do you know? > > > Have you heard of Scheme? > > > Ruby is a bit Perl like -- so if you like P

get a copy of a string leaving original intact

2005-10-20 Thread Bell, Kevin
I'm having trouble with something that seems like it should be simple. I need to copy a file, say "abc-1.tif" to another directory, but if it's in there already, I need to transfer it named "abc-2.tif" but I'm going about it all wrong. Here's what doesn't work: (I'll add the copy stuff from shuti

Re: get a copy of a string leaving original intact

2005-10-20 Thread Christoph Haas
On Thursday 20 October 2005 22:43, Bell, Kevin wrote: > I need to copy a file, say "abc-1.tif" to another directory, but if it's > in there already, I need to transfer it named "abc-2.tif" but I'm going > about it all wrong. What a coincidence... I stepped about this today: http://aspn.activestat

Re: Popularity of blogging tools used by python programmers

2005-10-20 Thread SPE - Stani's Python Editor
Well, Python, Zope & Plone hosting are quite popular. However python based blog software isn't as sexy as let's say blogger. For SPE I first used a combination of PyDS&pycs.net. It is free for everyone, but unfortunately not stable enough to my standards. Luckily I got sponsored by zettai.net, wh

Re: nested escape chars in a shell command

2005-10-20 Thread Eli Criffield
I can't seem to get that to work either. child = pexpect.spawn('/bin/sh',args=['-c','/usr/bin/ssh','-t','-o','StrictHostKeyChecking no',host,command,'|','awk','{print %s:$0}'%host], timeout=30) Complains its getting the wrong arguments to ssh. Eli -- http://mail.python.org/mailman/listinfo/pyt

Set operations for lists: pythonic hints please!

2005-10-20 Thread jmdeschamps
Working with several thousand tagged items on a Tkinter Canvas, I want to change different configurations of objects having a certain group of tags. I've used the sets module, on the tuple returned by Tkinter.Canvas. find_withtag() method. Since this method takes only one tag at time, I use it fo

Re: Microsoft Hatred FAQ

2005-10-20 Thread Alan Connor
On comp.os.linux.misc, in <[EMAIL PROTECTED]>, "Tim Slattery" wrote: Three OS's from corporate kings in their towers of glass, Seven from valley lords where orchards used to grow, Nine from dotcoms doomed to die, One from the Dark Lord Gates on his dark throne In the Land of Redmond where the

Re: Set operations for lists: pythonic hints please!

2005-10-20 Thread jmdeschamps
Ouppsss! the title should have read:Set operation for tuples... (sigh!) -- http://mail.python.org/mailman/listinfo/python-list

newbie question about SocketServer

2005-10-20 Thread [EMAIL PROTECTED]
Is it just me or do the server_close() methods do squat? I'm primarily working with a ThreadingTCPServer object and trying to create a simple server that can shut itself down. But even simplest cases don't seem to work. Admittedly I am trying it from within my handler class, but for some odd rea

Re: classmethods, class variables and subclassing

2005-10-20 Thread Steve Holden
Andrew Jaffe wrote: > Hi, > > I have a class with various class-level variables which are used to > store global state information for all instances of a class. These are > set by a classmethod as in the following (in reality the setcvar method > is more complicated than this!): > > class sup(

Re: sqlstring -- a library to build a SELECT statement

2005-10-20 Thread Tom Anderson
On Thu, 20 Oct 2005, [EMAIL PROTECTED] wrote: > On this line of thought, what about the += operator? That might be more > intuative than //. I could even use -= for not in. You're going to have to explain to me how using an assignment operator for something other than assignment is intuitive!

Re: sqlstring -- a library to build a SELECT statement

2005-10-20 Thread Tom Anderson
On Thu, 20 Oct 2005, Pierre Quentel wrote: [EMAIL PROTECTED] a écrit : My solution is sqlstring. A single-purpose library: to create SQL statement objects. With the same starting point - I don't like writing SQL strings inside Python code either - I have tested a different approach : use th

Re: A macro editor

2005-10-20 Thread Tom Anderson
On Thu, 20 Oct 2005, Diez B. Roggisch wrote: > So - _I_ think the better user-experience comes froma well-working easy > to use REPL to quickly give the scripts a try. I'd agree with that. Which is better, a difficult language with lots of fancy tools to help you write it, or an easy language?

network installations

2005-10-20 Thread Shawn Kelley
Hi All - I am working on a project that requires Python be installed on multiple Windows servers. I was wondering if anyone knew of a method/utility/script that can push the installation of Python to multiple networked servers from a centralized location. Thanks in advance! -shawn begin:vc

Execute C code through Python

2005-10-20 Thread Ernesto
What's the easiest and quickest way to execute a compiled C "command line interface" program THROUGH Python? -- http://mail.python.org/mailman/listinfo/python-list

Re: Set operations for lists: pythonic hints please!

2005-10-20 Thread Diez B. Roggisch
[EMAIL PROTECTED] wrote: > Working with several thousand tagged items on a Tkinter Canvas, I want > to change different configurations of objects having a certain group of > tags. > > I've used the sets module, on the tuple returned by Tkinter.Canvas. > find_withtag() method. > > Since this metho

Re: Execute C code through Python

2005-10-20 Thread Diez B. Roggisch
Ernesto wrote: > What's the easiest and quickest way to execute a compiled C "command > line interface" program THROUGH Python? I don't know what you mean by THROUGH. But the subprocess, popen2 and os-modules deal with calling other programs. Try them in that order. Diez -- http://mail.python.o

Re: Popularity of blogging tools used by python programmers

2005-10-20 Thread UrsusMaximus
You might also consider Firedrop2, (see http://www.voidspace.org.uk/python/weblog/arch_d7_2005_10_15.shtml#e119 ) , a client side blog creation and content management system created by Hans Nowak and now being enhnaced and maintained by Michael Foord. Its very pythonic and extensable. Ron Stephens

Re: Microsoft Hatred FAQ

2005-10-20 Thread Mike Schilling
"Steven D'Aprano" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > On Thu, 20 Oct 2005 13:17:14 +, axel wrote: > >> Employees have *no* obligations towards the shareholders of a company. >> They are not employed or paid by the shareholders, they are employed >> by the company its

Re: ANN: Beginning Python (Practical Python 2.0)

2005-10-20 Thread UrsusMaximus
I found this book at my local Border's this week. It appears to be a most excellent book. I own and have read Magnus' earlier book "Pactical Python" (which was excellent) but this one is even better. The first half of the book covers the language, and then the second half goes into depth developing

Re: KeyboardInterrupt vs extension written in C

2005-10-20 Thread Diez B. Roggisch
Tamas Nepusz wrote: > Hi everyone, > > I have tried to do some googling before asking my question here, but I > haven't found any suitable answer. I am developing a Python API for a > graph library written in pure C. The library is doing an awful lot of > math computations, and some of them can ta

Re: Python vs Ruby

2005-10-20 Thread Tom Anderson
On Thu, 20 Oct 2005, Amol Vaidya wrote: > "Casey Hawthorne" <[EMAIL PROTECTED]> wrote in message > news:[EMAIL PROTECTED] > >> What languages do you know already? What computer science concepts do >> you know? What computer programming concepts do you know? Have you >> heard of Scheme? Good que

Re: KeyboardInterrupt vs extension written in C

2005-10-20 Thread Tamas Nepusz
No, that's actually a bit more complicated. The library I'm working on is designed for performing calculations on large-scale graphs (~1 nodes and edges). I want to create a Python interface for that library, so what I want to accomplish is that I could just type "from igraph import *" in a Pyt

http/urlib pos/get question (newbie)

2005-10-20 Thread Philippe C. Martin
Hi, (I am _very_ new to web programming) I am writing a client module (browser plugin) and server module (Python CGI) that need to exchange information. I want the transaction to be intiated when the client accesses the link. I need data to go back and forth between the client and the server (c

Re: Fund raising for SPE (Python IDE) on Mac Os X is great success!!

2005-10-20 Thread dimitri pater
Dear Stani, It is good to hear that the donation was a success. And you deserve it, your contribution to the Python community is an example fot others and I am convinced that every donation, be it large or small, is well spent! A lot of us use SPE, don't we? greetz, DimitriOn 20 Oct 2005 12:38:04

reload fails if module not in sys.path

2005-10-20 Thread Lonnie Princehouse
So, it turns out that reload() fails if the module being reloaded isn't in sys.path. Maybe it could fall back to module.__file__ if the module isn't found in sys.path?? ... or reload could just take an optional path parameter... Or perhaps I'm the only one who thinks this is silly: >>> my_module

Re: sqlstring -- a library to build a SELECT statement

2005-10-20 Thread [EMAIL PROTECTED]
Tom Anderson wrote: > On Thu, 20 Oct 2005, [EMAIL PROTECTED] wrote: > > > On this line of thought, what about the += operator? That might be more > > intuative than //. I could even use -= for not in. > > You're going to have to explain to me how using an assignment operator for > something othe

Re: sqlstring -- a library to build a SELECT statement

2005-10-20 Thread [EMAIL PROTECTED]
> person ** ( > (person.type_id == 'customer') > & (person.id %= phone(phone.person_id))) > ) > Nevermind. This doesn't work because all of the X= operators in question are assignment operators, and therefore generate a Syntax Error if in a nested expression. I think I've settled on just doin

Re: reload fails if module not in sys.path

2005-10-20 Thread Steve Holden
Lonnie Princehouse wrote: > So, it turns out that reload() fails if the module being reloaded isn't > in sys.path. > > Maybe it could fall back to module.__file__ if the module isn't found > in sys.path?? > ... or reload could just take an optional path parameter... > > Or perhaps I'm the only on

Re: Python vs Ruby

2005-10-20 Thread [EMAIL PROTECTED]
I don't think you really need to give to much time in weighting between python or Ruby. Both are fine. But Python has the obvious advantage that it has much more modules than Ruby so many things you don't need to implement if you have real work to do. I recommend you give haskell a shot if you are

Re: nested escape chars in a shell command

2005-10-20 Thread jepler
I think you're mistaken about how 'sh -c' works. The next argument after "-c" is the script, and following arguments are the positional arguments. (what, you've never used -c in conjunction with positional arguments? me either!) Example: -

os.makedirs should not succeed when the directory already exists (was Re: Python Doc Error: os.makedirs)

2005-10-20 Thread jepler
On Wed, Oct 19, 2005 at 09:26:16AM -0700, Dr. Who wrote: > The fact that the directory already exists is irrelevant to the function...it > still failed to create the directory. That's not true. Imagine that os.makedirs() is used inside tempfile.mkdtemp() (I looked, and it isn't) and the proposed

DBM scalability

2005-10-20 Thread George Sakkis
I'm trying to create a dbm database with around 4.5 million entries but the existing dbm modules (dbhash, gdbm) don't seem to cut it. What happens is that the more entries are added, the more time per new entry is required, so the complexity seems to be much worse than linear. Is this to be expe

Re: Microsoft Hatred FAQ

2005-10-20 Thread David Schwartz
"Mike Schilling" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > An employee who refuses to act as directed, claiming that he's thinking of > the shareholders' interests, can be fired for cause. His only recourse > would be to become a shareholder (not hard), and then get the at

TK question

2005-10-20 Thread MBW
I have a class that is a windows in a GUI the following is the code: class optWin: def __init__(self): return None def __call__(self): self.root = tk() self.root.title("My title") self.root.mainloop() return None 1)Why doesn't this work when I go

Re: Python vs Ruby

2005-10-20 Thread Mike Meyer
"[EMAIL PROTECTED]" <[EMAIL PROTECTED]> writes: > I am not sure your intention but I think there isn't a one language > fits all situation here. Very true. > C/C++ - for linux kernel hacking etc., many library out there still use > it > python - generic stuff > SQL - nothing beats it for many bus

Re: Execute C code through Python

2005-10-20 Thread gsteff
import subprocess subprocess.call("cmd") -- http://mail.python.org/mailman/listinfo/python-list

Re: TK question

2005-10-20 Thread James Stroud
optWin() will create a callable object which is an instance of the class optWin. Calling this callable object will call the __call__() method with the behavior you anticipate. You also need to import Tk from Tkinter and call Tk "Tk" and not "tk". Meditate on the following : from Tkinter impor

Re: TK question

2005-10-20 Thread James Stroud
Forgot to answer the "better" part: class optFrame(Frame): def __init__(self, *args, **kwargs): Frame.__init__(self, *args, **kwargs) self.pack() self.make_widgets() def make_widgets(self): """ Put widgets here. """ pass def main(): tk = Tk() opt

fun with lambdas

2005-10-20 Thread Juan Pablo Romero
Hello! given the definition def f(a,b): return a+b With this code: fs = [ lambda x: f(x,o) for o in [0,1,2]] or this fs = [] for o in [0,1,2]: fs.append( lambda x: f(x,o) ) I'd expect that fs contains partial evaluated functions, i.e. fs[0](0) == 0 fs[1](0) == 1 fs[2](0) == 2 But this

Re: fun with lambdas

2005-10-20 Thread Robert Kern
Juan Pablo Romero wrote: > Hello! > > given the definition > > def f(a,b): return a+b > > With this code: > > fs = [ lambda x: f(x,o) for o in [0,1,2]] > > or this > > fs = [] > for o in [0,1,2]: > fs.append( lambda x: f(x,o) ) > > I'd expect that fs contains partial evaluated functions,

Re: fun with lambdas

2005-10-20 Thread [EMAIL PROTECTED]
You are asking it to return a list of lambda, not its evaluated value. map(lambda x: f(x,0), [0,1,2]) works. [ f(o) for o in [0,1,2] ] works too. Juan Pablo Romero wrote: > Hello! > > given the definition > > def f(a,b): return a+b > > With this code: > > fs = [ lambda x: f(x,o) for o in [0,1,

Re: fun with lambdas

2005-10-20 Thread Mike Meyer
Robert Kern <[EMAIL PROTECTED]> writes: > Juan Pablo Romero wrote: >> Hello! >> >> given the definition >> >> def f(a,b): return a+b >> >> With this code: >> >> fs = [ lambda x: f(x,o) for o in [0,1,2]] >> >> or this >> >> fs = [] >> for o in [0,1,2]: >> fs.append( lambda x: f(x,o) ) >>

Re: TK question

2005-10-20 Thread MBW
thank you very much, I have one more question that is tk related, I've use tkfileopendialog or whatever that name is to select files is there also a dialog for creating files, well not really creating them but allowing the same look and feel as many porgrams give for saving files? is there also

Re: KeyboardInterrupt vs extension written in C

2005-10-20 Thread Donn Cave
Quoth "Tamas Nepusz" <[EMAIL PROTECTED]>: | No, that's actually a bit more complicated. The library I'm working on | is designed for performing calculations on large-scale graphs (~1 | nodes and edges). I want to create a Python interface for that library, | so what I want to accomplish is that

Re: Expat - how to UseForeignDTD

2005-10-20 Thread B Mahoney
I needed to set Entity Parsing, such as parser.SetParamEntityParsing( expat.XML_PARAM_ENTITY_PARSING_ALWAYS ) -- http://mail.python.org/mailman/listinfo/python-list

Re: connect to https unpossible. Please help.

2005-10-20 Thread Tim Roberts
"Mark Delon" <[EMAIL PROTECTED]> wrote: > >i want to log via python script to https page: > >'https://brokerjet.ecetra.com/at/' ># >But it does not work. > >I am using following code(see below) > >Has somebody any ideas? >How can I get to this https page? >Need I to know some infos from "provider"(

Re: Sequence and/or pattern matching

2005-10-20 Thread Séb
Sorry for the confusion, I think my example was unclear. Thank you Mike for this piece of code who solves a part of my problem. In fact, the sequences are unknown at the beginning, so the first part of the code has to find possible sequences and if those sequences are repeated, counts how many time

Re: sqlstring -- a library to build a SELECT statement

2005-10-20 Thread Tim Roberts
"[EMAIL PROTECTED]" <[EMAIL PROTECTED]> wrote: > >An Example: > import sqlstring model = sqlstring.TableFactory() print model.person >SELECT >person.* >FROM >[person] person The [bracket] syntax is unique to Microsoft. Everyone else, including Microsoft SQL Server, uses "double quo

Re: Accessing a dll from Python

2005-10-20 Thread Tim Roberts
"dcrespo" <[EMAIL PROTECTED]> wrote: > >Can someone give me lights on how can I deal with dlls from python? > >My main purpose is to get access to a Unitech PT600 Bar Code system. I >have the dll that works fine through Visual Basic. But I'm migrating to >Python, so I need a way to use the same dll

RE: sqlstring -- a library to build a SELECT statement

2005-10-20 Thread Robert Brewer
Title: RE: sqlstring -- a library to build a SELECT statement Tim Roberts wrote: "[EMAIL PROTECTED]" <[EMAIL PROTECTED]> wrote: > > > >An Example: > > > import sqlstring > model = sqlstring.TableFactory() > print model.person > >SELECT > >person.* > >FROM > >[person] person > >

Re: Cursor Location

2005-10-20 Thread Tim Roberts
"Samantha" <[EMAIL PROTECTED]> wrote: > >Is there any code that would allow a person to click a location on the >screen and have that location saved for a future use? For example to imbed a >watermark on an image or text, etc. Getting the point is easy. If you are using wxPython, your EVT_LEFT_

Re: Question on class member in python

2005-10-20 Thread Johnny Lee
It looks like there isn't a last word of the differrences -- http://mail.python.org/mailman/listinfo/python-list

a simple question about the third index in slice

2005-10-20 Thread 700MHz
I cannot quite understand when the third index is a negative number,like this: a = '0123456789' a[1:10:2] I know the index step is 2, so it will collect items from offset 1, 3, 5, 7, 9 but when a negative number come,like: a[1::-1] answer '10', and a[1:10:-1] only answer '', what is the different b

Re: reload fails if module not in sys.path

2005-10-20 Thread Fredrik Lundh
Lonnie Princehouse wrote: > Maybe it could fall back to module.__file__ if the module isn't found > in sys.path?? > ... or reload could just take an optional path parameter... > > Or perhaps I'm the only one who thinks this is silly: > > >>> my_module = imp.load_module(module_name, > >>> *imp.fin

Re: classmethods, class variables and subclassing

2005-10-20 Thread Andrew Jaffe
> Andrew Jaffe wrote: > >> Hi, >> >> I have a class with various class-level variables which are used to >> store global state information for all instances of a class. These are >> set by a classmethod as in the following >> >> class sup(object): >> cvar1 = None >> cvar2 = None >> >>

Re: a simple question about the third index in slice

2005-10-20 Thread Fredrik Lundh
someone wrote: > I cannot quite understand when the third index is a negative > number,like this: > a = '0123456789' > a[1:10:2] I know the index step is 2, so it will collect items from > offset 1, 3, 5, 7, 9 > but when a negative number come,like: > a[1::-1] answer '10', and a[1:10:-1] only answ

<    1   2