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

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

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 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: 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: 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: 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: 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: 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: 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: 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: 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: 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: 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: 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

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

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

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

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

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: 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

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: 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

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

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

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()

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: 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

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: 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: 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

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

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

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

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

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

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

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

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: 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

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: 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: 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: 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: 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: 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

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: 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

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

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: 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 --

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: 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: 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: 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

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

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

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

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: 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

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: 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

Re: Set operations on object attributes question

2007-10-23 Thread Raymond Hettinger
> 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. The "kinda" part is where the idea falls down.

Re: New module for method level access modifiers

2007-10-23 Thread Bruno Desthuilliers
J. Clifford Dyer a écrit : > On Tue, Oct 23, 2007 at 08:54:52PM +0200, Bruno Desthuilliers wrote > regarding Re: New module for method level access modifiers: > >> TimeHorse a ?crit : >> >>> I have started work on a new module that would allow the >>> decoration of class methods to restrict acces

Re: How to break out of an emacs lisp loop ?

2007-10-23 Thread thermate
On Oct 23, 11:29 am, [EMAIL PROTECTED] wrote: > (while (not (forward-char)) > (if (looking-at "a") break ) > > When I run this sexp, I get error at break. So break is wrong syntax. > But this is the way many C loops are written. > > while ((c=(getchar()) != EOF){ if (c=='a') break; } Here is a

Re: tracking/ordering log files

2007-10-23 Thread nik
On Oct 23, 11:46 am, nik <[EMAIL PROTECTED]> wrote: > Hi, > > I heard that there was a utility for keeping files and specifically > log files organized, but haven't been able to find anything but the > logging class. The logging class seems to help create the content of a > log file, but unless I a

Python on Intel A110?

2007-10-23 Thread Bob Greschke
Will the "stock" Windows version of Python install on a Samsung Q1U-EL UMPC running Vista and with an Intel A110 processor? I want to do some development and just happened to think about this. I don't know what these processors are compatible with at the binary level. Thanks! Bob -- http:/

Re: Write by logging.FileHandler to one file by many processess

2007-10-23 Thread Gabriel Genellina
En Tue, 23 Oct 2007 05:08:11 -0300, Vinay Sajip <[EMAIL PROTECTED]> escribi�: > On Oct 18, 4:08 am, "Gabriel Genellina" <[EMAIL PROTECTED]> > wrote: >> Yes, output from several processes comes horribly mixed... >> I've avoided it using separate log files for each process; but if that's >> not po

Re: New module for method level access modifiers

2007-10-23 Thread J. Clifford Dyer
On Tue, Oct 23, 2007 at 08:54:52PM +0200, Bruno Desthuilliers wrote regarding Re: New module for method level access modifiers: > > TimeHorse a ?crit : > > I have started work on a new module that would allow the decoration of > > class methods to restrict access based on calling context. > > Spe

Re: Can't refer to base class attribute?

2007-10-23 Thread Marc 'BlackJack' Rintsch
On Tue, 23 Oct 2007 18:54:06 +, mrstephengross wrote: > I've got a Base class with an attribute "foo" (of type Foo), and a > Derived class (derived from Base). In Derived's constructor, I try to > refer to Base.foo, but python complains: > AttributeError: class Base has no attribute 'foo' B

Re: Monitoring external processes

2007-10-23 Thread arunasunil
On Oct 22, 11:33 pm, Graham Dumpleton <[EMAIL PROTECTED]> wrote: > On Oct 23, 3:09 pm, [EMAIL PROTECTED] wrote: > > > Hi, > > > Is there a way to track external processes launched by python on the > > Mac? I am using subprocess module to launch the process. > > > Thanks > > Sunil > > If using Pytho

Re: New module for method level access modifiers

2007-10-23 Thread Simon Brunning
On 10/23/07, Bruno Desthuilliers <[EMAIL PROTECTED]> wrote: > > Specifically, I have created 3 decorators named public, private and > > protected. > > Lord have mercy. +1 QOTW. -- Cheers, Simon B. [EMAIL PROTECTED] http://www.brunningonline.net/simon/blog/ GTalk: simon.brunning | MSN: small_valu

Re: japanese encoding iso-2022-jp in python vs. perl

2007-10-23 Thread Martin v. Löwis
> var = var.encode("iso-2022-jp", "replace") > print var [...] > ↓東京メトロ日比谷線・北千住行 > > So, what's the deal? Why can't python properly encode some of these > characters? It's not clear. As Ryan says, it works just fine (and so it does for me with Python 2.4.4 on Debian). What Python version are

Re: New module for method level access modifiers

2007-10-23 Thread Bruno Desthuilliers
TimeHorse a écrit : > I have started work on a new module that would allow the decoration of > class methods to restrict access based on calling context. > Specifically, I have created 3 decorators named public, private and > protected. Lord have mercy. -- http://mail.python.org/mailman/listinfo

Re: Cross-platform GUI development

2007-10-23 Thread Chris Mellon
On 10/23/07, maco <[EMAIL PROTECTED]> wrote: > On Oct 13, 12:34 am, Michael L Torrie <[EMAIL PROTECTED]> wrote: > > Alexandre Badez wrote: > > > Personnaly, I use PyQt simply because I prefere Qt to Gtk, witch is > > > much more integrated with all desktop than Gtk. > > > In fact, your application

Can't refer to base class attribute?

2007-10-23 Thread mrstephengross
I've got a Base class with an attribute "foo" (of type Foo), and a Derived class (derived from Base). In Derived's constructor, I try to refer to Base.foo, but python complains: AttributeError: class Base has no attribute 'foo' Any ideas? (code below) === CODE === #!/usr/bin/python class Foo:

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: >>> Steven Bethard a écrit : (snip) > In Python, you can use property() to make method calls look like > attribute access. This could be necessary if you h

tracking/ordering log files

2007-10-23 Thread nik
Hi, I heard that there was a utility for keeping files and specifically log files organized, but haven't been able to find anything but the logging class. The logging class seems to help create the content of a log file, but unless I am missing something, it doesn't keep track of multiple log file

Re: Cross-platform GUI development

2007-10-23 Thread maco
On Oct 13, 12:34 am, Michael L Torrie <[EMAIL PROTECTED]> wrote: > Alexandre Badez wrote: > > Personnaly, I use PyQt simply because I prefere Qt to Gtk, witch is > > much more integrated with all desktop than Gtk. > > In fact, your application in Qt on Mac, Win or Linux look like a > > native app.

Re: Hiding tracebacks from end-users

2007-10-23 Thread Alan Meyer
On Oct 23, 12:07 pm, Steven D'Aprano <[EMAIL PROTECTED] cybersource.com.au> wrote: ... > if expert_mode: > # experts get the full traceback with no hand-holding. > raise > else: > # print a more friendly error message ... Another approach is to always print a frien

Re: Iteration for Factorials

2007-10-23 Thread Marco Mariani
[EMAIL PROTECTED] wrote: > Needs work. Uh... ok.. this one gives an exception ;-) def fact(n): try: return eval('*'.join(str(x) for x in range(1,n+1))) except: return n>=0 or ValueError print fact(-1) -- http://mail.python.org/mailman/listinfo/python-list

Re: Hiding tracebacks from end-users

2007-10-23 Thread kyosohma
On Oct 23, 11:07 am, Steven D'Aprano <[EMAIL PROTECTED] cybersource.com.au> wrote: > I'm writing a command-line application that is meant to be relatively > user friendly to non-technical users. > > (Some wags might like to say that "user friendly" and "command-line > application" are, by definitio

Re: Set operations on object attributes question

2007-10-23 Thread TheSeeker
Hi, Thanks for the response! (See below for more discussion) On Oct 23, 10:39 am, Raymond Hettinger <[EMAIL PROTECTED]> wrote: > [Duane] > > > LoTuples1 = [(1,1,0),(1,2,1),(1,3,3)] > > Set1=set(LoTuples1) > > LoTuples2 = [(2,1,3),(2,2,4),(2,3,2)] > > Set2=set(LoTuples2) > > > What I would like to

Re: open remote terminal

2007-10-23 Thread Fabian Braennstroem
Hi Rafael, Rafael Sachetto wrote: > Take a look at this documentation: > > http://pexpect.sourceforge.net/pxssh.html thanks for the link, but it actually looks to me almost like my little example... I somehow don't get it!? Any more hints? Fabian > >> >>> >> >> pexpect would be the usual solu

Re: Can't Write to PostGIS PostGreSQL database via psycopg2

2007-10-23 Thread David Michael Schruth,
On Oct 22, 8:43 pm, Erik Jones <[EMAIL PROTECTED]> wrote: > On Oct 22, 2007, at 8:19 PM, David Michael Schruth, wrote: > > > > > Hi, > > > I am sort of in a jam here. I am using the PsycoPG2 library to read > > data out of a windows XP based PostGIS / PostGreSQL database but I am > > apparently un

Re: Automatic Generation of Python Class Files

2007-10-23 Thread Steven Bethard
Bruno Desthuilliers wrote: > Steven Bethard a écrit : >> Bruno Desthuilliers wrote: >>> Steven Bethard a écrit : >>> (snip) In Python, you can use property() to make method calls look like attribute access. This could be necessary if you have an existing API that used public attri

Re: Iteration for Factorials

2007-10-23 Thread [EMAIL PROTECTED]
On Oct 23, 5:55 am, Marco Mariani <[EMAIL PROTECTED]> wrote: > Tim Chase wrote: > fact = lambda i: i > 1 and reduce(mul, xrange(1, i+1)) or not > > i and 1 or None > > > Stunts like this would get a person fired around here if they > > were found in production code :) > > eheh, indeed. > > def

Re: Automatic Generation of Python Class Files

2007-10-23 Thread Steven Bethard
Marc 'BlackJack' Rintsch wrote: > On Mon, 22 Oct 2007 17:31:51 -0600, Steven Bethard wrote: > >> Bruno Desthuilliers wrote: >>> Computed attributes are IMHO not only a life-saver when it comes to >>> refactoring. There are cases where you *really* have - by 'design' I'd >>> say - the semantic of

Re: Iteration for Factorials

2007-10-23 Thread [EMAIL PROTECTED]
On Oct 23, 6:58 am, [EMAIL PROTECTED] wrote: > On 22 oct, 23:39, "[EMAIL PROTECTED]" <[EMAIL PROTECTED]> wrote: > > > Nope, still doesn't work: > > > def fact(x): > > return reduce(operator.mul,xrange(1,x+1),1) > > > fact() should raise an exception if x is negative. > > So, where is the pr

Re: Life-time of temporary variables in list comprehensions

2007-10-23 Thread Steven D'Aprano
On Tue, 23 Oct 2007 17:02:48 +, beginner wrote: > My test shows that if c is not defined before the list comprehension, it > will be created in the list comprehension; if it is defined before the > list comprehension, the value will be overwritten. In other words, temp > variables are not loca

Re: Life-time of temporary variables in list comprehensions

2007-10-23 Thread Diez B. Roggisch
beginner schrieb: > 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 comprehension; if it is defined be

Re: Life-time of temporary variables in list comprehensions

2007-10-23 Thread Carsten Haese
On Tue, 2007-10-23 at 17:02 +, beginner 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] "c='B'" is invalid syntax. Maybe you mean "c=='B'". That doesn't make much sense, but at least it's correct syntax. > print c >

Re: Hiding tracebacks from end-users

2007-10-23 Thread myonov
On Oct 23, 7:07 pm, Steven D'Aprano <[EMAIL PROTECTED] cybersource.com.au> wrote: > I'm writing a command-line application that is meant to be relatively > user friendly to non-technical users. > > (Some wags might like to say that "user friendly" and "command-line > application" are, by definition

Re: greatest and least of these...

2007-10-23 Thread Erik Jones
On Oct 23, 2007, at 10:56 AM, Shawn Minisall wrote: > I just wrote a program to let the user input a series of whole numbers > and tell them which is least and which is greatest based off of a > menu. > However, the menu isn't kicking in after they pick a number. I > included > a while statem

New module for method level access modifiers

2007-10-23 Thread TimeHorse
I have started work on a new module that would allow the decoration of class methods to restrict access based on calling context. Specifically, I have created 3 decorators named public, private and protected. These modifiers work as follows: Private: A private method can only be called from a met

Re: Normalize a polish L

2007-10-23 Thread Roberto Bonvallet
On Oct 22, 7:50 pm, Mike Orr <[EMAIL PROTECTED]> wrote: > Well, that gets into official vs unofficial conversions. Does the > Spanish Academy really say 'ü' should be converted to 'u'? No, but it's the only conversion that makes sense. The only Spanish letter that doesn't have a standard common

Life-time of temporary variables in list comprehensions

2007-10-23 Thread beginner
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 comprehension; if it is defined before the list comprehension, the value will

Re: greatest and least of these...

2007-10-23 Thread Jason Drew
What do you mean when you say the menu doesn't kick in? Do you get an exception, or does simply nothing happen? Before the if statements, you should put "print choice" so you can see what value is being returned by the input function. Also maybe "print type(choice)" for a bit more inspection. Spe

Re: greatest and least of these...

2007-10-23 Thread Marc 'BlackJack' Rintsch
On Tue, 23 Oct 2007 11:56:33 -0400, Shawn Minisall wrote: > I just wrote a program to let the user input a series of whole numbers > and tell them which is least and which is greatest based off of a menu. > However, the menu isn't kicking in after they pick a number. I included > a while stat

  1   2   >