Re: Life-time of temporary variables in list comprehensions

2007-10-23 Thread beginner
On Oct 23, 12:02 pm, beginner <[EMAIL PROTECTED]> wrote: > Hi All, > > If I have a list comprehension: > > ab=["A","B"] > c = "ABC" > [1.0 if c=='A' else c='B' for c in ab] > print c > > >>"B" > > My test shows that if c is not defined before the list comprehension, > it will be created in the list

strange transliteration in win32com.client

2007-10-23 Thread Mark Morss
Is this the place to ask a win32com.client question? I am a unix person trying to run on windows, so I have little familiarity with this module. I have this code: import win32com.client """An Access connection""" def connect(data_source, user, pwd, mdw): connAccess = win32com.client.Dispat

Re: Automatic Generation of Python Class Files

2007-10-23 Thread Steven Bethard
Bruno Desthuilliers wrote: >> I guess as long as your documentation is clear about which attributes >> require computation and which don't... > > Why should it ? FWIW, I mentionned that I would obviously not use > properties for values requiring heavy, non cachable computation. This > set aside

Re: Python tickets summary

2007-10-23 Thread Facundo Batista
2007/9/13, Facundo Batista <[EMAIL PROTECTED]>: > All the listings are accesible from the same pages, start here: > > http://www.taniquetil.com.ar/facundo/py_tickets.html > > (remember to refresh) > > Any idea to improve these pages is welcomed. Following an idea of John Lenton, now every page

Re: Speed of Nested Functions & Lambda Expressions

2007-10-23 Thread beginner
On Oct 23, 11:06 am, Gary Herron <[EMAIL PROTECTED]> wrote: > beginner wrote: > > Hi All, > > > It is really convenient to use nested functions and lambda > > expressions. What I'd like to know is if Python compiles fn_inner() > > only once and change the binding of v every time fn_outer() is calle

Katrina of FIRE -1/4 Million Californians homeless by fires, this is what happens when you ship all the manpower to Iraq to steal their oil

2007-10-23 Thread lemnitzer
This is Katrina by the bush bastards in Khaalifornia. I am laughing at the two instances of K, anyone with clue ? dry and wry and vile bushes on fire. Bushes have gone mad with oil. The fact is that for a long time, the yanks in the RED states were very jealous of Khalifornia and its wealth. T

How to find out which functions exist?

2007-10-23 Thread mrstephengross
Let's say I have a python file with a base class, and a few derived classes: class Base: pass class Derived1(Base): pass class Derived2(Base): pass Is there a way I can find out the classes that have been derived from Base? Thanks, --Steve -- http://mail.python.org/mailman/listinfo/pyt

Re: Anagrams

2007-10-23 Thread [EMAIL PROTECTED]
On Oct 23, 3:21 am, [EMAIL PROTECTED] wrote: > This was from a random website I found on practising good programming > techniques and I thought I'd see what ways people could find to write > out this example. Below are my two examples (which should work...). > > I am merely interested in other tech

Re: Set operations on object attributes question

2007-10-23 Thread Raymond Hettinger
[Duane] > Since what I _really_ wanted from this was the intersection of the > objects (based on attribute 2), I was looking for a set-based > solution, > kinda like a decorate - - undecorate pattern. Perhaps > the problem does not fall into that category. Decorating and undecorating do not apply

Re: How to find out which functions exist?

2007-10-23 Thread Marc 'BlackJack' Rintsch
On Tue, 23 Oct 2007 21:10:04 +, mrstephengross wrote: > Let's say I have a python file with a base class, and a few derived > classes: > > class Base: > pass > > class Derived1(Base): > pass > > class Derived2(Base): > pass > > Is there a way I can find out the classes that have been

Re: Root element name not declared

2007-10-23 Thread Martin v. Löwis
> > > > [...] > > , [...] > Being both the file and the dtd provided by the supplier, I believe > they're correct so I don't understand what's wrong. MyMessage IS > declared... isn't it sufficient? No. MyMessage is declared above as a Parameter Entity (PE), not as an element. Look for defi

Re: Python on Intel A110?

2007-10-23 Thread Martin v. Löwis
> Will the "stock" Windows version of Python install on a Samsung Q1U-EL > UMPC running Vista and with an Intel A110 processor? Certainly. This is an Pentium M class processor; the Python binaries will run on any Pentium-or-better processor (probably actually 486-or-better). Regards, Martin --

Lists and Sublists

2007-10-23 Thread dineshv
We have a list of N (>2,000) keywords (of datatype string). Each of the N keywords has associated with it a list of names of varying numbers. For example, keyword(1) will have a list of L1 names associated with it, keyword(2) will have a list of L2 names associated with it and so on with L1 not e

Re: strange transliteration in win32com.client

2007-10-23 Thread Martin v. Löwis
> 'Microsoft JET Database Engine', "'c:\\Hqwhslfs001\\office\risk > oversight\\myaccess.mdb' is not a valid path. Make sure that the path > name is spelled correctly and that you are connected to the server on > which the file resides.", None, 5003044, -2147467259), None) > > Please note the stra

Re: How to find out which functions exist?

2007-10-23 Thread mrstephengross
> Take a look at the `issubclass()` function. Ok, I see how to use issubclass(). How can I get a list of classes present in the file? --Steve -- http://mail.python.org/mailman/listinfo/python-list

Pythonw.exe exits prematurely

2007-10-23 Thread Brainsludge
Hello, I am running WinXP SP2 with Python 2.5.1 and encountered the following issue: I wrote a script that logs into my mail server, and checks for new messages every 20 seconds. When a new message is found, it displays a Windows tool tip and prints a line to console indicating a new message. Wh

Re: Automatic Generation of Python Class Files

2007-10-23 Thread Bruno Desthuilliers
Steven Bethard a écrit : > Bruno Desthuilliers wrote: > >>> I guess as long as your documentation is clear about which attributes >>> require computation and which don't... >> >> >> Why should it ? FWIW, I mentionned that I would obviously not use >> properties for values requiring heavy, non ca

Re: Anagrams

2007-10-23 Thread [EMAIL PROTECTED]
On Oct 23, 4:12 pm, "[EMAIL PROTECTED]" <[EMAIL PROTECTED]> wrote: > On Oct 23, 3:21 am, [EMAIL PROTECTED] wrote: > > > > > > > This was from a random website I found on practising good programming > > techniques and I thought I'd see what ways people could find to write > > out this example. Below

Re: Lists and Sublists

2007-10-23 Thread dwblas
> I am struggling to work out what is the ideal Python data structure > for the above. Any help would be greatly appreciated. The normal way is to use a dictionary of lists. The key would be the dictionary key, which would contain a list or a list of lists, that is each name would be an element

Re: Regular Expression

2007-10-23 Thread patrick . waldo
This is related to my last post (see: http://groups.google.com/group/comp.lang.python/browse_thread/thread/c333cbbb5d496584/998af2bb2ca10e88#998af2bb2ca10e88) I have a text file with an EINECS number, a CAS number, a Chemical Name, and a Chemical Formula, always in this order. However, I realized

Re: Automatic Generation of Python Class Files

2007-10-23 Thread Steven Bethard
Bruno Desthuilliers wrote: > Steven Bethard a écrit : >> Bruno Desthuilliers wrote: I guess as long as your documentation is clear about which attributes require computation and which don't... >>> >>> Why should it ? [snip] > I believe we simply disagree on weither properties should be u

Re: Lists and Sublists

2007-10-23 Thread Bruno Desthuilliers
dineshv a écrit : > We have a list of N (>2,000) keywords (of datatype string). Each of > the N keywords has associated with it a list of names of varying > numbers. For example, keyword(1) will have a list of L1 names > associated with it, keyword(2) will have a list of L2 names associated > wit

Re: How to find out which functions exist?

2007-10-23 Thread Marc 'BlackJack' Rintsch
On Tue, 23 Oct 2007 21:51:20 +, mrstephengross wrote: > Ok, I see how to use issubclass(). How can I get a list of classes > present in the file? import module from inspect import getmembers, isclass classes = getmembers(module, isclass) Ciao, Marc 'BlackJack' Rintsch -- http://ma

name space problem

2007-10-23 Thread BBands
An example: class classA: def __init__(self): self.b = 1 def doStuff(): some calcs a..b = 0 a = classA(): print a.b doStuff() print a.b That works as hoped, printing 1, 0. But, if I move doStuff to another module and: import doStuff class classA: def __init__(self):

Re: Automatic Generation of Python Class Files

2007-10-23 Thread Bruno Desthuilliers
Steven Bethard a écrit : > Bruno Desthuilliers wrote: > >> Steven Bethard a écrit : >> >>> Bruno Desthuilliers wrote: >>> > I guess as long as your documentation is clear about which > attributes require computation and which don't... Why should it ? > > [snip] > >> I bel

Using arrays in Python - problems.

2007-10-23 Thread attackwarningred
Dear All, Hello! I've just started to use Python and its a lovely language! I've previously programmed in Fortran 95 and have just began to use numpy. I'm having a few problems with arrays in Python though and wondered if someone could offer me some advice? I wrote the following For

More friends more money,get friends while get paid

2007-10-23 Thread jack
More friends more money,get friends while get paid http://groups.google.com/group/all-good-things/web/get-friends-while-get-paid Get 1 Million Guaranteed Real Visitors, FREE! http://www.t2000ultra.com/?rid=12740 -- http://mail.python.org/mailman/listinfo/python-list

Re: Using arrays in Python - problems.

2007-10-23 Thread marek . rocki
attackwarningred napisa (a): > The array F(n) is dynamically allocated earlier on and is sized with > reference to shotcount, the number of iterations the model performs. The > problem is I can't get something like this to run in Python using numpy, > and for the size of the array to be sized dyn

Re: name space problem

2007-10-23 Thread marek . rocki
BBands napisa (a): > An example: > > class classA: > def __init__(self): > self.b = 1 > > def doStuff(): > some calcs > a..b = 0 > > a = classA(): > print a.b > doStuff() > print a.b > > That works as hoped, printing 1, 0. > > But, if I move doStuff to another module and: > > im

1/4 Million Californians homeless by fires, this is what happens when you ship all the manpower to Iraq to steal their oil

2007-10-23 Thread lemnitzer
This is Katrina by the bush bastards in Khaalifornia. I am laughing at the two instances of K, anyone with clue ? dry and wry and vile bushes on fire. Bushes have gone mad with oil. The fact is that for a long time, the yanks in the RED states were very jealous of Khalifornia and its wealth. T

1/4 Million Californians drive by fires, this is what happens when you ship all the manpower to Iraq to steal their oil

2007-10-23 Thread lemnitzer
This is Katrina by the bush bastards in Khaalifornia. I am laughing at the two instances of K, anyone with clue ? dry and wry and vile bushes on fire. Bushes have gone mad with oil. The fact is that for a long time, the yanks in the RED states were very jealous of Khalifornia and its wealth. T

Re: Pythonw.exe exits prematurely

2007-10-23 Thread Matimus
> I am running WinXP SP2 with Python 2.5.1 and encountered the following > issue: > > I wrote a script that logs into my mail server, and checks for new > messages every 20 seconds. When a new message is found, it displays a > Windows tool tip and prints a line to console indicating a new > message

Re: escape single and double quotes

2007-10-23 Thread Michael Pelz Sherman
Leif B. Kristensen wrote: >>> You don't need to escape text when using the Python DB-API. >>> DB-API will do everything for you. >>> For example: >>> SQL = 'INSERT into TEMP data = %s' >>> c.execute(SQL, """ text containing ' and ` and all other stuff we >>. might >>. read from the network""

Re: escape single and double quotes

2007-10-23 Thread Michael Pelz Sherman
Leif B. Kristensen wrote: >>> You don't need to escape text when using the Python DB-API. >>> DB-API will do everything for you. >>> For example: >>> SQL = 'INSERT into TEMP data = %s' >>> c.execute(SQL, """ text containing ' and ` and all other stuff we >>. might >>. read from the network""

Re: Using arrays in Python - problems.

2007-10-23 Thread Robert Kern
[EMAIL PROTECTED] wrote: > attackwarningred napisa (a): > >> The array F(n) is dynamically allocated earlier on and is sized with >> reference to shotcount, the number of iterations the model performs. The >> problem is I can't get something like this to run in Python using numpy, >> and for the s

Re: Pythonw.exe exits prematurely

2007-10-23 Thread Brainsludge
Hi Matt, Your reply is much appreciated. So let me see if I understand. When console is running, it dumps stdout to console, the buffer is flushed regularly, and everything is fine and dandy. But when running without console, the stdout buffer fills up because it has no physical handle to dump to

Is this a wx bug?

2007-10-23 Thread Chris Carlen
Hi: #!/usr/bin/env python """From listing 3.3 in 'wxPython in Action' Demonstrates that something funny happens when you click&hold in the frame, then drag the mouse over the button window. The wx.EVT_ENTER_WINDOW event is missed. The wx.EVT_LEAVE_WINDOW event is NOT missed when you click&h

Re: Anagrams

2007-10-23 Thread Paul Hankin
On Oct 23, 9:21 am, [EMAIL PROTECTED] wrote: > This one uses a dictionary to store prime values of each letter in the > alphabet and for each line multiple the results of the characters > (which is unique for each anagram) and add them to a dictionary for > printing latter. > > def anagram_finder()

urllib2 web auth issues!!

2007-10-23 Thread [EMAIL PROTECTED]
import urllib2 # Create an OpenerDirector with support for Basic HTTP Authentication... auth_handler = urllib2.HTTPBasicAuthHandler() auth_handler.add_password('realm', 'https://www.somesite.com/ loginform.ws?mod=ticketing', 'myid', 'passwd') opener = urllib2.build_opener(auth_handler) # install i

Python equivalent to *nix 'banner' problem

2007-10-23 Thread Looney, James B
<> I have written a Python script to duplicate the 'banner' program from IRIX. Attached is the generated data file. This data is generated the first time by using 'banner' on my IRIX machine. Thereafter, the data is simply used (and can be run from anywhere). The data is a marshaled copy of t

Re: Using arrays in Python - problems.

2007-10-23 Thread Duncan Smith
[EMAIL PROTECTED] wrote: > attackwarningred napisa (a): > > >>The array F(n) is dynamically allocated earlier on and is sized with >>reference to shotcount, the number of iterations the model performs. The >>problem is I can't get something like this to run in Python using numpy, >>and for the si

ANN: Tenjin 0.6.1 - a fast and full-featured template engine

2007-10-23 Thread makoto kuwata
Hi all, I have released Tenjin 0.6.1. http://www.kuwata-lab.com/tenjin/ In this release, benchmark script is enhanced to support Genshi, Mako, and Templetor. Tenjin is a very fast and full-featured temlate engine. You can embed Python statements and expressions into your text file. Tenjin convert

Re: web.py & postgresql error

2007-10-23 Thread dpholmes
On Oct 23, 10:15 am, Adam Atlas <[EMAIL PROTECTED]> wrote: > On Oct 22, 9:06 pm, [EMAIL PROTECTED] wrote: > > > hi everyone, i'm very new to python and to this forum. i'm actually > > just trying to work through the tutorial on webpy.org. so far, so > > good, but as i tried to incorporate a postg

does PyAntlr come with Antlr download

2007-10-23 Thread chewie54
Hello All, I want use java2python which requires PyAntlr.I can't seem to find PyAntlr mentioned on the main website for Antlr. Thanks, -- http://mail.python.org/mailman/listinfo/python-list

Re: Pythonw.exe exits prematurely

2007-10-23 Thread Brainsludge
The script has been running console-free for about an hour now without bailing. Looks like it was the stdout buffer. Thanks! Brian On Oct 23, 4:43 pm, Matimus <[EMAIL PROTECTED]> wrote: > > I am running WinXP SP2 with Python 2.5.1 and encountered the following > > issue: > > > I wrote a script t

Re: name space problem

2007-10-23 Thread BBands
On Oct 23, 4:20 pm, [EMAIL PROTECTED] wrote: > Hello. Indeed the doStuff function in the doStuff module can't do 'a.b > = 0' (the double dot was just a typo, right?) Yes. > because it doesn't know anything about an object named a. I was trying to understand why it worked when written in, but not

transforming list

2007-10-23 Thread james_027
hi, i have a list from a resultset like this 1,"Chicago Bulls",,,"" 2,"Cleveland Caveliers",,,"" 4,"Detroit Pistons",1,"23686386.35" 4,"Detroit Pistons",2,"21773898.07" 4,"Detroit Pistons",3,"12815215.57" 4,"Detroit Pistons",4,"48522347.76" 4,"Detroit Pistons",5,"28128425.99" 4,"Detroit Pistons",6

Python Windows Installation

2007-10-23 Thread TheFlyingDutchman
I am trying to install Python 2.5 on Windows XP. It installs into the root directory on C:\ instead of C:\Python25 which it shows by default as what it plans to install to. Selecting D:\Python25 on a previous iteration put the exe in D:\ and did not create a Python25 directory. On the most recent i

Re: Speed of Nested Functions & Lambda Expressions

2007-10-23 Thread Terry Reedy
"Gary Herron" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] | beginner wrote: | > Hi All, | > | > It is really convenient to use nested functions and lambda | > expressions. What I'd like to know is if Python compiles fn_inner() | > only once and change the binding of v every time f

Re: tracking/ordering log files

2007-10-23 Thread Gabriel Genellina
En Tue, 23 Oct 2007 17:08:03 -0300, nik <[EMAIL PROTECTED]> escribió: > I think it is called "logfile rotation" and see some links about > log4py, but no description of what that is. See the logging package; in particular, you want a RotatingFileHandler.

Re: How to find out which functions exist?

2007-10-23 Thread Gabriel Genellina
En Tue, 23 Oct 2007 18:10:04 -0300, mrstephengross <[EMAIL PROTECTED]> escribió: > Let's say I have a python file with a base class, and a few derived > classes: > > class Base: > pass > > class Derived1(Base): > pass > > class Derived2(Base): > pass > > Is there a way I can find out the c

Re: Python Windows Installation

2007-10-23 Thread TheFlyingDutchman
I manually created C:\Python25 the reran the install program. The installation program noted that C:\Python25 existed and asked me if I still wanted to install there. After I said yes it installed to C:\. -- http://mail.python.org/mailman/listinfo/python-list

Re: transforming list

2007-10-23 Thread [EMAIL PROTECTED]
On Oct 23, 9:46?pm, james_027 <[EMAIL PROTECTED]> wrote: > hi, > > i have a list from a resultset like this > 1,"Chicago Bulls",,,"" > 2,"Cleveland Caveliers",,,"" ^ ^^^ ^ | ||| | 1 234 5 How come these records have 5 fields...

Re: name space problem

2007-10-23 Thread Gabriel Genellina
En Tue, 23 Oct 2007 23:34:38 -0300, BBands <[EMAIL PROTECTED]> escribió: > On Oct 23, 4:20 pm, [EMAIL PROTECTED] wrote: > I was trying to understand why it worked when written in, but not when > included. Not *included*. When you do `import doStuff` you dont "include" anything; this is what ha

Re: Python Windows Installation

2007-10-23 Thread TheFlyingDutchman
With C:\Python25 already existing, I tried to install to C: \Python25\Python25. It installed to C:\. -- http://mail.python.org/mailman/listinfo/python-list

Re: Python equivalent to *nix 'banner' problem

2007-10-23 Thread Gabriel Genellina
En Tue, 23 Oct 2007 20:29:53 -0300, Looney, James B <[EMAIL PROTECTED]> escribió: > Regardless of whether I run this from IRIX or Windows, I get the same > results. I'm expecting the string "ab" to be displayed twice. Instead, > the second time, I get ABB. If I add a 3rd print line, I'll get

Re: Using arrays in Python - problems.

2007-10-23 Thread attackwarningred
Thanks very much to those who sent me a reply to my array problem! Its now working brilliantly! Best wishes, Gareth. -- [EMAIL PROTECTED] [EMAIL PROTECTED] 665.9238429876 - Number of the Pentium Beast -- http://mail.python.org/mailman/listinfo/python-list

Re: escape single and double quotes

2007-10-23 Thread Gabriel Genellina
En Tue, 23 Oct 2007 20:50:55 -0300, Michael Pelz Sherman <[EMAIL PROTECTED]> escribió: > Leif B. Kristensen wrote: > SQL = 'INSERT into TEMP data = %s' c.execute(SQL, """ text containing ' and ` and all other stuff we >>> . might >>> . read from the network""") >> >>> Sure, but do

Re: transforming list

2007-10-23 Thread james_027
hi, On Oct 24, 1:14 pm, "[EMAIL PROTECTED]" <[EMAIL PROTECTED]> wrote: > On Oct 23, 9:46?pm, james_027 <[EMAIL PROTECTED]> wrote:> hi, > > > i have a list from a resultset like this > > 1,"Chicago Bulls",,,"" > > 2,"Cleveland Caveliers",,,"" > >^ ^^^ ^ >|

Re: transforming list

2007-10-23 Thread George Sakkis
On Oct 23, 10:46 pm, james_027 <[EMAIL PROTECTED]> wrote: > hi, > > i have a list from a resultset like this > 1,"Chicago Bulls",,,"" > 2,"Cleveland Caveliers",,,"" > 4,"Detroit Pistons",1,"23686386.35" > 4,"Detroit Pistons",2,"21773898.07" > 4,"Detroit Pistons",3,"12815215.57" > 4,"Detroit Pistons

Re: Automatic Generation of Python Class Files

2007-10-23 Thread Steven Bethard
Bruno Desthuilliers wrote: > Now how does your desire for documentation imply that "if you're > creating a class for the first time, it should *never* use property()" ? Of course, there's *never* any such thing as "never" in Python. ;-) STeVe P.S. If you really don't understand what I was gett

Re: transforming list

2007-10-23 Thread sandipm
hi james, this is one implementation using python dictionaries. report ={} for row in data: if not row[0] in report: report[row[0]] = [row[0], row[1], 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0] if row[2]: report[row[0]][row[2]+1] = row[3] reports = report.values() regards, Sa

HTTPS Proxy authentication

2007-10-23 Thread Devraj
Hi Everyone, I have successfully used the ConnectHTTPSHandler class published at http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/456195 to handle HTTPS proxy connections. Has anyone implemented a Basic authentication handler for ConnectHTTPSHandler? Or can I use urllib2 to handle the auth

<    1   2