Re: Confusion with calling function of a subclass

2006-12-22 Thread Fredrik Lundh
Pyenos wrote: > class TREE: > def gettree(self):print self > TREE.gettree() # I get an error saying ># TypeError: unbound method gettree() must be called ># with TREE instance as first argument (got nothing instead > > I still don't understand how to solve thi

Re: def index(self):

2006-12-22 Thread Fredrik Lundh
Marc 'BlackJack' Rintsch wrote: > This depends on the definition of `expr`. If `expr` includes the > possibility of enclosing parenthesis then yes. There are scenarios where > you would need them. For example if you use objects that overload > operators to build a callable used as decorator: >

Re: Confusion with calling function of a subclass

2006-12-22 Thread Pyenos
Adonis Vargas <[EMAIL PROTECTED]> writes: > Pyenos wrote: > > class TREE: > > def gettree(self):print self > > TREE.gettree() # I get an error saying# TypeError: > > unbound method gettree() must be called > ># with TREE instance as first argument (got nothing i

Re: tkFileDialog closes main application

2006-12-22 Thread Eric Brunel
On Thu, 21 Dec 2006 22:37:37 +0100, James Stroud <[EMAIL PROTECTED]> wrote: > Eric Brunel wrote: >> BTW, why do you create a sub-class of Frame for your application? Why >> not create a sub-class of Tk instead? >> > > The short answer is that inhereting from Frame will allow embedding of >

Re: def index(self):

2006-12-22 Thread Duncan Booth
"Gert Cuykens" <[EMAIL PROTECTED]> wrote: > On 21 Dec 2006 09:44:48 GMT, Duncan Booth > <[EMAIL PROTECTED]> wrote: >> "George Sakkis" <[EMAIL PROTECTED]> wrote: >> >> @expr >> def fn(...): ... >> >> is exactly equivalent to: >> >> def fn(...): ... >> fn = (expr)(fn) >> > > ok i did my homework r

Re: urllib.unquote and unicode

2006-12-22 Thread Duncan Booth
"Martin v. Löwis" <[EMAIL PROTECTED]> wrote: The way that uri encoding is supposed to work is that first the input string in unicode is encoded to UTF-8 and then each byte which is not in the permitted range for characters is encoded as % followed by two hex characters. >>> Ca

Re: Decorator for Enforcing Argument Types

2006-12-22 Thread Duncan Booth
"John Machin" <[EMAIL PROTECTED]> wrote: >> > if isinstance( >> > action_for_type1(... >> > # big snip >> > elif isinstance(... >> > action_typeN( ... >> > # no else statement >> >> Ouch.. someone must have skipped his/her OO class... > > Quite possibly :-) but that's not the problem

Re: Script Error

2006-12-22 Thread Justin Ezequiel
ie.Navigate ('URL') ie.SetTextBox(username,'txtUserId',0) not sure but shouldn't you be waiting for navigate to actually finish loading the page before setting fields? see the ie.Busy or ie.readyState properties/methods -- http://mail.python.org/mailman/listinfo/python-list

Re: Decorator for Enforcing Argument Types

2006-12-22 Thread John Machin
Duncan Booth wrote: > "John Machin" <[EMAIL PROTECTED]> wrote: > > >> > if isinstance( > >> > action_for_type1(... > >> > # big snip > >> > elif isinstance(... > >> > action_typeN( ... > >> > # no else statement > >> > >> Ouch.. someone must have skipped his/her OO class... > > > > Qui

Re: python-hosting.com projects: dead?

2006-12-22 Thread BJörn Lindqvist
On 12/20/06, greg <[EMAIL PROTECTED]> wrote: > Richard Jones wrote: > > > Actually, to clarify the DEFAULT configuration for Trac is to leave it open > > to spam. > > That sounds like a really bad choice of default. > > A bit like the way Windows comes with all the > "let anyone in the world send m

Re: Decorator for Enforcing Argument Types

2006-12-22 Thread Bruno Desthuilliers
George Sakkis a écrit : > John Machin wrote: > >>Bruno Desthuilliers wrote: >> >> >>> >>>Python is dynamic, and fighting against the language is IMHO a really >>>bad idea. The only places where theres a real need for this kind of >>>stuff are when dealing with the "outside world" (IOW : inputs and

Re: Decorator for Enforcing Argument Types

2006-12-22 Thread Duncan Booth
"John Machin" <[EMAIL PROTECTED]> wrote: > You are saying that you think that George thinks that they are > teaching efficient coding methods in OO classes?? > No, but I hope they teach how to recognise patterns, and I imagine they also teach something about refactoring to remove switches or long

Re: Regexp Neg. set of chars HowTo?

2006-12-22 Thread durumdara
Hi! Thanks for this! I'll use that! I found a solution my question in regexp way too: import re testtext = " minion battalion nation dion sion wion alion" m = re.compile("[^t^l]ion") print m.findall(testtext) I search for all text that not lion and tion. dd Paul McGuire wrote: > It looks like

Re: Decorator for Enforcing Argument Types

2006-12-22 Thread John Machin
Duncan Booth wrote: > "John Machin" <[EMAIL PROTECTED]> wrote: > > You are saying that you think that George thinks that they are > > teaching efficient coding methods in OO classes?? > > > No, but I hope they teach how to recognise patterns, and I imagine they > also teach something about refacto

Re: Regexp Neg. set of chars HowTo?

2006-12-22 Thread Marc 'BlackJack' Rintsch
In <[EMAIL PROTECTED]>, durumdara wrote: > I found a solution my question in regexp way too: > import re > testtext = " minion battalion nation dion sion wion alion" > m = re.compile("[^t^l]ion") > print m.findall(testtext) > > I search for all text that not lion and tion. And ^ion. The first ^

optparser question

2006-12-22 Thread Michele Petrazzo
I'm trying optparse and I see a strange (for me) behavior: def store_value(option, opt_str, value, parser): setattr(parser.values, option.dest, value) parser = optparse.OptionParser() parser.add_option("-f", "--foo", action="callback", callback=store_value,

Re: Decorator for Enforcing Argument Types

2006-12-22 Thread Duncan Booth
"John Machin" <[EMAIL PROTECTED]> wrote: > > Duncan Booth wrote: >> "John Machin" <[EMAIL PROTECTED]> wrote: >> > You are saying that you think that George thinks that they are >> > teaching efficient coding methods in OO classes?? >> > >> No, but I hope they teach how to recognise patterns, and

Confusion over calling a nested function inside a parent function

2006-12-22 Thread Pyenos
[code] class WORK: def getwork(self): def choosetable(self):pass choosetable() #TypeError: choosetable() takes exactly 1 #argument (0 given) [/code] Calling choosetable() at the above location gives me the error described above. -- http://mail.python.o

Re: Confusion over calling a nested function inside a parent function

2006-12-22 Thread MacDonald
Pyenos wrote: > [code] > class WORK: > def getwork(self): > def choosetable(self):pass > choosetable() #TypeError: choosetable() takes exactly 1 > #argument (0 given) > [/code] > > Calling choosetable() at the above location gives me the error > described

Re: Script Error

2006-12-22 Thread Pyenos
"Forced_Ambitions" <[EMAIL PROTECTED]> writes: > Guys any suggestions ? > > Could it be because of a MS patch or something as i believe i had some > patching on the windows box i was running this script on. > > > Forced_Ambitions wrote: > > > Hi Guys, > > > > I am facing a problem with a scrip

Re: Confusion over calling a nested function inside a parent function

2006-12-22 Thread Duncan Booth
Pyenos <[EMAIL PROTECTED]> wrote: > [code] > class WORK: > def getwork(self): > def choosetable(self):pass > choosetable() #TypeError: choosetable() takes exactly 1 > #argument (0 given) > [/code] > > Calling choosetable() at the above location gives me t

add encoding to standard encodings works different in python 2.5?

2006-12-22 Thread henk-jan ebbers
Greetings, I use an encoding that is not available in the std python-encodings, say encoding 'flup'; under different circumstances a user might wish different version of 'flup': a strict one or a more relaxed encoding. (yes I know, this is terrible, but this is how it is) in python2.4, I manag

Re: Confusion over calling a nested function inside a parent function

2006-12-22 Thread Pyenos
"MacDonald" <[EMAIL PROTECTED]> writes: > Pyenos wrote: > > [code] > > class WORK: > > def getwork(self): > > def choosetable(self):pass > > choosetable() #TypeError: choosetable() takes exactly 1 > > #argument (0 given) > > [/code] > > > > Calling chooset

Generating all permutations from a regexp

2006-12-22 Thread BJörn Lindqvist
With regexps you can search for strings matching it. For example, given the regexp: "foobar\d\d\d". "foobar123" would match. I want to do the reverse, from a regexp generate all strings that could match it. The regexp: "[A-Z]{3}\d{3}" should generate the strings "AAA000", "AAA001", "AAA002" ... "A

Re: are there Tomboy and F-Spot equivalents?

2006-12-22 Thread BJörn Lindqvist
On 12/21/06, Tshepang Lekhonkhobe <[EMAIL PROTECTED]> wrote: > Hi, > I dislike installing the entire Mono stack simply to take notes and > manage photos, and am totally biased towards Python. At least for > search I got Tracker, instead of Beagle. > Are there equvalents applications for Tomboy and

Re: Windows upgrade incomplete

2006-12-22 Thread Colin J. Williams
Pete Forman wrote: > I've a few versions of Python on my XP PC, most recently Python 2.5. > The file associations appear not to have been upgraded. Executing a > .py file turned out to still be using 2.3. > >> assoc .py > .py=Python.File > >> ftype Python.file > Python.file=D:\PROGRA~1\Python23\

Re: query

2006-12-22 Thread Colin J. Williams
Fredrik Lundh wrote: > [EMAIL PROTECTED] wrote: > >> can anyone help me on indentation in python and tell me some nice text >> editors used for a beginner in python? > > http://effbot.org/pyfaq/tutor-whats-the-best-editor-ide-for-python > > > In Windows, I like PyScripter. Colin W. -- http:

Re: urllib.unquote and unicode

2006-12-22 Thread Martin v. Löwis
Duncan Booth schrieb: > So you believe that because something is only recommended by a standard > Python should refuse to implement it? Yes. In the face of ambiguity, refuse the temptation to guess. This is *deeply* ambiguous; people have been using all kinds of encodings in http URLs. > You do

PyExcelerator: how to set colours?

2006-12-22 Thread Gerry
I'd like some cell to be a Blue "ABCDE". Here's come code thatv tries various values for pattern_for_colour and font.colour_index, to no avail. Can anyone suggest the right way to set colours? Thanks! Gerry == from pyExcelerator import * w = Workbook() ws = w.a

Re: optparser question

2006-12-22 Thread Steven Bethard
Michele Petrazzo wrote: > I'm trying optparse and I see a strange (for me) behavior: > > def store_value(option, opt_str, value, parser): > setattr(parser.values, option.dest, value) > > parser = optparse.OptionParser() > parser.add_option("-f", "--foo", > action="callback",

Re: add encoding to standard encodings works different in python 2.5?

2006-12-22 Thread Martin v. Löwis
henk-jan ebbers schrieb: > - how can i get this to work in 2.5 (nice if it would work in both 2.4 > and 2.5) You should implement a lookup function, and register it with codecs.register. Then you can structure your modules any way you like. Regards, Martin -- http://mail.python.org/mailman/lis

Re: One module per class, bad idea?

2006-12-22 Thread Kent Johnson
Carl Banks wrote: > Now, I think this is the best way to use modules, but you don't need to > use modules to do get higher-level organization; you could use packages > instead. It's a pain if you're working on two different classes in the > same system you have to keep switching files; but I guess

Re: python-hosting.com projects: dead?

2006-12-22 Thread Terry Reedy
"BJörn Lindqvist" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] >. It is Webfactions own fault that they haven't been able >to shield themself from spam by changing Trac's default to something >more restrictive. To me, this is a bit too much 'blame the victim'. The fault lies with

Re: Generating all permutations from a regexp

2006-12-22 Thread Fredrik Lundh
BJörn Lindqvist wrote: > With regexps you can search for strings matching it. For example, > given the regexp: "foobar\d\d\d". "foobar123" would match. I want to > do the reverse, from a regexp generate all strings that could match > it. > > The regexp: "[A-Z]{3}\d{3}" should generate the strings

Re: def index(self):

2006-12-22 Thread Gert Cuykens
Ok thx i think i understand it now >>> class C: ... @staticmethod ... def fn(): ... return 'whohoo' ... >>> C.fn() 'whohoo' >>> -- http://mail.python.org/mailman/listinfo/python-list

Re: python-hosting.com projects: dead?

2006-12-22 Thread skip
>> . It is Webfactions own fault that they haven't been able to shield >> themself from spam by changing Trac's default to something more >> restrictive. Terry> To me, this is a bit too much 'blame the victim'. The fault lies Terry> with spammers who are willing to exploit to

Re: rsync for python?

2006-12-22 Thread Caleb Hattingh
> I want to build rsync server that can run in linux and windows, and > configure by python. So I'm looking for something like rsync for python. > I find rsync.py and pysync. But rsync.py looks like a client mode, > it can't be a rsync server, is it? Can pysync be a rsync server? Hi nienfe

Re: How a script can know if it has been called with the -i command line option?

2006-12-22 Thread Peter Wang
Michele Simionato wrote: > The subject says it all, I would like a script to act differently when > called as > $ python script.py and when called as $ python -i script.py. I looked > at the sys module > but I don't see a way to retrieve the command line flags, where should > I look? I realize th

Re: How a script can know if it has been called with the -i command line option?

2006-12-22 Thread Michael B. Trausch
Peter Wang wrote: > Michele Simionato wrote: >> The subject says it all, I would like a script to act differently when >> called as >> $ python script.py and when called as $ python -i script.py. I looked >> at the sys module >> but I don't see a way to retrieve the command line flags, where should

Re: Decorator for Enforcing Argument Types

2006-12-22 Thread Peter Wang
Bruno Desthuilliers wrote: > > Python is dynamic, and fighting against the language is IMHO a really > bad idea. The only places where theres a real need for this kind of > stuff are when dealing with the "outside world" (IOW : inputs and > outputs). And then packages like formencode can do much m

Re: Decorator for Enforcing Argument Types

2006-12-22 Thread George Sakkis
Duncan Booth wrote: > "John Machin" <[EMAIL PROTECTED]> wrote: > > >> > if isinstance( > >> > action_for_type1(... > >> > # big snip > >> > elif isinstance(... > >> > action_typeN( ... > >> > # no else statement > >> > >> Ouch.. someone must have skipped his/her OO class... > > > > Qui

Re: How a script can know if it has been called with the -i command line option?

2006-12-22 Thread Tim Golden
> > Michele Simionato wrote: > >> The subject says it all, I would like a script to act differently when > >> called as > >> $ python script.py and when called as $ python -i script.py. [Michael B. Trausch] > There is a set of utilities that have UNIX-like ps behavior, but, as is > typical for Win

Re: merits of Lisp vs Python

2006-12-22 Thread Lars Rune Nøstdal
On Fri, 08 Dec 2006 03:07:09 -0800, Mark Tarver wrote: > How do you compare Python to Lisp? What specific advantages do you > think that one has over the other? > > Note I'm not a Python person and I have no axes to grind here. This is > just a question for my general education. > > Mark Kill

Re: optparser question

2006-12-22 Thread Michele Petrazzo
Steven Bethard wrote: > You can try using argparse_, which doesn't make these weird > inferences, and generally assumes that your action will take a single > argument unless you specify otherwise:: > <-cut-> > Not sure exactly what your callback was trying to do though -- it > seems like you'

Re: Decorator for Enforcing Argument Types

2006-12-22 Thread Fredrik Lundh
Peter Wang wrote: > I understand that we're all adults, but it's still nice to have the > computer tell us when we're being childish. :) like this? def accepts(*types): raise RuntimeError("don't be childish!") def returns(rtype): raise RuntimeError("don't be childish!") -- http://

Re: removing the header from a gzip'd string

2006-12-22 Thread vasudevram
Fredrik Lundh wrote: > Gabriel Genellina wrote: > > > Using the default options ("deflate", default compression level, no > > custom dictionary) will make those first two bytes 0x78 0x9c. > > > > If you want to encrypt a compressed text, you must remove redundant > > information first. > > encr

Re: Generating all permutations from a regexp

2006-12-22 Thread Nick Craig-Wood
BJörn Lindqvist <[EMAIL PROTECTED]> wrote: > With regexps you can search for strings matching it. For example, > given the regexp: "foobar\d\d\d". "foobar123" would match. I want to > do the reverse, from a regexp generate all strings that could match > it. > > The regexp: "[A-Z]{3}\d{3}" sho

Re: Generating all permutations from a regexp

2006-12-22 Thread Fredrik Lundh
Nick Craig-Wood wrote: > A regular expression matcher uses a state machine to match strings. unless it's the kind of regular expression matcher that doesn't use a state machine, like the one in Python. -- http://mail.python.org/mailman/listinfo/python-list

Re: optparser question

2006-12-22 Thread Steven Bethard
Michele Petrazzo wrote: > Ok, I have not understand the "trickle" for transform the > action="callback" and provide a callback to a new action. Yeah, you're not the only one. ;-) > I believe, however, that the doc has to be more explicit about this > strange behavior, because a not so expert dev

Re: removing the header from a gzip'd string

2006-12-22 Thread Gabriel Genellina
Fredrik Lundh ha escrito: > Gabriel Genellina wrote: > > > If you want to encrypt a compressed text, you must remove redundant > > information first. > > encryption? didn't the OP say that he *didn't* plan to decompress the > resulting data stream? I was trying to imagine any motivation for aski

Re: Building python C++ extension modules using MS VC++ 2005?

2006-12-22 Thread Bo Peng
Sandra-24 wrote: > You can use 2005 to build extensions for Python 2.5. I've done this > with several extensions, both my own and others. I do not know if you > can use it for Python 2.4, so I won't advise you on that. I thought > Microsoft made its C/C++ compiler, version 7.1 (2003) freely availab

Re: How to distribute an additional DLL to site-packages?

2006-12-22 Thread Bo Peng
> I am writing a python extension module that needs to link with a > third-party DLL. How can I copy this DLL to the site-packages directory > along with my extension modules? It seems that data_files parameter can > do this, but I do not know how to get the absolute destination > directory. Af

Re: One module per class, bad idea?

2006-12-22 Thread Carl Banks
Kent Johnson wrote: > Carl Banks wrote: > > Now, I think this is the best way to use modules, but you don't need to > > use modules to do get higher-level organization; you could use packages > > instead. It's a pain if you're working on two different classes in the > > same system you have to kee

stoppable child thread

2006-12-22 Thread james_w77
I am trying to use Peter's StoppableThread(threading.Thread). What I want to do is to start 5 child threads, then do something, then when got ^C keyboard exception, stop the child thread. For some reason (apparently strange for me :) ), the child threads can NOT be stopped. See the enclosed code

Re: Decorator for Enforcing Argument Types

2006-12-22 Thread John Machin
Peter Wang wrote: > Bruno Desthuilliers wrote: > > > > Python is dynamic, and fighting against the language is IMHO a really > > bad idea. The only places where theres a real need for this kind of > > stuff are when dealing with the "outside world" (IOW : inputs and > > outputs). And then package

Re: How to distribute an additional DLL to site-packages?

2006-12-22 Thread Gabriel Genellina
Bo Peng ha escrito: > > I am writing a python extension module that needs to link with a > > third-party DLL. How can I copy this DLL to the site-packages directory > > along with my extension modules? It seems that data_files parameter can > > do this, but I do not know how to get the absolute de

Retrieve Tkinter listbox item by string, not by index

2006-12-22 Thread Kevin Walzer
I'm trying to set the active item in a Tkinter listbox to my application's currently-defined default font. Here's how I get the fonts loaded into the listbox: self.fonts=list(tkFont.families()) self.fonts.sort() for item in self.fonts: self.fontlist.insert(END, item) #self

Re: stoppable child thread

2006-12-22 Thread Gabriel Genellina
[EMAIL PROTECTED] ha escrito: > def main(): > threads = [] > try: > for i in range(5): > t = StoppableThread() > t.start() > sleep(0.001) > threads.append(t) > > > except KeyboardInterrupt: > for t in threads: >

Re: One module per class, bad idea?

2006-12-22 Thread Erik Johnson
There are arguments of preference to be made on both sides. I think the question largely comes down to what is "workable" and "maintainable". To answer the original question, I think it is not necessarily a bad idea to have one class per file. But if your classes are small, or certain classes a

Re: textwrap.dedent replaces tabs?

2006-12-22 Thread Frederic Rentsch
Tom Plunket wrote: > Frederic Rentsch wrote: > > >>> Well, there is that small problem that there are leading tabs that I >>> want stripped. I guess I could manually replace all tabs with eight >>> spaces (as opposed to 'correct' tab stops), and then replace them when >>> done, but it's probabl

Re: One module per class, bad idea?

2006-12-22 Thread Carl Banks
Erik Johnson wrote: > The file has now grown into a 6800 line beast (including docstring, > whitespace, and CVS history). Pretty much any time we implement some new > functionality, there are at least a few changes in that file. When you have > multiple developers working on different project

Re: Decorator for Enforcing Argument Types

2006-12-22 Thread George Sakkis
John Machin wrote: > Peter Wang wrote: > > Bruno Desthuilliers wrote: > > > > > > Python is dynamic, and fighting against the language is IMHO a really > > > bad idea. The only places where theres a real need for this kind of > > > stuff are when dealing with the "outside world" (IOW : inputs an

Re: How to distribute an additional DLL to site-packages?

2006-12-22 Thread Bo Peng
> Use the package_data option. setup(..., packages=['yyy'], > package_data={'yyy':['xxx.dll']}, ...) > (Distutils documentation may be arcane sometimes, but this is easily > found at http://docs.python.org/dist/node12.html) > Absolute dirs are almost never necesary, usually all distutils commands >

attribute decorators

2006-12-22 Thread Gert Cuykens
would it not be nice if you could assign decorators to attributes too ? for example class C: @staticattribute data='hello' or class C: @privateattribute data='hello' -- http://mail.python.org/mailman/listinfo/python-list

module to implement Abstract Base Class

2006-12-22 Thread emin . shopper
I had a need recently to check if my subclasses properly implemented the desired interface and wished that I could use something like an abstract base class in python. After reading up on metaclass magic, I wrote the following module. It is mainly useful as a light weight tool to help programmers c

Re: Problem in using Pulp

2006-12-22 Thread MRAB
Robert Kern wrote: > [EMAIL PROTECTED] wrote: > > Thanks, now I am not getting that error, but now I am getting a > > different error: > > -error--- > >GLPK("C:\Documents and > > Settings\Amit\Desktop\glpk-4.9\glpk-4.9\examples\"").solve(prob) >

Use a Thread to reload a Module?

2006-12-22 Thread Gregory Piñero
Hi Python Experts, I hope I can explain this right. I'll try. Background: I have a module that I leave running in a server role. It has a module which has data in it that can change. So every nth time a function in the server gets called, I want to reload the module so it has the freshest data

Re: Problem in using Pulp

2006-12-22 Thread Robert Kern
MRAB wrote: > Robert Kern wrote: >> The last character in that string is a double quote. You don't want that. >> What >> you want to do is escape all of the backslashes (or use raw strings to avoid >> the >> escaping altogether). E.g. >> >>"C:\\Documents and >> Settings\\Amit\\Desktop\\glpk

Re: attribute decorators

2006-12-22 Thread Fredrik Lundh
Gert Cuykens wrote: > would it not be nice if you could assign decorators to attributes too ? > for example > > class C: > @staticattribute > data='hello' > > or > > class C: > @privateattribute > data='hello' and that would do what? -- http://mail.python.org/mailman/listin

Re: One module per class, bad idea?

2006-12-22 Thread Paddy
Carl Banks wrote: > Erik Johnson wrote: > > The file has now grown into a 6800 line beast (including docstring, > > whitespace, and CVS history). Pretty much any time we implement some new > > functionality, there are at least a few changes in that file. When you have > > multiple developers

Re: Tkinter, StringVar and dict

2006-12-22 Thread Kevin Walzer
James Stroud wrote: > Kevin Walzer wrote: >> I'm trying to manage user preferences in a Tkinter application by >> initializing some values that can then be configured from a GUI. The >> values are set up as a dict, like so: >> >> self.prefs= { >> 'interface': '-en1', >>

Using Tools/freeze.py on AIX -- having problems

2006-12-22 Thread jmalone
I have a python script that I need to freeze on AIX 5.1 (customer has AIX and does not want to install Python). The python script is pretty simple (the only things it imports are sys and socket). The README file in the Tools/freeze directory of the Python-2.4.4 distribution says the following (an

scopes of local and global variable

2006-12-22 Thread Pyenos
#CODE## t_len=0 class WORK: def getwork(self): def formattable(table_to_process,type): TYPE=["p","t","T","s","i"] #list of types to format if type==TYPE[1]:

Re: attribute decorators

2006-12-22 Thread DH
Fredrik Lundh wrote: > Gert Cuykens wrote: > > > would it not be nice if you could assign decorators to attributes too ? > > for example > > > > class C: > > @staticattribute > > data='hello' > > > > or > > > > class C: > > @privateattribute > > data='hello' > > and that would do w

Re: scopes of local and global variable

2006-12-22 Thread Fredrik Lundh
Pyenos wrote: > #CODE## > t_len=0 > class WORK: > def getwork(self): > def formattable(table_to_process,type): > > TYPE=["p","t","T","s","i"] #list of types to format >

Re: scopes of local and global variable

2006-12-22 Thread Pyenos
Fredrik Lundh <[EMAIL PROTECTED]> writes: > Pyenos wrote: > > > #CODE## > > t_len=0 > > class WORK: > > def getwork(self): > > def formattable(table_to_process,type): > > TYPE=["p","t","T","s","i"] #list of types to format > >

Spyce vs mod_python PSP

2006-12-22 Thread Ben
Hi, I have just tarted trying to transfer some of my knowledge of python to server side applications. I stated off using mod_python PSP because it was what I found first. I then found spyce, which seems a better solution. It avoids the problem of keeping indentation correct when writing code embed

Re: Spyce vs mod_python PSP

2006-12-22 Thread Ben
..or any of the many other embedded python solutions that seem to be out thee... Ben wrote: > Hi, > > I have just tarted trying to transfer some of my knowledge of python to > server side applications. I stated off using mod_python PSP because it > was what I found first. I then found spyce, wh

Re: Spyce vs mod_python PSP

2006-12-22 Thread Pyenos
frankly, i don't konw anything about mod_python nor spyce, but i wish you good luck. -- http://mail.python.org/mailman/listinfo/python-list

let me simplify my question about scope of vars

2006-12-22 Thread Pyenos
"code" var=1 class CLASS: def METHOD1: def METHOD2: var+=var return var METHOD2() #line8 return var METHOD1() #line10 Q1: does class CLA

Re: python-hosting.com projects: dead?

2006-12-22 Thread Terry Reedy
<[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] |Terry> To me, this is a bit too much 'blame the victim'. The fault lies |Terry> with spammers who are willing to exploit to destruction something |Terry> they did not build. The rest of us are still learning how to |

let me simplify my question on scope of vars

2006-12-22 Thread Pyenos
"code" var=1 class CLASS: def METHOD1: def METHOD2: var+=var return var METHOD2() #line8 return var METHOD1() #line10 "end code" Q1: do

Re: One module per class, bad idea?

2006-12-22 Thread Gabriel Genellina
At Friday 22/12/2006 12:56, Kent Johnson wrote: It does make the imports look funny - I tend to give the module the same name as the class, Java style, so I have from foo.bar.MyClass import MyClass but that is a minor point IMO. You can always arrange things at the module level (inside __init

Re: scopes of local and global variable

2006-12-22 Thread James Stroud
Pyenos wrote: > Fredrik Lundh <[EMAIL PROTECTED]> writes: > > >>Pyenos wrote: >> >> >>>#CODE## >>>t_len=0 >>>class WORK: >>>def getwork(self): >>>def formattable(table_to_process,type): >>>TYPE=["p","t","T","s","i"] #list of type

Xah's Edu Corner: Introduction to 3D Graphics Programing

2006-12-22 Thread Xah Lee
Of Interest: Introduction to 3D Graphics Programing http://xahlee.org/3d/index.html Currently, this introduction introduces you to the graphics format of Mathematica, and two Java Applet utilities that allows you to view them with live rotation in a web browser. Also, it includes a introductory t

Re: scopes of local and global variable

2006-12-22 Thread Pyenos
James Stroud <[EMAIL PROTECTED]> writes: > >>>#CODE## > >>>t_len=0 > >>>class WORK: > >>>def getwork(self): > >>>def formattable(table_to_process,type): > >>>TYPE=["p","t","T","s","i"] #list of types to format > >>>if t

Re: scopes of local and global variable

2006-12-22 Thread Max Wilson
Pyenos wrote: > does class WORK inherit t_len=0 from line1? > > does def getwork() inherit t_len=0 from line1? > > does def formattable(table_to_process,type) inherit t_len=0 from line1? > > does def format_t() inherit t_len=0 from line1? Not really, no. The global t_len is different than the loca

Re: let me simplify my question on scope of vars

2006-12-22 Thread Pyenos
Pyenos <[EMAIL PROTECTED]> writes: i will try to answer my own questions(pls verify): > "code" > var=1 > class CLASS: > def METHOD1: > def METHOD2: > var+=var > return var > METHOD2() #line8 >

Re: One module per class, bad idea?

2006-12-22 Thread Gabriel Genellina
At Friday 22/12/2006 20:25, Paddy wrote: Are there tools out their to help with the refactoring task of splitting a module into two or more sections then showing what other files need to change? Usually no other files need to change. Ex: you have BigOldModule including ClassA, ClassB and Func

Re: scopes of local and global variable

2006-12-22 Thread Pyenos
"Max Wilson" <[EMAIL PROTECTED]> writes: > Pyenos wrote: > > does class WORK inherit t_len=0 from line1? > > > > does def getwork() inherit t_len=0 from line1? > > > > does def formattable(table_to_process,type) inherit t_len=0 from line1? > > > > does def format_t() inherit t_len=0 from line1? >

Re: let me simplify my question on scope of vars

2006-12-22 Thread Pyenos
Pyenos <[EMAIL PROTECTED]> writes: > Pyenos <[EMAIL PROTECTED]> writes: > > i will try to answer my own questions(pls verify): > > > "code" > > var=1 > > class CLASS: > > def METHOD1: > > def METHOD2: > > var+=var > > return var > >

Re: scopes of local and global variable

2006-12-22 Thread Gabriel Genellina
At Friday 22/12/2006 20:45, Pyenos wrote: # Error message says: # # UnboundLocalError: local variable 't_len' referenced before assignment# See item 6 in "10 Python pitfalls": -- Gabriel Gen

Re: let me simplify my question on scope of vars

2006-12-22 Thread Gabriel Genellina
At Friday 22/12/2006 22:24, Pyenos wrote: > > "code" > > var=1 > > class CLASS: > > def METHOD1: > > def METHOD2: > > var+=var > > return var > > METHOD2() #line8 > > return var > > METHOD1()

Re: One module per class, bad idea?

2006-12-22 Thread Carl Banks
Paddy wrote: > Carl Banks wrote: > > Erik Johnson wrote: > > > The file has now grown into a 6800 line beast (including docstring, > > > whitespace, and CVS history). Pretty much any time we implement some new > > > functionality, there are at least a few changes in that file. When you > >

Re: Retrieve Tkinter listbox item by string, not by index

2006-12-22 Thread James Stroud
Kevin Walzer wrote: > I'm trying to set the active item in a Tkinter listbox to my > application's currently-defined default font. > > Here's how I get the fonts loaded into the listbox: > > self.fonts=list(tkFont.families()) > self.fonts.sort() > > for item in self.fonts: > sel

Re: One module per class, bad idea?

2006-12-22 Thread Carl Banks
Gabriel Genellina wrote: > At Friday 22/12/2006 20:25, Paddy wrote: > > >Are there tools out their to help with the refactoring task of > >splitting a module into two or more sections then showing what other > >files need to change? > > Usually no other files need to change. Ex: you have BigOldMod

Refactoring between files (was: One module per class, bad idea?)

2006-12-22 Thread Ben Finney
"Paddy" <[EMAIL PROTECTED]> writes: > Are there tools out their to help with the refactoring task of > splitting a module into two or more sections then showing what other > files need to change? Sounds like a good feature to add to Bicycle Repair Man: http://bicyclerepair.sourceforge.net/>

Re: Retrieve Tkinter listbox item by string, not by index

2006-12-22 Thread James Stroud
James Stroud wrote: > Kevin Walzer wrote: > >> I'm trying to set the active item in a Tkinter listbox to my >> application's currently-defined default font. >> >> Here's how I get the fonts loaded into the listbox: >> >> self.fonts=list(tkFont.families()) >> self.fonts.sort() >> >> for item i

pyparsing announcement?

2006-12-22 Thread Paul McGuire
I have tried a couple of times now to post an announcement of the latest version of pyparsing, but it does not seem to be making it past the news server, neither through my local ISP's server nor through GoogleGroups. Could it be because I am also posting to comp.lang.python.announce, and this

Re: attribute decorators

2006-12-22 Thread Terry Reedy
"Gert Cuykens" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] | would it not be nice if you could assign decorators to attributes too ? | for example | | class C: |@staticattribute |data='hello' | | or | | class C: |@privateattribute |data='hello' No. @g def f(): pa

  1   2   >