Re: Accessors in Python (getters and setters)

2006-07-20 Thread Steve Holden
Dennis Lee Bieber wrote: > On 19 Jul 2006 22:38:17 -0700, "mystilleef" <[EMAIL PROTECTED]> > declaimed the following in comp.lang.python: > > >>permitted should be between an object and its mediator. Messages are >>passed through the system via signals or events or established >>protocols. What a

Re: Accessors in Python (getters and setters)

2006-07-20 Thread Steve Holden
mystilleef wrote: [...] > > I don't know it's your code not mine. > > class Robust(object): > > def __init__(self): > # Arbitrarily changing this state to False will crash app or > will > # corrupt the whole event system. > self.__is_active = True

Re: Depricated String Functions in Python

2006-07-20 Thread Steve Holden
Anoop wrote: > Hi All > > Can any one help me out with the various depricated string functions > that is followed in Python. > > For example how will be string.lower depricated. > > As far as string.lower('PYTHON') is concerned it is depricated as > 'PYTHON'.lower(). Both of them would return an

Re: using names before they're defined

2006-07-20 Thread Steve Holden
[EMAIL PROTECTED] wrote: > Steve Holden wrote: > >>[EMAIL PROTECTED] wrote: >> >>>I have a problem. I'm writing a simulation program with a number of >>>mechanical components represented as objects. When I create instances >>>of objects, I need to reference (link) each object to the objects >>>ups

Re: New to threads. How do they work?

2006-07-20 Thread Dermot Doran
Hi   I think the answer to your last question is that the threading module provides a high level interface (i.e. easier to  use) to the thread module.  The thread module is very low-level.  Any threaded python scripts I have written (not expert) have used the threading module which is, in my opini

Re: Getting and Setting Cookies

2006-07-20 Thread Vlad Dogaru
John J. Lee wrote: > "Vlad Dogaru" <[EMAIL PROTECTED]> writes: > [...] > > I am trying to write a simple login script. I understand (or rather I > > think I understand) how to set a cookie with the Cookie module. My > > problem is getting the cookies that are currently set. How can I do > > that? >

Re: Coding style

2006-07-20 Thread Antoon Pardon
On 2006-07-19, Georg Brandl <[EMAIL PROTECTED]> wrote: > Antoon Pardon wrote: > >>> Other than in PHP, Python has clear rules when an object of a builtin type >>> is considered false (i.e. when it's empty). So why not take advantage of >>> this? >> >> Because it doesn't always do what I want. >>

Re: mysqldb problem

2006-07-20 Thread Lawrence D'Oliveiro
In message <[EMAIL PROTECTED]>, liupei wrote: > when I set mysql some fields collate utf8_bin, and then fetch these > fields is array.array,not the string I expected Can you post some example code? -- http://mail.python.org/mailman/listinfo/python-list

Re: questions to anyone who uses wxPython

2006-07-20 Thread Dermot Doran
Hi   the "wxPython in Action" provides a very good explanation as to how to handle this sort of problem using a combination of pure Python threads and the wx.CallAfter function.  Also if you want more help on this you can join the wxPython mailing list via www.wxpython.org.   Here is a small exam

Re: Depricated String Functions in Python

2006-07-20 Thread John Machin
On 20/07/2006 5:18 PM, Steve Holden wrote: > Anoop wrote: >> Hi All >> >> Can any one help me out with the various depricated string functions >> that is followed in Python. >> >> For example how will be string.lower depricated. >> >> As far as string.lower('PYTHON') is concerned it is depricated a

Re: access to submodules

2006-07-20 Thread TG
okay, thanks everyone. this is much clearer now. -- http://mail.python.org/mailman/listinfo/python-list

Re: Coding style

2006-07-20 Thread Antoon Pardon
On 2006-07-19, Donn Cave <[EMAIL PROTECTED]> wrote: > In article <[EMAIL PROTECTED]>, > Georg Brandl <[EMAIL PROTECTED]> wrote: >> Lawrence D'Oliveiro wrote: > >> > One of my rules is, always program like the language actually has a Boolean >> > type, even if it doesn't. That means, never assume t

Re: Depricated String Functions in Python

2006-07-20 Thread Steve Holden
John Machin wrote: > On 20/07/2006 5:18 PM, Steve Holden wrote: > >>Anoop wrote: >> >>>Hi All >>> >>>Can any one help me out with the various depricated string functions >>>that is followed in Python. >>> >>>For example how will be string.lower depricated. >>> >>>As far as string.lower('PYTHON') i

Re: restricted environment

2006-07-20 Thread Gabriele *darkbard* Farina
Paul Rubin wrote: > "Gabriele *darkbard* Farina" <[EMAIL PROTECTED]> writes: > > Using a separate interpreter could be a solution, but restarting any > > time the interpreter give me too much overhead and the application will > > work as slow as a CGI app even if it runs using FastCGI. > > How man

Re: CSV with comments

2006-07-20 Thread GinTon
and which method is the best, Daniel's generator or the subclass? -- http://mail.python.org/mailman/listinfo/python-list

Re: restricted environment

2006-07-20 Thread Gabriele *darkbard* Farina
faulkner wrote: > http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/496746 > When you think of modifying the interpreter, think of the compiler > module. This seems a good solutions. Does it works correctly and safely ? -- http://mail.python.org/mailman/listinfo/python-list

Re: Warning when new attributes are added to classes at run time

2006-07-20 Thread Bruno Desthuilliers
Matthew Wilson wrote: > I sometimes inadvertently create a new attribute on an object rather > update a value bound to an existing attribute. For example: > (snip) > > I meant to update c.a but I created a new c.A. I make this mistake > probably hourly. > > I suspect adding attributes at run t

Re: using names before they're defined

2006-07-20 Thread Iain King
[EMAIL PROTECTED] wrote: > Iain, thanks - very helpful. > > Really I'm trying to write a simulation program that goes through a > number of objects that are linked to one another and does calculations > at each object. The calculations might be backwards or fowards (i.e. > starting at the supply o

Re: Partial classes

2006-07-20 Thread Bruno Desthuilliers
Stefan Behnel wrote: > Kay Schluehr wrote: > >>What about letting your teammates editing certain data-structures in >>different files ( physical modules ) but using them in a uniform way >>and enable a single access point. If you have partial classes there is >>no reason why your team has to share

Re: Accessors in Python (getters and setters)

2006-07-20 Thread mystilleef
Steve Holden wrote: > mystilleef wrote: > [...] > > > > I don't know it's your code not mine. > > > > class Robust(object): > > > > def __init__(self): > > # Arbitrarily changing this state to False will crash app or > > will > > # corrupt the whole event system. > >

Re: function v. method

2006-07-20 Thread Bruno Desthuilliers
danielx wrote: > Bruno Desthuilliers wrote: > >>danielx wrote: (snip) >>>which gets me thinking again about >>>the stuff I self-censored. Since the dot syntax does something special >>>and unexpected in my case, >> >>"unexpected" ? Did you ever wondered how the instance or class was >>passed as f

Re: Detecting socket connection failure

2006-07-20 Thread Ben Sizer
[EMAIL PROTECTED] wrote: > First, the proof that > something is there and rejecting the connection (or is it that this > thing actually accepts the connection and then drops it?)... Yes, it accepts it and then drops it, or perhaps drops it after receiving some data? It's not a failed or rejected c

Re: Coding style

2006-07-20 Thread Antoon Pardon
On 2006-07-19, Dennis Lee Bieber <[EMAIL PROTECTED]> wrote: > On 19 Jul 2006 12:27:39 GMT, Antoon Pardon <[EMAIL PROTECTED]> > declaimed the following in comp.lang.python: > > >> >> I once had a producer consumer code. When the client asked whether new >> items were available the function could re

Re: how to know if socket is still connected

2006-07-20 Thread Lawrence D'Oliveiro
In message <[EMAIL PROTECTED]>, Grant Edwards wrote: > If the server has closed the connection, then a recv() on the > socket will return an empty string "", and a send() on the > socket will raise an exception. Would that still apply when trying to send an empty string? -- http://mail.python.or

Re: Coding style

2006-07-20 Thread Bruno Desthuilliers
Lawrence D'Oliveiro wrote: > In message <[EMAIL PROTECTED]>, Bruno Desthuilliers > wrote: > > >>Lawrence D'Oliveiro wrote: >> >>>In message <[EMAIL PROTECTED]>, Bob Greschke >>>wrote: >>> >>> >>> I'd go even one step further. Turn it into English (or your favorite non-computer language):

Re: how to know if socket is still connected

2006-07-20 Thread Steve Holden
Lawrence D'Oliveiro wrote: > In message <[EMAIL PROTECTED]>, Grant Edwards wrote: > > >>If the server has closed the connection, then a recv() on the >>socket will return an empty string "", and a send() on the >>socket will raise an exception. > > > Would that still apply when trying to send a

Help Needed. Removing a Folder Problem

2006-07-20 Thread Kilicaslan Fatih
When I push a button to trigger the code: def run(self, event): cmd_out = self.A_com() if App.runF != "": os.mkdir('C:\copiedFiles') for item in App.runF: App.beCopied = str(item) shutil.copy(App.beC

Re: Augument assignment versus regular assignment

2006-07-20 Thread Antoon Pardon
On 2006-07-19, Terry Reedy <[EMAIL PROTECTED]> wrote: > > "Antoon Pardon" <[EMAIL PROTECTED]> wrote in message > news:[EMAIL PROTECTED] >> So IMV those preparation before the attachment, belong to >> whatever the interpreter does before it actually attaches >> an object to a name/slot. >> >> So t

Re: Accessors in Python (getters and setters)

2006-07-20 Thread Bruno Desthuilliers
mystilleef wrote: > Bruno Desthuilliers wrote: > >>mystilleef wrote: >> >>>Bruno Desthuilliers wrote: >>> >>> mystilleef wrote: >> >>(snip) >> >>>Of course using setters for the sake of just using them is pointless. >> >>Indeed. >> >> >> >> >>>The reason to use

Re: Accessors in Python (getters and setters)

2006-07-20 Thread Bruno Desthuilliers
Dennis Lee Bieber wrote: > On Wed, 19 Jul 2006 18:54:55 +0200, Bruno Desthuilliers > <[EMAIL PROTECTED]> declaimed the following in comp.lang.python: > > >>Indeed. And when you don't need too ? (the second 'o' is not a typo) >> > > Pardon, but for the sense you intend, it should be: > >

Bug? Certainly a new *behavior* from subprocess in 2.5 on Win32

2006-07-20 Thread Larry Hastings
I run the following script: -- from subprocess import * Popen("ls -l") -- (yeah, I have ls.exe on Windows) Under Python 2.4.2, this simply dumped the results of ls.exe to the terminal--sorry, to the "command shell". Under Python 2.5, both beta 1 and beta 2, it dumps the results to the command she

Re: using names before they're defined

2006-07-20 Thread davehowey
Paddy, thanks for your mail. > In Digital electronics we have what are called netlists, (and also > component lists) yes, years back I did a 3rd year project on a 'logic simulator' which used the kind of thing you are talking about. I think spice does as well. Fortunately my problem is a little

Re: Accessors in Python (getters and setters)

2006-07-20 Thread Gerhard Fiedler
On 2006-07-20 04:15:33, Steve Holden wrote: > mystilleef wrote: > [...] >> >> I don't know it's your code not mine. >> >> class Robust(object): >> >> def __init__(self): >> # Arbitrarily changing this state to False will crash app or >> will >> # corrupt the whol

Re: Accessors in Python (getters and setters)

2006-07-20 Thread Steve Holden
Gerhard Fiedler wrote: > On 2006-07-20 04:15:33, Steve Holden wrote: > > >>mystilleef wrote: >>[...] >> >>>I don't know it's your code not mine. >>> >>>class Robust(object): >>> >>> def __init__(self): >>> # Arbitrarily changing this state to False will crash app or >>> will >>>

Re: wxPython: wxStaticBitmap and large images

2006-07-20 Thread Will McGugan
Roger Miller wrote: > I have a WxPython app that displays images that are typically around > 600x600 pixels. I use a wxStaticBitmap, which appears to work fine on > Windows XP. However the documentation states that a StaticBitmap "... > is meant for display of the small icons in the dialog boxes a

Re: Accessors in Python (getters and setters)

2006-07-20 Thread Diez B. Roggisch
> Lol. I actually did *un*learn the hard way. > > Mystilleef, I've started programing 17 years ago, and have done it > professionnaly for almost 10 years now. I do not pretend to be a good > programmer, but please believe that I do know my job. I've read the Book > too, I've tried applying it blin

Re: using names before they're defined

2006-07-20 Thread Bruno Desthuilliers
[EMAIL PROTECTED] wrote: (snip) > brings me onto another question that has been bugging me, which is, if > I want to create components (as object instances) at run time (rather > than through a python code imported in), how do I do this? i.e. if I > hardcoded something like > turbine1 = turbine(...

Re: Recursive function returning a list

2006-07-20 Thread Bruno Desthuilliers
[EMAIL PROTECTED] wrote: > Bruno Desthuilliers wrote: > >>[EMAIL PROTECTED] wrote: > > [...] > >>>Sorry, but I kinda agree with Boris here. >> >>On what ? > > > On the argument that you are (implicitly?) disagreeing with him it's getting messy - too much level of indirection !-) > on, > obv

Re: Accessors in Python (getters and setters)

2006-07-20 Thread Bruno Desthuilliers
mystilleef wrote: (snip) > > __monitor_event is not supposed to be a write accessor. My point was > show how you can change the state of an object internally without > needing external access to it. Since some people are surprisingly > claiming it is not possible. I failed to see anyone making su

Re: questions to anyone who uses wxPython

2006-07-20 Thread [EMAIL PROTECTED]
damacy wrote: > hello. i'm using wxPython as my GUI package and whenever my program > executes a long process which takes at least 2 or 3 seconds, the user > interface gets corrupted while executing the progrocess during the > period. Hi Darnacy, I had the same issue and used wxProcess to run th

Re: Accessors in Python (getters and setters)

2006-07-20 Thread Bruno Desthuilliers
Gerhard Fiedler wrote: (snip) > > I'm not sure, but there's one thing that has a potential to be the real > issue: what's the common way to create a property that is read-write for > the implementation and "read-only" for the interface? class Foo(object): @apply def _imp(): def fget(self

Re: Depricated String Functions in Python

2006-07-20 Thread Anoop
Thanks Stefen let me be more specific how would i have to write the following function in the deprecated format map(string.lower,list) Thanks Anoop Stefan Behnel wrote: > Anoop wrote: > > Can any one help me out with the various depricated string functions > > that is followed in Python. > > >

SOAPy Question

2006-07-20 Thread gregarican
I apologize in advance for not googling in depth enough :-) I am looking for use Python's SOAP implementation to pull some retail pricing data for a work project. Our Internet access goes through an authenticating proxy server. Can I access information in this scenario using SOAPy? I have seen case

Checking File permissions

2006-07-20 Thread Anoop
Hi All Please tell me how to check the existence of a file and the read permission to the file using python script Thanks for ur inputs Anoop -- http://mail.python.org/mailman/listinfo/python-list

Checking File permissions

2006-07-20 Thread Anoop
Hi All Please tell me how to check the existence of a file and the read permission to the file using python script Thanks for ur inputs Anoop -- http://mail.python.org/mailman/listinfo/python-list

Checking File permissions

2006-07-20 Thread Anoop
Hi All Please tell me how to check the existence of a file and the read permission to the file using python script Thanks for ur inputs Anoop -- http://mail.python.org/mailman/listinfo/python-list

Re: Depricated String Functions in Python

2006-07-20 Thread Steve Holden
Anoop wrote: > Thanks Stefen > > let me be more specific how would i have to write the following > function in the deprecated format > > map(string.lower,list) > To avoid the deprecated usage you would use the unbound method of the str type (that's the type of all strings): >>> lst = ['Steve

Re: Depricated String Functions in Python

2006-07-20 Thread Simon Forman
Anoop wrote: > Thanks Stefen > > let me be more specific how would i have to write the following > function in the deprecated format > > map(string.lower,list) > > Thanks Anoop Ah. This is easy enough: lower_list = [s.lower() for s in str_list] Or, if you really like map() (or really don't like

Re: Depricated String Functions in Python

2006-07-20 Thread Duncan Booth
Anoop wrote: > let me be more specific how would i have to write the following > function in the deprecated format > > map(string.lower,list) What you just wrote is the deprecated format. There are plenty of ways to write it in an undeprecated format. The simplest is probably: [ s.lower()

Re: Accessors in Python (getters and setters)

2006-07-20 Thread mystilleef
Bruno Desthuilliers wrote: > mystilleef wrote: > > Bruno Desthuilliers wrote: > > > >>mystilleef wrote: > >> > >>>Bruno Desthuilliers wrote: > >>> > >>> > mystilleef wrote: > >> > >>(snip) > >> > >>>Of course using setters for the sake of just using them is pointless. > >> > >>Inde

Encode filenames to safe format

2006-07-20 Thread Dara Durum
Hi !I want to encode filenames to safe format, like in browser url (space -> %20, etc.).What the module and function name that helps me in this project ?Thanx for it:dd -- http://mail.python.org/mailman/listinfo/python-list

Re: Warning when new attributes are added to classes at run time

2006-07-20 Thread Matthew Wilson
On Thu 20 Jul 2006 04:32:28 AM EDT, Bruno Desthuilliers wrote: >> self.__dict__[name] = value > Make it: > object.__setattr__(self, name, value) > > Your approach will lead to strange results if you mix it with properties > or other descriptors... Thanks! >> cl

Re: question about what lamda does

2006-07-20 Thread nephish
hey thanks for that last post, although some of it was a bit over my head. i think i am getting more of the differences here. thanks again, sk danielx wrote: > [EMAIL PROTECTED] wrote: > > Hey there, > > i have been learning python for the past few months, but i can seem to > > get what exactly a

Re: Help Needed. Removing a Folder Problem

2006-07-20 Thread Larry Bates
Note the error is permission denied. I would guess that either the file has read-only flag set or perhaps the '' program is still running and has the file open in a separate thread so you can't delete the directory until it has completed. You should take a look at the subprocess module and us

subprocess module

2006-07-20 Thread placid
Hi all, If someone could give me an example of creating a subprocess (on Windows) using the subprocess module and Popen class and connecting to its stdout/stdin file handles. I googled for a bit but the only example i found was here ; http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/438119

Re: Warning when new attributes are added to classes at run time

2006-07-20 Thread Bruno Desthuilliers
Matthew Wilson wrote: > On Thu 20 Jul 2006 04:32:28 AM EDT, Bruno Desthuilliers wrote: (snip) > >>>class C1(C): >>> >>>standard_attributes = ['a1', 'a2'] >> >>DRY violation here. And a potential problem with inheritance (as always >>with class attributes). > > > Considering I had to

Re: Depricated String Functions in Python

2006-07-20 Thread riquito
Steve Holden ha scritto: > Anoop wrote: > > Thanks Stefen > > > > let me be more specific how would i have to write the following > > function in the deprecated format > > > > map(string.lower,list) > > > To avoid the deprecated usage you would use the unbound method of the > str type (that's the

Re: Checking File permissions

2006-07-20 Thread Avell Diroll
Anoop wrote: > Please tell me how to check the existence of a file and the read > permission to the file using python script You can check the os module (os.stat comes to mind). For an exemple you can have a look at : http://www.pixelbeat.org/talks/python/ls.py Regards, Avell -- http://mail.py

Re: Checking File permissions

2006-07-20 Thread Larry Bates
Note: You really don't have to post the same question 3 times (2 in response to yourself). import os if os.path.exists(pathname): To see if a file is writeable: import stat def iswriteable(path): mode=os.stat(path)[stat.ST_mode] return bool(stat.S_IMODE(mode) & stat.S_IWRITE) Larr

Py2exe & (Py)QT4

2006-07-20 Thread shane . external
I'm having trouble using Py2exe with a PyQT-based python project. Or possibly I'm having a problem with PyQT and Py2exe makes it apparent. Whichever it is, I run into trouble with importing QtCore and QtGui. The error reported is: Traceback (most recent call last): File "xmlEdit.py", line 3, i

Re: SOAPy Question

2006-07-20 Thread gregarican
Please disregard, as I googled my way to the answer. I used SOAPProxy to specify the information I needed to get out to the external SOAP service. All is well and away we go :-) gregarican wrote: > I apologize in advance for not googling in depth enough :-) I am > looking for use Python's SOAP imp

Re: Help Needed. Removing a Folder Problem

2006-07-20 Thread Kilicaslan Fatih
--- Larry Bates <[EMAIL PROTECTED]> wrote: > Note the error is permission denied. I would guess > that > either the file has read-only flag set or perhaps > the > '' program is still running and has the file > open > in a separate thread so you can't delete the > directory > until it has co

Re: Encode filenames to safe format

2006-07-20 Thread Amit Khemka
On 7/20/06, Dara Durum <[EMAIL PROTECTED]> wrote: > Hi ! > > I want to encode filenames to safe format, like in browser url (space -> > %20, etc.). > What the module and function name that helps me in this project ? > import urllib urllib.quote('file name') cheers, amit -- Amit Khemka -- o

Re: Accessors in Python (getters and setters)

2006-07-20 Thread Bruno Desthuilliers
mystilleef wrote: > Bruno Desthuilliers wrote: > (snip) >You use accessors when you need to control access to a data attribute. Indeed. And when you don't need too ? (the second 'o' is not a typo) >>> >>> >>>You make the attribute private/protected. >> >>doh :( >> >>Let's talk ab

Re: text representation of HTML

2006-07-20 Thread garabik-news-2005-05
Ksenia Marasanova <[EMAIL PROTECTED]> wrote: > Hi, > > I am looking for a library that will give me very simple text > representation of HTML. > For example > TitleThis is a test > > will be transformed to: > > Title > > This is a > test > > > i want to send plain text alternative of html ema

Re: question about what lamda does

2006-07-20 Thread Bruno Desthuilliers
danielx wrote: (snip) > Python's lambda really can't be as powerful as Lisp's because Python > does not have expressions that do case analysis (this is not lambda's > fault, of course ;). The reason is that you really want to put each > case on its own set of lines. This enhances readability at th

Re: text representation of HTML

2006-07-20 Thread Duncan Booth
Ksenia Marasanova wrote: > I am looking for a library that will give me very simple text > representation of HTML. > For example >TitleThis is a test > > will be transformed to: > > Title > > This is a > test > > > i want to send plain text alternative of html email, and would prefer > to do

Re: range() is not the best way to check range?

2006-07-20 Thread Alex Martelli
Paul Boddie <[EMAIL PROTECTED]> wrote: > John Machin wrote: > > > > range() and xrange() are functions. You are suggesting that 2 > > *functions* should acquire a __contains__ method each? I trust not. > > Well, range is a function in the current implementation, although its > usage is similar to

Note on PEP 299

2006-07-20 Thread bearophileHUGS
I don't like much the syntax of: if __name__ == '__main__': Some time ago I have read this PEP: http://www.python.org/dev/peps/pep-0299/ And why it was refused: http://mail.python.org/pipermail/python-dev/2006-March/062955.html I think the name of the standard main function may be just main(), s

Re: range() is not the best way to check range?

2006-07-20 Thread Paul Boddie
Alex Martelli wrote: > Paul Boddie <[EMAIL PROTECTED]> wrote: > > > > Well, range is a function in the current implementation, although its > > usage is similar to that one would get if it were a class, particularly > > a subclass of list or one providing a list-style interface. With such a > > cla

Re: Python linker

2006-07-20 Thread Alex Martelli
Ben Sizer <[EMAIL PROTECTED]> wrote: > Sion Arrowsmith wrote: > > Er, what? How are you generating your standalone executables? What > > size is "acceptable"? python24.dll is only 1.8M -- surely on any > > non-embedded platform these days 1.8M isn't worth bothering about. > > And since you mention

Re: Help Needed. Removing a Folder Problem(Problem Solved)

2006-07-20 Thread Kilicaslan Fatih
--- Larry Bates <[EMAIL PROTECTED]> wrote: > Note the error is permission denied. I would guess > that > either the file has read-only flag set or perhaps > the > '' program is still running and has the file > open > in a separate thread so you can't delete the > directory > until it has co

Re: Help Needed. Removing a Folder Problem(Problem Solved)

2006-07-20 Thread Kilicaslan Fatih
--- Larry Bates <[EMAIL PROTECTED]> wrote: > Note the error is permission denied. I would guess > that > either the file has read-only flag set or perhaps > the > '' program is still running and has the file > open > in a separate thread so you can't delete the > directory > until it has co

Re: Help Needed. Removing a Folder Problem(Problem Solved)

2006-07-20 Thread Kilicaslan Fatih
--- Larry Bates <[EMAIL PROTECTED]> wrote: > Note the error is permission denied. I would guess > that > either the file has read-only flag set or perhaps > the > '' program is still running and has the file > open > in a separate thread so you can't delete the > directory > until it has co

Re: Python linker

2006-07-20 Thread Alex Martelli
<[EMAIL PROTECTED]> wrote: > I develop shareware applications that need to be extremely slim (less > than 1 MB is preferable). > > Delphi applications easily meet this requirement and I can expect end > users to download the .NET framework (if they don't already have it!). > > However, I cannot

Re: range() is not the best way to check range?

2006-07-20 Thread Alex Martelli
Paul Boddie <[EMAIL PROTECTED]> wrote: > Alex Martelli wrote: > > Paul Boddie <[EMAIL PROTECTED]> wrote: > > > > > > Well, range is a function in the current implementation, although its > > > usage is similar to that one would get if it were a class, particularly > > > a subclass of list or one p

Re: Question regarding commit/backout of a message using the pymqi module

2006-07-20 Thread JonS
Andrew Robert wrote: > Hi everyone, > > Could someone help explain what I am doing wrong in > this code block? > > This code block is an excerpt from a larger file that receives > transmitted files via IBM WebSphere MQSeries an drops it to the local > file system. > > Transmission of the file work

Re: Accessors in Python (getters and setters)

2006-07-20 Thread Diez B. Roggisch
> You mean: > > class Pythonic(object): > def __init__(self): > self._is_active = True > > @apply > def is_active(): > def fget(self): return self._is_active > def fset(self): raise SomeException('sorry, read-only') > return property(**locals()) Neat! That sli

Re: Accessors in Python (getters and setters)

2006-07-20 Thread mystilleef
Bruno Desthuilliers wrote: > mystilleef wrote: > > Bruno Desthuilliers wrote: > > > (snip) > >You use accessors when you need to control access to a data attribute. > > Indeed. And when you don't need too ? (the second 'o' is not a typo) > > >>> > >>> > >>>You make the attribute

strange error when importing a module

2006-07-20 Thread Robin Becker
I'm trying to understand the following strangeness C:\code\rlextra\ers>python Python 2.4.3 (#69, Mar 29 2006, 17:35:34) [MSC v.1310 32 bit (Intel)] on win32 Type "help", "copyright", "credits" or "license" for more information. >>> from rlextra.utils.SimpleXMLRPCServer import SimpleXMLRPCServer T

Re: Depricated String Functions in Python

2006-07-20 Thread Donn Cave
In article <[EMAIL PROTECTED]>, Steve Holden <[EMAIL PROTECTED]> wrote: > Anoop wrote: > > Thanks Stefen > > > > let me be more specific how would i have to write the following > > function in the deprecated format > > > > map(string.lower,list) > > > To avoid the deprecated usage you would us

Re: Coding style

2006-07-20 Thread Donn Cave
In article <[EMAIL PROTECTED]>, Antoon Pardon <[EMAIL PROTECTED]> wrote: > On 2006-07-19, Donn Cave <[EMAIL PROTECTED]> wrote: ... > > http://groups.google.com/group/comp.lang.python/msg/2de5e1c8384c0360 > > > > It's lengthy but very readable, and for me it has that quality of > > exposition where

Re: text representation of HTML

2006-07-20 Thread Tim Williams
On 20 Jul 2006 15:12:27 GMT, Duncan Booth <[EMAIL PROTECTED]> wrote: > Ksenia Marasanova wrote: > > i want to send plain text alternative of html email, and would prefer > > to do it automatically from HTML source. > > Any hints? > > Use htmllib: > > >>> import htmllib, formatter, StringIO > >>> de

Re: strange error when importing a module

2006-07-20 Thread Robin Becker
Robin Becker wrote: > I'm trying to understand the following strangeness > > C:\code\rlextra\ers>python > Python 2.4.3 (#69, Mar 29 2006, 17:35:34) [MSC v.1310 32 bit (Intel)] on win32 > Type "help", "copyright", "credits" or "license" for more information. > >>> from rlextra.utils.SimpleXMLRPCSe

Re: Accessors in Python (getters and setters)

2006-07-20 Thread Bruno Desthuilliers
mystilleef wrote: > Bruno Desthuilliers wrote: >>point 2 : so anyone *can* "illegimately tampering with an object's >>internal data" at will. >> > >And this is robust how? > You can do just the same in Java or C++. >>> >>> >>>OMG! >> >>It's common knowledge. >

Re: Accessors in Python (getters and setters)

2006-07-20 Thread Ant
Came across this article this afternoon - thought it may be of interest to some of those following this thread... http://www.devx.com/opensource/Article/31593/0/page/2 -- http://mail.python.org/mailman/listinfo/python-list

Re: Accessors in Python (getters and setters)

2006-07-20 Thread Gerhard Fiedler
On 2006-07-20 09:40:31, Bruno Desthuilliers wrote: >> I'm not sure, but there's one thing that has a potential to be the real >> issue: what's the common way to create a property that is read-write >> for the implementation and "read-only" for the interface? > > class Foo(object): > @apply >

Using python code from Java?

2006-07-20 Thread fortepianissimo
Is there a solution to enable Java programmers to call functions written in Python? Any wrapper generator that wraps Python code into some Java-callable form? I briefly looked at Jython, but if I understand it right, it didn't support full power of Python 2.3.x (which I need). Any suggestion is w

Re: Warning when new attributes are added to classes at run time

2006-07-20 Thread Nick Vatamaniuc
Use __slots__ they will simply give you an error. But at the same time I don't think they are inheritable and in general you should only use slots for performance reasons (even then test before using). Or you could also simulate a __slots__ mechanism the way you are doing i.e. checking the attribu

Re: Using python code from Java?

2006-07-20 Thread Diez B. Roggisch
fortepianissimo schrieb: > Is there a solution to enable Java programmers to call functions > written in Python? Any wrapper generator that wraps Python code into > some Java-callable form? > > I briefly looked at Jython, but if I understand it right, it didn't > support full power of Python 2.3.x

ConfigParser: what read('non-existent-filename') returns in 2.3.x?

2006-07-20 Thread Danil Dotsenko
Wrote a little "user-friedly" wrapper for ConfigParser for a KDE's SuperKaramba widget. (http://www.kde-look.org/content/show.php?content=32185) I was using 2.4.x python docs as reference and ConfigParser.read('non-existent-filename') returns [] in 2.4.x One user with 2.3.x reported an error stem

Re: Using python code from Java?

2006-07-20 Thread fortepianissimo
Diez B. Roggisch wrote: > fortepianissimo schrieb: > > Is there a solution to enable Java programmers to call functions > > written in Python? Any wrapper generator that wraps Python code into > > some Java-callable form? > > > > I briefly looked at Jython, but if I understand it right, it didn't

Re: using capicom with python

2006-07-20 Thread stéphane bard
thank's for all roger sorry to answer so late :-D Roger Upole a écrit : > "stéphane bard" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] >> Hi all, >> Has anyone ever used Python to work with Certificate Services in >> Windows? I'm trying to capicom dll with pywin32. >> >> >> I've fou

Re: Help Needed. Removing a Folder Problem(Problem Solved)

2006-07-20 Thread Steve Holden
Kilicaslan Fatih wrote: [...] > Dear All, > > I changed the mode of the files before copying them. > So the problem is solved as follows: > > SOLUTION: > > def run(self, event): > cmd_out = self.A_com() > if App.runF != "": > os.mkdir('C:\copiedFiles')

wx.ListCtrl - I do not see the inserted item

2006-07-20 Thread Laszlo Nagy
This is a ListCtrl descendant: class MegaListCtrl(wx.ListCtrl): def InsertImageStringItem(self, index, label, imageIndex): imageIndex = self.imagelists[wx.IMAGE_LIST_SMALL].GetIndexByName(imageIndex) print index,imageIndex,label,imageIndex super(MegaListCtrl,sel

Re: Depricated String Functions in Python

2006-07-20 Thread Steve Holden
Donn Cave wrote: [...] > > Oh, excellent - the string module is dead, long live > the string module! I can replace string.join with > str.join, and never have to defile my code with that > ' '.join(x) abomination. > >>> lst = ['Steve', 'Holden'] >>> str.join(' ', lst) 'Steve Holden' >>> J

Re: Using python code from Java?

2006-07-20 Thread Nick Vatamaniuc
I can't think of any project that does that. Calling stuff from Java is not easy to beging with you have to go through the native interface (JNI) anyway. I would suggest instead to create some kind of a protocol and let the applications talk using an external channel (a FIFO pipe file, a socket or

Re: Accessors in Python (getters and setters)

2006-07-20 Thread mystilleef
Bruno Desthuilliers wrote: > mystilleef wrote: > > Bruno Desthuilliers wrote: > > >>point 2 : so anyone *can* "illegimately tampering with an object's > >>internal data" at will. > >> > > > >And this is robust how? > > > > You can do just the same in Java or C++. >

ImportError: libclntsh.so.10.1: cannot open shared object file: Permission denied

2006-07-20 Thread gmax2006
Hi, I am using RedHat Linux 4. and I developed an oracle 10g based application by using cx_Oracle (cx_Oracle-4.1-10g-py23-1.i386.rpm) and Python 2.3.4. When I run the application through direct console connection, It works perfect. But, when I schedule a crontab job to run the application, It lo

Re: using names before they're defined

2006-07-20 Thread davehowey
Hiya Could you just talk me through this... is it: > schema = {'turbine1': {'class': 'Turbine', >'upstream' : ('frobnicator2',), >'downstream' : () # nothing, >}, > 'frobnicator2' : {'class' : 'Frobnicator', >

  1   2   >