Re: Howto Determine mimetype without the file name extension?

2006-07-19 Thread dwelch91
Try this: http://www.demonseed.net/~jp/code/magic.py -- http://mail.python.org/mailman/listinfo/python-list

Re: Partial classes

2006-07-19 Thread Sanjay
Hi Alex, Thanks for the input. Being new to Python, and after having selected Python in comparison to ruby (Turbogears vs Rails) , is jerks me a bit. In my openion it should be an obvious and easy to implement feature and must be, if not already have been, planned in future releases of Python. W

Re: Recursive function returning a list

2006-07-19 Thread Steve Holden
Bruno Desthuilliers wrote: > Boris Borcic a écrit : > >>Hello Bruno, >> >>Bruno Desthuilliers wrote: [...] >>>Or how to *not* address the real problem... >>> >>>Boris, using a generator may be a pretty good idea, but *not* as a way >>>to solve a problem that happens to be a FAQ !-) >>> >> >>Sorry,

Re: Iterator protocol changes, was: Coding style

2006-07-19 Thread Peter Otten
Terry Reedy wrote: > Guido has so far vetoed adding .__len__() to the iterator protocol because > a) it is not always possible and Be warned that this is a veto after the fact: # (only) python 2.4 >>> len(iter(range(42))) 42 # python 2.5 >>> len(iter(range(42))) Traceback (most recent call la

Re: question about what lamda does

2006-07-19 Thread Steve Holden
tac-tics 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 lamda is for. What would i use a lamda for that i >>could not or would not use a def for ? Is there a notable difference ? >>I only ask because i

Re: Partial classes

2006-07-19 Thread Marc 'BlackJack' Rintsch
In <[EMAIL PROTECTED]>, Sanjay wrote: > Being new to Python, and after having selected Python in comparison to > ruby (Turbogears vs Rails) , is jerks me a bit. In my openion it should > be an obvious and easy to implement feature and must be, if not already > have been, planned in future releases

Re: Partial classes

2006-07-19 Thread Dave Benjamin
On Wed, 18 Jul 2006, Sanjay wrote: > What is the equivalent in Python? Inheriting is a way, but is not > working in all scenerios. Have you tried multiple inheritance? For example: from GeneratedPerson import GeneratedPerson from HandcraftedPerson import HandcraftedPerson class Person(Generated

Text Summarization

2006-07-19 Thread Jim Jones
Is there a Python library that would allow me to take a paragraph of text, and generate a one or two sentence summary of that paragraph? -- http://mail.python.org/mailman/listinfo/python-list

Re: Accessors in Python (getters and setters)

2006-07-19 Thread Steve Holden
mystilleef wrote, making me somewhat tired of his/her repeated inability to get what's being said [sigh]: > Bruno Desthuilliers wrote: >>mystilleef wrote: >>>Bruno Desthuilliers wrote: mystilleef wrote: >Gerhard Fiedler wrote: >>On 2006-07-15 06:55:14, mystilleef wrote: >>>In very

Retrieve ext. variables in python program

2006-07-19 Thread alfa1234
Trying to convert TCL code to python. Have a property file from where I read some VAR's. Looks like this: EARPROJECT = sgs-procDist APPNAME = SGSProcedure In my TCL code I confirm the existence of the VAR = f.ex EARPROJECT by using code: if { ([info exists APPNAME] && [info exists STAGEDIR] &&

Re: No need to close file?

2006-07-19 Thread Steve Holden
[EMAIL PROTECTED] wrote: > T> Do I need to close the file in this case? Why or why not? > > T> for line in file('foo', 'r'): > T> print line > > No. The magic of reference counting. > Though of course we have to remember that not all Python implementations *use* reference counti

Fall Python training seminar in Colorado

2006-07-19 Thread lutz
Mark Lutz's Python Training Services is pleased to announce that our Fall 2006 public Colorado seminar is now open. This 5-day Python training event will be held November 6 through November 10. This year, our Fall seminar will be held at Historic Crag's Lodge, a resort in Estes Park, Colorado. E

Re: Partial classes

2006-07-19 Thread Daniel Dittmar
Sanjay wrote: > Hi All, > > Not being able to figure out how are partial classes coded in Python. > > Example: Suppose I have a code generator which generates part of a > business class, where as the custome part is to be written by me. In > ruby (or C#), I divide the code into two source files.

Re: Partial classes

2006-07-19 Thread Peter Otten
Sanjay wrote: > Hi All, > > Not being able to figure out how are partial classes coded in Python. > > Example: Suppose I have a code generator which generates part of a > business class, where as the custome part is to be written by me. In > ruby (or C#), I divide the code into two source files.

Re: Partial classes

2006-07-19 Thread Sanjay
> Can you flesh out your use case a little bit and tell why you can't solve > the problem with inheritance or a meta class? I have to study about metaclass and see whether this can be handled. It seemed inheritence is not working. PROBLEM: Separating plumbing code and business logic while using S

Re: No need to close file?

2006-07-19 Thread Gerard Flanagan
[EMAIL PROTECTED] wrote: > T wrote: > > Do I need to close the file in this case? Why or why not? > > > > for line in file('foo', 'r'): > > print line > > I was running a program in IDLE that opened a file for > reading and forgot to add the close. > > The program ran and terminated normally. >

Re: Text Summarization

2006-07-19 Thread gatti
Jim Jones wrote: > Is there a Python library that would allow me to take a paragraph of text, > and generate a one or two sentence summary of that paragraph? There is a OTS wrapper. -- http://mail.python.org/mailman/listinfo/python-list

Re: Coding style

2006-07-19 Thread Lawrence D'Oliveiro
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): >>> >>>1. While list, pop. >>> >>>2. While t

Re: Partial classes

2006-07-19 Thread Bruno Desthuilliers
Sanjay wrote: > Hi Alex, > > Thanks for the input. > > Being new to Python, and after having selected Python in comparison to > ruby (Turbogears vs Rails) , is jerks me a bit. In my openion it should > be an obvious and easy to implement feature and must be, if not already > have been, planned in

Re: Coding style

2006-07-19 Thread Georg Brandl
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): >> >> 1. While list, pop. >> >> 2. While the length of the list is greater than 0, pop. >> >> Which one makes mo

Re: Text Summarization

2006-07-19 Thread Duncan Booth
Jim Jones wrote: > Is there a Python library that would allow me to take a paragraph of > text, and generate a one or two sentence summary of that paragraph? > If you are on Windows you could use COM to stuff the text into a Word document and then use Word's autosummarize feature to generate th

Re: Getting and Setting Cookies

2006-07-19 Thread Vlad Dogaru
John J. Lee wrote: > "Vlad Dogaru" <[EMAIL PROTECTED]> writes: > > > I am trying to use cookies and Python to create a simple login example. > > But I am very disoriented at the existence of two cookie libraries, > > namely Cookie and cookielib. I have seen examples of setting cookies > [...] > >

Re: New SourceForge project: Diet Python!!!

2006-07-19 Thread Simon Hibbs
I was reading an article about the One Laptop Per Child initiative the other day, and being a Python fan I wondered if there are any plans to put Python on it, or at least make it available. A cut-down version of python, preferably with bindings to the Sugar GUI framework they are developing, would

TextCtrl focus events in wxWidgets

2006-07-19 Thread Simon Hibbs
I have a simple form with some input values and some calculated values in TextCtrl widgets. What I would like to do is have the display update automaticaly when the user changes one of the input fields, without having to click on a 'Calculate' button. I was thinking of having an update triggered w

Re: Python linker

2006-07-19 Thread Ben Sizer
Simon Brunning wrote: > So, they'll download and install the .NET framework at 23 MB, but they > won't download and install Python at 9 and half? I think the .NET framework gets thrown down via Windows Update - or at least it did for me - so that doesn't count as a 'separate download' for many pur

Re: New SourceForge project: Diet Python!!!

2006-07-19 Thread Simon Brunning
On 19 Jul 2006 02:34:09 -0700, Simon Hibbs <[EMAIL PROTECTED]> wrote: > I was reading an article about the One Laptop Per Child initiative the > other day, and being a Python fan I wondered if there are any plans to > put Python on it, or at least make it available. A cut-down version of > python,

Re: question about what lamda does

2006-07-19 Thread Iain King
Steve Holden wrote: > tac-tics 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 lamda is for. What would i use a lamda for that i > >>could not or would not use a def for ? Is there a notable di

Re: TextCtrl focus events in wxWidgets

2006-07-19 Thread Steve Holden
Simon Hibbs wrote: > I have a simple form with some input values and some calculated values > in TextCtrl widgets. > > What I would like to do is have the display update automaticaly when > the user changes one of the input fields, without having to click on a > 'Calculate' button. I was thinking

Re: Python linker

2006-07-19 Thread Ben Sizer
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 wx (all of another 4.8M) I'd guess we're > talk

Re: Coding style

2006-07-19 Thread Boris Borcic
PTY wrote: > Which is better? > > lst = [1,2,3,4,5] > > while lst: > lst.pop() > > OR > > while len(lst) > 0: > lst.pop() > allways that either-or stuff ! And why did you not consider while len(lst) : list.pop() a neat middle ground, wouldn't you say ? Cheers, BB -- 666 ?? - 666 ~ .666

Re: Partial classes

2006-07-19 Thread Kay Schluehr
Bruno Desthuilliers wrote: > Sanjay wrote: > > Hi Alex, > > > > Thanks for the input. > > > > Being new to Python, and after having selected Python in comparison to > > ruby (Turbogears vs Rails) , is jerks me a bit. In my openion it should > > be an obvious and easy to implement feature and must

Re: New SourceForge project: Diet Python!!!

2006-07-19 Thread Stefan Behnel
Simon Brunning wrote: > On 19 Jul 2006 02:34:09 -0700, Simon Hibbs <[EMAIL PROTECTED]> wrote: >> I was reading an article about the One Laptop Per Child initiative the >> other day, and being a Python fan I wondered if there are any plans to >> put Python on it, or at least make it available. A cut

Re: Coding style

2006-07-19 Thread Boris Borcic
Bruno Desthuilliers wrote: > > empty_list = [] > bool(empty_list) is False > => True it's just a pity that the symmetric expression list(False) is [] doesn't hold. I guess the problem is that if list(False) was thus defined, it would be difficult not to define list(True). And then the zen of

Re: Compiling Python using the Portland Group compiler

2006-07-19 Thread Konrad Hinsen
On Jul 12, 2006, at 15:57, Konrad Hinsen wrote: > I am trying to install Python 2.4.3 on an AMD Opteron system using > the Portland Group's compiler (pgcc). Using > > CC="pgcc -DNCURSES_ENABLE_STDBOOL_H=0" OPT="-O0" LINKFORSHARED="-Wl,- > export-dynamic" ./configure --without-cxx > > I finally man

text representation of HTML

2006-07-19 Thread Ksenia Marasanova
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 email, and would prefer to do it automatically from HTML source. Any hints? Tha

Re: need help getting xml feed from a url

2006-07-19 Thread Stefan Behnel
Shan wrote: > If i have a list of urls how can I extract or pull their respective xml > feeds? from lxml import etree feeds = [] for url in my_url_list: feeds.append( etree.parse(url) ) For the rest, find out about the ElementTree API. Stefan -- http://mail.python.org/mailma

Re: TextCtrl focus events in wxWidgets

2006-07-19 Thread Simon Hibbs
Steve Holden wrote: > It should be quite simple: you need to handle EVT_SET_FOCUS and/or > EVT_KILL_FOCUS events (documented in the wxPython docs) to know when to > recaclulate the values. Sounds like that should be enough of a hint to you. I've tried that, but it doesn't work. Here is the test

Re: text representation of HTML

2006-07-19 Thread Diez B. Roggisch
Ksenia Marasanova 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 email, and would prefe

Re: Dispatch with multiple inheritance

2006-07-19 Thread looping
looping wrote: > Michael J. Fromberger wrote: > > > > Is there a better (i.e., more elegant) way to handle the case marked > > (**) above? > > > > You have to call super in each method __init__, if you don't, the call > chain break before the end: > > class A (object): > def __init__(self): >

Re: Coding style

2006-07-19 Thread Christophe
Patrick Maupin a écrit : > The perverse wish, expressed in the specific example, that SOME piece > of code SOMEWHERE should PLEASE throw an exception because some idiot > passed a generator expression rather than a list into a function, is > not apt to be well received by an audience which strives

Regular expression issue

2006-07-19 Thread dmbkiwi
I'm trying to parse a line of html as follows: 101.120:( KPA (-) Snow on Ground)0 however, sometimes it looks like this: N/A Snow on Ground)0 I want to get either the numerical value 101.120 (which could be a different number depending on the data that's been fed into the page, or in terms o

Re: Retrieve ext. variables in python program

2006-07-19 Thread bearophileHUGS
alfa1234: > Does anyone know and equalent way to confirm a Variable from the same > property file using PYTHON code ??? Using globals(), locals(), and dir() you can find if your name exists already. Bye, bearophile -- http://mail.python.org/mailman/listinfo/python-list

Re: Augument assignment versus regular assignment

2006-07-19 Thread Antoon Pardon
On 2006-07-18, Terry Reedy <[EMAIL PROTECTED]> wrote: > > "Antoon Pardon" <[EMAIL PROTECTED]> wrote in message > news:[EMAIL PROTECTED] >> On 2006-07-17, Terry Reedy <[EMAIL PROTECTED]> wrote: >>> Or, whether docs (and reasonable interpretation thereof) and >>> implementation match, which I claim

Re: TextCtrl focus events in wxWidgets

2006-07-19 Thread rony steelandt
Since the event handler of a textctrl inherits from wxCommandEvent, I would guess that the binding should be to EVT_COMMAND_KILL_FOCUS Not tested... Rony Le Wed, 19 Jul 2006 03:15:36 -0700, Simon Hibbs a écrit : > > Steve Holden wrote: > >> It should be quite simple: you need to handle EVT

Re: TextCtrl focus events in wxWidgets

2006-07-19 Thread Simon Hibbs
rony steelandt wrote: > Since the event handler of a textctrl inherits from wxCommandEvent, > I would guess that the binding should be to EVT_COMMAND_KILL_FOCUS Still not working :( Simon -- http://mail.python.org/mailman/listinfo/python-list

Re: Partial classes

2006-07-19 Thread [EMAIL PROTECTED]
Sanjay wrote: > Hi All, > > Not being able to figure out how are partial classes coded in Python. > > Example: Suppose I have a code generator which generates part of a > business class, where as the custome part is to be written by me. In > ruby (or C#), I divide the code into two source files. Li

Re: Coding style

2006-07-19 Thread Marc 'BlackJack' Rintsch
In <[EMAIL PROTECTED]>, Boris Borcic wrote: > Bruno Desthuilliers wrote: >> >> empty_list = [] >> bool(empty_list) is False >> => True > > it's just a pity that the symmetric expression > > list(False) is [] > > doesn't hold. You want the empty list to be a singleton!? And I don't find `list

Re: TextCtrl focus events in wxWidgets

2006-07-19 Thread Simon Hibbs
Simon Hibbs wrote: > rony steelandt wrote: > > Since the event handler of a textctrl inherits from wxCommandEvent, > > I would guess that the binding should be to EVT_COMMAND_KILL_FOCUS > > Still not working :( I can trap EVT_TEXT_ENTER events successfuly, without using EVT_COMMAND_ENTER. This al

Re: Regular expression issue

2006-07-19 Thread Marc 'BlackJack' Rintsch
In <[EMAIL PROTECTED]>, dmbkiwi wrote: > I'm trying to parse a line of html as follows: > > 101.120:( KPA (-) > Snow on Ground)0 > > however, sometimes it looks like this: > > N/A > Snow on Ground)0 > > > I want to get either the numerical value 101.120 (which could be a > different number

Re: Coding style

2006-07-19 Thread Ant
Christophe wrote: > ... you haven't beed using enouth generator expressions ... You should get yourself to the doctors about that cold dude. :-) -- http://mail.python.org/mailman/listinfo/python-list

Simple file writing techiques ...

2006-07-19 Thread cdecarlo
Hello, I've often found that I am writing little scripts at the interpretor to read a text file, perform some conversion, and then write the converted data back out to a file. I normally accomplish the above task by reading the lines of the entire file into a list, preforming some function to that

Re: TextCtrl focus events in wxWidgets

2006-07-19 Thread Frank Millman
Simon Hibbs wrote: > Steve Holden wrote: > > > It should be quite simple: you need to handle EVT_SET_FOCUS and/or > > EVT_KILL_FOCUS events (documented in the wxPython docs) to know when to > > recaclulate the values. Sounds like that should be enough of a hint to you. > > I've tried that, but it

Re: Coding style

2006-07-19 Thread Boris Borcic
Marc 'BlackJack' Rintsch wrote: > In <[EMAIL PROTECTED]>, Boris Borcic wrote: > >> Bruno Desthuilliers wrote: >>> empty_list = [] >>> bool(empty_list) is False >>> => True >> it's just a pity that the symmetric expression >> >> list(False) is [] >> >> doesn't hold. > > You want the empty list to

Re: TextCtrl focus events in wxWidgets

2006-07-19 Thread Steve Holden
Simon Hibbs wrote: > Steve Holden wrote: > > >>It should be quite simple: you need to handle EVT_SET_FOCUS and/or >>EVT_KILL_FOCUS events (documented in the wxPython docs) to know when to >>recaclulate the values. Sounds like that should be enough of a hint to you. > > > I've tried that, but it

Re: Partial classes

2006-07-19 Thread Bruno Desthuilliers
Kay Schluehr wrote: > Bruno Desthuilliers wrote: > >>Sanjay wrote: >> >>>Hi Alex, >>> >>>Thanks for the input. >>> >>>Being new to Python, and after having selected Python in comparison to >>>ruby (Turbogears vs Rails) , is jerks me a bit. In my openion it should >>>be an obvious and easy to imple

Re: Partial classes

2006-07-19 Thread Sanjay
Thanks for the code showing how to implement partial classes. Infact, I was searching for this code pattern. I will have a study on metaclass and then try it. Thanks Sanjay -- http://mail.python.org/mailman/listinfo/python-list

Re: Capturing instant messages

2006-07-19 Thread Ed Leafe
On Jul 18, 2006, at 3:17 PM, Yu-Xi Lim wrote: > This is going to be quite off-topic. But helpful nonetheless. > I'm not entirely familiar with SOX regulations. Is it necessary to > capture it at the gateway? I'm no lawyer either, so I probably know as much about this as you do

Re: Partial classes

2006-07-19 Thread Kay Schluehr
[EMAIL PROTECTED] wrote: > Sanjay wrote: > > Hi All, > > > > Not being able to figure out how are partial classes coded in Python. > > > > Example: Suppose I have a code generator which generates part of a > > business class, where as the custome part is to be written by me. In > > ruby (or C#), I

Re: TextCtrl focus events in wxWidgets

2006-07-19 Thread Simon Hibbs
Frank Millman wrote: > Try self.PlantCtrl.Bind(wx.EVT_KILL_FOCUS, self.OnUpdatePlantCtrl) And Voila! It works. Many, many thanks. Any idea what is going on? Simon -- http://mail.python.org/mailman/listinfo/python-list

Re: Simple file writing techiques ...

2006-07-19 Thread Will McGugan
cdecarlo wrote: > > fout = open('somefile','w') > for line in convertedData: > fout.write("%s\n" % line) > fout.close() > > -- or -- > > fout = open('somefile','w') > fout.write("%s" % '\n'.join(convertedData)) > fout.close() > I'd go for something like... fout = open('somefile','w') fout.wri

Project organisation

2006-07-19 Thread rony steelandt
Imagine I have x projects and they all use util.py What would be the best way to organise this 1. c --\project1\*.py | |-\project2\*.py | --\globals\util.py This organisation has the problem that if I have to modify something to util.py that I need in project2, I'll have to retest projec

Re: TextCtrl focus events in wxWidgets

2006-07-19 Thread David Hughes
Simon Hibbs wrote: > Frank Millman wrote: > > > Try self.PlantCtrl.Bind(wx.EVT_KILL_FOCUS, self.OnUpdatePlantCtrl) > > And Voila! It works. Many, many thanks. > > Any idea what is going on? AIUI, wx.EVT_KILL_FOCUS is not a Command Event i.e. it doesn't propagate up the hierarchy of widgets until i

Re: Project organisation

2006-07-19 Thread Steve Holden
rony steelandt wrote: > Imagine I have x projects and they all use util.py > > What would be the best way to organise this > > 1. > c --\project1\*.py > | > |-\project2\*.py > | > --\globals\util.py > > This organisation has the problem that if I have to modify something to > util.py tha

Re: TextCtrl focus events in wxWidgets

2006-07-19 Thread Peter Decker
On 19 Jul 2006 04:55:24 -0700, Simon Hibbs <[EMAIL PROTECTED]> wrote: > > Frank Millman wrote: > > > Try self.PlantCtrl.Bind(wx.EVT_KILL_FOCUS, self.OnUpdatePlantCtrl) > > And Voila! It works. Many, many thanks. > > Any idea what is going on? Your first attempt used self.Bind, which binds the kill

Re: Simple file writing techiques ...

2006-07-19 Thread Ant
> fout = open('somefile','w') > for line in convertedData: > fout.write("%s\n" % line) > fout.close() > > -- or -- > > fout = open('somefile','w') > fout.write("%s" % '\n'.join(convertedData)) > fout.close() I shouldn't think it matters too much which of these you use - time them and see what h

Using super()

2006-07-19 Thread Pupeno
Hello, I have a class called MyConfig, it is based on Python's ConfigParser.ConfigParser. It implements add_section(self, section), which is also implemented on ConfigParser.ConfigParser, which I want to call. So, reducing the problem to the bare minimum, the class (with a useless add_section that

Re: text representation of HTML

2006-07-19 Thread Laurent Rahuel
Hi, I guess stripogram would be more pythonic : http://sourceforge.net/project/showfiles.php?group_id=1083 Regards, Laurent Diez B. Roggisch wrote: > Ksenia Marasanova wrote: > >> Hi, >> >> I am looking for a library that will give me very simple text >> representation of HTML. >> For exampl

Re: Simple file writing techiques ...

2006-07-19 Thread Ganesan Rajagopal
> cdecarlo <[EMAIL PROTECTED]> writes: > fout = open('somefile','w') > for line in convertedData: > fout.write("%s\n" % line) > fout.close() > -- or -- > fout = open('somefile','w') > fout.write("%s" % '\n'.join(convertedData)) > fout.close() > ... or maybe some hybrid of the two which

Re: Simple file writing techiques ...

2006-07-19 Thread Ant
Whoops: > outfile = open(out_f) outfile = open(out_f, 'w') may be better ;-) -- http://mail.python.org/mailman/listinfo/python-list

Re: Partial classes

2006-07-19 Thread [EMAIL PROTECTED]
Kay Schluehr wrote: > This definition lacks a check for disjointness of the parts. No two > partial classes shall contain a method with the same name. Yes - I mentioned at the bottom that the last one evaluated will overwrite any existing one. You're right that its probably a better idea to che

Re: Coding style

2006-07-19 Thread Antoon Pardon
On 2006-07-19, Georg Brandl <[EMAIL PROTECTED]> 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): >>> >>> 1. While list, pop. >>> >>> 2. While the len

Re: Recursive function returning a list

2006-07-19 Thread Boris Borcic
Bruno Desthuilliers wrote: > Boris Borcic a écrit : >> Hello Bruno, >> >> Bruno Desthuilliers wrote: >> >>> Boris Borcic wrote: >>> > Do you have any ideas? you could use a recursive generator, like def genAllChildren(self) : for child in self.children :

Re: Using super()

2006-07-19 Thread Laszlo Nagy
Pupeno írta: > Hello, > I have a class called MyConfig, it is based on Python's > ConfigParser.ConfigParser. > It implements add_section(self, section), which is also implemented on > ConfigParser.ConfigParser, which I want to call. > So, reducing the problem to the bare minimum, the class (with a

Re: TextCtrl focus events in wxWidgets

2006-07-19 Thread Frank Millman
Simon Hibbs wrote: > Frank Millman wrote: > > > Try self.PlantCtrl.Bind(wx.EVT_KILL_FOCUS, self.OnUpdatePlantCtrl) > > And Voila! It works. Many, many thanks. > My pleasure > Any idea what is going on? I only understand it in simple terms, though it can get complex. Here is my simple explanatio

problem in Trying to include new address family in socketmodule.c

2006-07-19 Thread viktough
i am trying to include a new Address family (PF_CAN) in the extension module of socket - socketmodule.c... At first i am just trying to create a socket. When I use s=socket.socket(socket.AF_INET, socket.SOCK_STREAM), a socket is created at a address but s=socket.socket(socket.PF_CAN, socket.SOCK_RA

Converting a web to pdf or ..‍

2006-07-19 Thread Bayazee
Hi , I have a web site and i want to write a perogram with python that my users can convert custom web page of site to pdf (or other type :jpeg, doc,odt,or...) and download it . i dont want only convert text . it is be very good to i can don it for both text and images ... similar to web page ... c

Re: Accessors in Python (getters and setters)

2006-07-19 Thread Diez B. Roggisch
>> Then why do you advise "(making) all attributes of a class >> private/protected" and systematically using properties ? >> > > Because you don't want third parties illegimately tampering with an > object's internal data and thus crashing your system? Ah, you mean like in JAVA where the compiler

Re: Accessors in Python (getters and setters)

2006-07-19 Thread Diez B. Roggisch
>> What I'm saying here is that it's totally useless to duplicate default >> behaviour. >> > > And who's doing that? Somebody who uses setters that only set a property? Diez -- http://mail.python.org/mailman/listinfo/python-list

Re: Project organisation

2006-07-19 Thread Magnus Lycka
rony steelandt wrote: > Imagine I have x projects and they all use util.py > > What would be the best way to organise this > > 1. > c --\project1\*.py > | > |-\project2\*.py > | > --\globals\util.py > > This organisation has the problem that if I have to modify something to > util.py tha

Re: Track keyboard and mouse usage

2006-07-19 Thread Diez B. Roggisch
Lars wrote: > Diez B. Roggisch wrote: >> will make the devices world readable. While I haven't thought about any >> security implications that might have (and am not especially >> knowledgeable in such things to be honest), I'm convinced it is way less >> likely to introduce any exploitable holes

Re: Using super()

2006-07-19 Thread Pupeno
Laszlo Nagy wrote: > Pupeno írta: >> Hello, >> I have a class called MyConfig, it is based on Python's >> ConfigParser.ConfigParser. >> It implements add_section(self, section), which is also implemented on >> ConfigParser.ConfigParser, which I want to call. >> So, reducing the problem to the bare

Re: Using super()

2006-07-19 Thread Laszlo Nagy
> I see, thank you. > > class MyConfig(ConfigParser, object): > def add_section(self, section) > super(MyConfig, self).add_section(section) > > seems to work and as expected. Is there anything wrong with it ? > I have never seen this before. :) I don't know the answer, but I'm int

Re: Augument assignment versus regular assignment

2006-07-19 Thread Boris Borcic
Antoon Pardon wrote: > The language reference doesn't talk about objects. And IMO you > should be carefull if you want to use the word "object" here. > In the line: "foo += 1", you can't talk about the object foo, > since foo will possibly > be bound to a different object after the assignment >

Re: TextCtrl focus events in wxWidgets

2006-07-19 Thread Frank Millman
David Hughes wrote: > > AIUI, wx.EVT_KILL_FOCUS is not a Command Event i.e. it doesn't > propagate up the hierarchy of widgets until it gets handled, so it has > to be bound explicitly to the control itself, as above. > Right. This is one of the sources of confusion with events - which ones 'pro

Re: CSV with comments

2006-07-19 Thread Sion Arrowsmith
Daniel Dittmar <[EMAIL PROTECTED]> wrote: > if line [:1] == '#': What's wrong with line[0] == '#' ? (For one thing, it's fractionally faster than [:1].) -- \S -- [EMAIL PROTECTED] -- http://www.chaos.org.uk/~sion/ ___ | "Frankly I have no feelings towards penguins one way or the oth

access to submodules

2006-07-19 Thread TG
hi. This is my first try on modules. I've got : tom/ __init__.py core.py ui.py data.py then, when I'm in my ipython shell : ?> from tom import * this works, it loads core, ui and data but when I do this : ?> import tom ?> tom.core AttributeError: 'module' object has no att

Re: Project organisation

2006-07-19 Thread Phil Thompson
On Wednesday 19 July 2006 3:12 pm, rony steelandt wrote: > Imagine I have x projects and they all use util.py > > What would be the best way to organise this > > 1. > c --\project1\*.py > > |-\project2\*.py > > --\globals\util.py > > This organisation has the problem that if I have to modify so

Re: access to submodules

2006-07-19 Thread TG
I've just found this : If I add : "import core, data, ui" inside my "tom/__init__.py" file, it will work. But this line does not seems to exist in other files (after having a look at several files inside /usr/lib/python2.4). -- http://mail.python.org/mailman/listinfo/python-list

Re: Retrieve ext. variables in python program

2006-07-19 Thread alfa1234
[EMAIL PROTECTED] skrev: > alfa1234: > > Does anyone know and equalent way to confirm a Variable from the same > > property file using PYTHON code ??? > > Using globals(), locals(), and dir() you can find if your name exists > already. > > Bye, > bearophile Hi bearophile !! Thanks for the answer

Re: Project organisation

2006-07-19 Thread Harry George
rony steelandt <[EMAIL PROTECTED]> writes: > Imagine I have x projects and they all use util.py > > What would be the best way to organise this > > 1. > c --\project1\*.py > | > |-\project2\*.py > | > --\globals\util.py > > This organisation has the problem that if I have to modify some

Re: CSV with comments

2006-07-19 Thread Duncan Booth
Sion Arrowsmith wrote: > Daniel Dittmar <[EMAIL PROTECTED]> wrote: >> if line [:1] == '#': > > What's wrong with line[0] == '#' ? (For one thing, it's fractionally > faster than [:1].) > line[0] assumes that the line isn't blank. If the input iterator is a file then that will hold true

Re: CSV with comments

2006-07-19 Thread Steve Holden
Sion Arrowsmith wrote: > Daniel Dittmar <[EMAIL PROTECTED]> wrote: > >>if line [:1] == '#': > > > What's wrong with line[0] == '#' ? (For one thing, it's fractionally > faster than [:1].) > > For that matter, what's wrong with line.startswith('#') which expresses the intent rat

Re: Coding style

2006-07-19 Thread Marc 'BlackJack' Rintsch
In <[EMAIL PROTECTED]>, Boris Borcic wrote: >> And I don't find `list(False)` to return an empty list be very obvious. > > What would be your choice ? ``list()`` or ``[]`` for empty lists and a `TypeError` for ``list(False)``. Just like it is right now. Ciao, Marc 'BlackJack' Rintsch --

mysqldb problem

2006-07-19 Thread liupei
when I set mysql some fields collate utf8_bin, and then fetch these fields is array.array,not the string I expected -- http://mail.python.org/mailman/listinfo/python-list

Re: Partial classes

2006-07-19 Thread John Salerno
Marc 'BlackJack' Rintsch wrote: > Can you flesh out your use case a little bit and tell why you can't solve > the problem with inheritance or a meta class? From my experience with C#, the only real use for partial classes is when you want to separate your GUI code from the rest of your logic. B

Re: access to submodules

2006-07-19 Thread BartlebyScrivener
>> > from tom import * You CAN do this, but it's a bad habit. Try: >>import tom Then call by tom.function() rd -- http://mail.python.org/mailman/listinfo/python-list

Re: Project organisation

2006-07-19 Thread rony steelandt
Le Wed, 19 Jul 2006 14:31:06 +0100, Phil Thompson a écrit : > On Wednesday 19 July 2006 3:12 pm, rony steelandt wrote: >> Imagine I have x projects and they all use util.py >> >> What would be the best way to organise this >> >> 1. >> c --\project1\*.py >> >> |-\project2\*.py >> >> --\globals\

Number combinations

2006-07-19 Thread placid
Hi all, Just wondering if there is a better way of generating a 4 digit number (that gets converted to a string), ive got the following code which generates strings between -. for a in range(0,10): for b in range(0,10): for c in range(0,10): for d in range(0,10):

Re: Simple file writing techiques ...

2006-07-19 Thread BartlebyScrivener
See also this recent discussion on techniques for making sure you get the file closed, even if there is an exception. http://tinyurl.com/fryrv rd -- http://mail.python.org/mailman/listinfo/python-list

Re: access to submodules

2006-07-19 Thread TG
I know this is a bad habit ... I was just doing it to show what is disturbing me. Obviously the "star" syntax finds the submodules because they are loaded, but when I properly load the module alone with "import tom", the "dot" syntax does not find "tom.core". BartlebyScrivener wrote: > >> > from

  1   2   3   >