tkinter prob
hi, i am making a GUI using Tkinter, I have a button and a checkbutton. i want the button to be enable when checkbutton is on and disble when the checkbutton is off. thanx -- http://mail.python.org/mailman/listinfo/python-list
Re: istep() addition to itertool? (Was: Re: Printing n elements per line in a list)
In [EMAIL PROTECTED], Justin Azoff wrote: Rhamphoryncus wrote: [snip interesting istep function] Would anybody else find this useful? Maybe worth adding it to itertool? yeah, but why on earth did you make it so complicated? def istep(iterable, step): a=[] for x in iterable: if len(a) = step: yield a a=[] a.append(x) if a: yield a This is not as lazy as Rhamphoryncus' function anymore. Lets say the `iterable` is a stream of events, then your function always needs to receive `step` events before the caller can do anything else with the events. In Rhamphoryncus' function the caller can react on the event as soon as it's delivered by `iterable`. Ciao, Marc 'BlackJack' Rintsch -- http://mail.python.org/mailman/listinfo/python-list
Re: trouble using \ as a string
such as tempname=\..it says that the line is single qouted. The others have addressed the escape issue I think. However it looks like you want the funtionality of the os.path module. For example: import os.path as path filename = /home/ant/test.sh filename2 = rc:\python24\scripts\test.py path.split(filename) ('/home/ant', 'test.sh') path.split(filename2) ('c:\\python24\\scripts', 'test.py') -- http://mail.python.org/mailman/listinfo/python-list
Re: tkinter prob
JyotiC wrote: i am making a GUI using Tkinter, I have a button and a checkbutton. i want the button to be enable when checkbutton is on and disble when the checkbutton is off. use the checkbutton's command option to install a callback that enables or disables the button. /F -- http://mail.python.org/mailman/listinfo/python-list
Re: write eof without closing
Alex Martelli wrote: IIRC, ctrl-Z is not used _in_files_ to represent EOF. Only when text is being entered at the console. Easy to test, if you have Windows: n='foo.txt' s='ba\r\n'+chr(26)+'bo\r\r' open(n,'wb').write(s) ss=open(n).read() ss 'ba\n' As you see, in _text_ files on Windows a control-Z (char(26), AKA '\x1a') does indeed represent end of file your test doesn't match the OP's example, though, which used control-Z to signal end of file when reading from the console: copy con test.txt hello ^Z 1 file(s) copied. that control-Z works in the same way as control-D on Unix, and no EOF character is copied to the file: python -c print repr(open('test.txt', 'rb').read()) 'hello\r\n' /F -- http://mail.python.org/mailman/listinfo/python-list
Re: tkinter prob
i have tried it out but it's not working. this is the code from Tkinter import * class abc: def __init__(self,parent): #make container myparent self.myparent=parent self.myparent.geometry(500x200) #make the initial frame self.frame=Frame(self.myparent) self.frame.pack() self.var=IntVar() self.var.set(0) a=Button(self.frame,text=button) a.pack() Checkbutton(self.frame,text=hello,variable=self.var,command=self.com(a)).pack() def com(self,a): if self.var.get()==1: a.config(state=ENABLED) else: a.config(state=DISABLED) root=Tk() abc(root) root.mainloop() Fredrik Lundh wrote: JyotiC wrote: i am making a GUI using Tkinter, I have a button and a checkbutton. i want the button to be enable when checkbutton is on and disble when the checkbutton is off. use the checkbutton's command option to install a callback that enables or disables the button. /F -- http://mail.python.org/mailman/listinfo/python-list
Python and STL efficiency
Hi, I'm learning STL and I wrote some simple code to compare the efficiency of python and STL. //C++ #include iostream #include string #include vector #include set #include algorithm using namespace std; int main(){ vectorstring a; for (long int i=0; i1 ; ++i){ a.push_back(What do you know?); a.push_back(so long...); a.push_back(chicken crosses road); a.push_back(fool); } setstring b(a.begin(), a.end()); unique_copy(b.begin(), b.end(), ostream_iteratorstring(cout, \n)); } #python def f(): a = [] for i in range(1): a.append('What do you know') a.append('so long...') a.append('chicken crosses road') a.append('fool') b = set(a) for s in b: print s I was using VC++.net and IDLE, respectively. I had expected C++ to be way faster. However, while the python code gave the result almost instantly, the C++ code took several seconds to run! Can somebody explain this to me? Or is there something wrong with my code? -- http://mail.python.org/mailman/listinfo/python-list
Re: Create a Multilanguage PDF in Python
Perseo wrote: Hi again, WORKS!!! I download all I need as python + reportlab. Only 2 questions: 1. I need all of this package? because it is 6Mb! I'm afraid you need all of it. BTW My reportlab package is only 3MB... hmm strange. 2. How can I connect my software with MySql. In my Hosting is present the Python support but I don't thing that the MySQLdb is present. How can I solve this little problem? You can install MySQLdb wherever you want. You need only to make sure the module is in your PYTHONPATH. HTH, Rob -- http://mail.python.org/mailman/listinfo/python-list
Re: Input from the same file as the script
Dennis Lee Bieber [EMAIL PROTECTED] Wrote: | On 20 Aug 2006 11:02:25 -0700, [EMAIL PROTECTED] declaimed the | following in comp.lang.python: | | Can the input to the python script be given from the same file as the | script itself. e.g., when we execute a python script with the command | 'python scriptName', can the input be given in someway ? | | Redirecting? Ugh... | | Off-hand, I'd say NO | | There is no way to tell the python interpreter where the program | ends and the run data begins. You *could* jump through a hoop like this one: ListOfInput = ['first input', 'second input', ...'last input'] and then read the elements of the list one by one... You will probably have to make the list global to get it to work... But I kind of agree with Dennis - I would not do it that way either - reading the inputs from the stdin console is easy enough, or if there are just a few of them, getting them as command line arguments is arguably even easier - and if its a whole bunch of stuff that is painstaking to type in every time - put it in a text file and read it line by line. - Hendrik - -- http://mail.python.org/mailman/listinfo/python-list
permanent tempfile?
Hello, I am trying to create a temp file, however the file that is created is still there after the program has completed. Why is this so? CoLe #!/usr/bin/python import os, tempfile, sys import tempfile # creates a random file (text=True is textfile, text=False is binary file) ext = '.txt' pfx = 'tmp' dir = '/home/argon/PR0001/source/emc2/bin' filename = tempfile.mkstemp(suffix=ext, prefix=pfx, dir=dir, text=True)[1] print filename # eg. C:\Temp\tmpsnrfgk.txt # test it ... fout = open(filename, 'w') fout.write(just a text file) fout.close() os.remove(filename) -- http://mail.python.org/mailman/listinfo/python-list
Re: tkinter prob
On Mon, 21 Aug 2006 08:50:29 +0200, JyotiC [EMAIL PROTECTED] wrote: i have tried it out but it's not working. this is the code from Tkinter import * class abc: def __init__(self,parent): #make container myparent self.myparent=parent self.myparent.geometry(500x200) #make the initial frame self.frame=Frame(self.myparent) self.frame.pack() self.var=IntVar() self.var.set(0) a=Button(self.frame,text=button) a.pack() Checkbutton(self.frame,text=hello,variable=self.var,command=self.com(a)).pack() This *calls* self.com(a) and assigns its *results* (which happens to be None) to the command option in your button. So your button does nothing. To do what you want, use: self.a = Button(self.frame,text=button) self.a.pack() Checkbutton(self.frame,text=hello,variable=self.var,command=self.com).pack() in __init__, then: def com(self): if self.var.get()==1: self.a.config(state=ENABLED) else: self.a.config(state=DISABLED) HTH -- python -c print ''.join([chr(154 - ord(c)) for c in 'U(17zX(%,5.zmz5(17l8(%,5.Z*(93-965$l7+-']) -- http://mail.python.org/mailman/listinfo/python-list
Python Editor with Autocorrection
hello! i am searching for a free python editor with autocorrection capabillities. for example: the wrong setfocus() call to become SetFocus(), etc. thanks ___ All New Yahoo! Mail Tired of [EMAIL PROTECTED]@! come-ons? Let our SpamGuard protect you. http://uk.docs.yahoo.com/nowyoucan.html -- http://mail.python.org/mailman/listinfo/python-list
Questions on exceptions
Hi everyone, I've just finished studying O'Reilly's Learning python and since I come from the Java world, there are some things that bother me concerning python's exception handling. In Java, all methods must declare the exceptions throwed (I'm speaking of checked exceptions)... but this is not the case in Python. So my question is : how can I know which exceptions I must catch ? (am I supposed to believe what's written in the documentation ? am I supposed to read the source code to see which exceptions are throwed ?) Also, can someone explain me why there is no try...except...finally statement ? For example, the following code snippet is not valid, but what would be the correct python way to do it ? myFile = open('file.txt') # assume file exists try: for nextLine in file: nextLine = nextLine.rstrip('\n');print line = + nextLine except IOError: print Error while reading from file finally: myFile.close -- http://mail.python.org/mailman/listinfo/python-list
Re: Python and STL efficiency
In [EMAIL PROTECTED], Licheng Fang wrote: Hi, I'm learning STL and I wrote some simple code to compare the efficiency of python and STL. //C++ #include iostream #include string #include vector #include set #include algorithm using namespace std; int main(){ vectorstring a; for (long int i=0; i1 ; ++i){ a.push_back(What do you know?); a.push_back(so long...); a.push_back(chicken crosses road); a.push_back(fool); } setstring b(a.begin(), a.end()); unique_copy(b.begin(), b.end(), ostream_iteratorstring(cout, \n)); } Why are you using `unique_copy` here? #python def f(): a = [] for i in range(1): a.append('What do you know') a.append('so long...') a.append('chicken crosses road') a.append('fool') b = set(a) for s in b: print s I was using VC++.net and IDLE, respectively. I had expected C++ to be way faster. However, while the python code gave the result almost instantly, the C++ code took several seconds to run! Can somebody explain this to me? Or is there something wrong with my code? There's a difference in data structures at least. The Python `set` type is implemented with a hash algorithm, so the equivalent STL type would be `hash_set`. `set` in Python does not store its contents sorted. Ciao, Marc 'BlackJack' Rintsch -- http://mail.python.org/mailman/listinfo/python-list
Re: Send to all clients using UDP in Twisted
Thanks for the responce, I am sending over the internet so I can't use that method. Thanks for the reply anyway! Martin P. Hellwig wrote: Elliot Hughes wrote: Hi Everyone, I am trying to right a server that can receive a message and send it to all clients using UDP on twisted. I have got it so far that it can echo to the client that sent the message but not to the rest. I tried using multicast but that requires almost total rewrite, and the client which is not in python can't handle it. Are there any alternative methods or a workaround? Thanks alot for your time! Depends on you network topology and infrastructure, one possible option is that if the clients are on the same subnet you could send it to the broadcast address, however that wouldn't make your netadmin happy, if he didn't filter broadcast in the first place (many switches default filter that). -- mph -- http://mail.python.org/mailman/listinfo/python-list
Re: Python and STL efficiency
Marc 'BlackJack' Rintsch wrote: In [EMAIL PROTECTED], Licheng Fang wrote: Hi, I'm learning STL and I wrote some simple code to compare the efficiency of python and STL. //C++ #include iostream #include string #include vector #include set #include algorithm using namespace std; int main(){ vectorstring a; for (long int i=0; i1 ; ++i){ a.push_back(What do you know?); a.push_back(so long...); a.push_back(chicken crosses road); a.push_back(fool); } setstring b(a.begin(), a.end()); unique_copy(b.begin(), b.end(), ostream_iteratorstring(cout, \n)); } Why are you using `unique_copy` here? Sorry, that's a typo. Actually I used 'copy'. #python def f(): a = [] for i in range(1): a.append('What do you know') a.append('so long...') a.append('chicken crosses road') a.append('fool') b = set(a) for s in b: print s I was using VC++.net and IDLE, respectively. I had expected C++ to be way faster. However, while the python code gave the result almost instantly, the C++ code took several seconds to run! Can somebody explain this to me? Or is there something wrong with my code? There's a difference in data structures at least. The Python `set` type is implemented with a hash algorithm, so the equivalent STL type would be `hash_set`. `set` in Python does not store its contents sorted. Ciao, Marc 'BlackJack' Rintsch Thank you for your comments. I tested with hash_set, but I didn't see much performance improvement. When I increased the loop to 1 million times, the python code still ran reasonably fast and the C++ code got stuck there. This totally surprised me, because according this page http://norvig.com/python-lisp.html, the speed of python is nowhere near that of C++. -- http://mail.python.org/mailman/listinfo/python-list
Re: tkinter prob
JyotiC wrote: got the error, but there is one more prob, button is not coming to enable again. once it is disabled the error it's giving is:- NameError: global name 'ENABLED' is not defined Try NORMAL instead of ENABLED. Peter -- http://mail.python.org/mailman/listinfo/python-list
Re: Python and STL efficiency
Licheng Fang wrote: Hi, I'm learning STL and I wrote some simple code to compare the efficiency of python and STL. I was using VC++.net and IDLE, respectively. I had expected C++ to be way faster. However, while the python code gave the result almost instantly, the C++ code took several seconds to run! Can somebody explain this to me? Or is there something wrong with my code? Hi, I'm no C++ guru so cannot comment on the C++ code itself, however I do wonder if you tested your C++ code with other STL implementation such as gcc (gcc is available on windows as well, in various versions). What could be is that expanding the list in C++ is done in very small increments, leading to many re-allocations. Is it possible to pre-allocate the vector with sufficient entries? Also, your Python code as quoted, doesn't actually call your function f(). If you say that you get results instantly, I assume that you mean all 4 strings are actually printed to console? (I'm surprised that the console prints things that fast). btw, using range() in Python isn't very efficient, I think... Better to use xrange(). Asked a C++ collegue of mine to comment, and he strongly suspects that you're actually running it in the .Net runtime (your C++ code contains some C#-isms, such as omitting the '.h' in the include statements). Luck, --Tim -- http://mail.python.org/mailman/listinfo/python-list
redemo.py with named groups
Hi, I wrote an easy patch for redemo.py to print named groups. For example, regexp: (?Pspam.*) string: foobar shows following groups. Groups: 0: 'foobar' 1: 'foobar' 'spam': 'foobar' I don't know how/where to commit this patch.. any suggestions? --- Tools/scripts/redemo.py 2004-02-13 02:35:32.0 +0900 +++ redemo.py 2006-08-21 01:11:11.0 +0900 @@ -148,6 +148,10 @@ for i in range(len(groups)): g = %2d: %r % (i, groups[i]) self.grouplist.insert(END, g) +groupdict = m.groupdict() +for key in groupdict: +g = %r: %r % (key, groupdict[key]) +self.grouplist.insert(END, g) nmatches = nmatches + 1 if self.showvar.get() == first: break -- http://mail.python.org/mailman/listinfo/python-list
Re: Python and STL efficiency
Marc 'BlackJack' Rintsch wrote: In [EMAIL PROTECTED], Licheng Fang wrote: Hi, I'm learning STL and I wrote some simple code to compare the efficiency of python and STL. [...] There's a difference in data structures at least. The Python `set` type is implemented with a hash algorithm, so the equivalent STL type would be `hash_set`. `set` in Python does not store its contents sorted. The set should be only 4 items in size, according to my reading of the code, so set implementation differences shouldn't lead to drastic performance differences. Ciao, Marc 'BlackJack' Rintsch Cheers, --Tim -- http://mail.python.org/mailman/listinfo/python-list
Re: py2exe: cannot identify image file
Daniel Mark wrote: Hello all: It seems that function 'Image.open' cannot read image file under EXE application. What should I do for this problem? google and pil py2exe, the first reply: http://starship.python.net/crew/theller/moin.cgi/PIL_20and_20py2exe Thank you -Daniel Michele -- http://mail.python.org/mailman/listinfo/python-list
Re: tkinter prob
thanx a lot it worked Peter Otten wrote: JyotiC wrote: got the error, but there is one more prob, button is not coming to enable again. once it is disabled the error it's giving is:- NameError: global name 'ENABLED' is not defined Try NORMAL instead of ENABLED. Peter -- http://mail.python.org/mailman/listinfo/python-list
Re: Questions on exceptions
In [EMAIL PROTECTED], sc_wizard29 wrote: Also, can someone explain me why there is no try...except...finally statement ? AFAIK historical reasons. There where some concerns about ambiguity. But in Python 2.5 this form will become legal syntax. For example, the following code snippet is not valid, but what would be the correct python way to do it ? myFile = open('file.txt') # assume file exists try: for nextLine in file: nextLine = nextLine.rstrip('\n');print line = + nextLine except IOError: print Error while reading from file finally: myFile.close You forgot the parenthesis for the `close()` method. In Python =2.4 you have to nest: try: try: pass except Error: pass finally: pass Maybe you are interested in the new (Python 2.5) ``with`` statement too: http://docs.python.org/dev/ref/with.html And the style guide: http://www.python.org/dev/peps/pep-0008/ (because you used Java naming conventions) Ciao, Marc 'BlackJack' Rintsch -- http://mail.python.org/mailman/listinfo/python-list
Re: Python and STL efficiency
In [EMAIL PROTECTED], Tim N. van der Leeuw wrote: (your C++ code contains some C#-isms, such as omitting the '.h' in the include statements). That's no C#-ism, that's C++. The standard C++ header names don't have a trailing '.h'. ``gcc`` prints deprecation warnings if you write the names with '.h'. Ciao, Marc 'BlackJack' Rintsch -- http://mail.python.org/mailman/listinfo/python-list
Re: What do you want in a new web framework?
[EMAIL PROTECTED] a écrit : Hello Everyone, Now, I'm working on a new web framework. I tried many test on the other programming languages. Then i decided to use python on my web framework project. Now i want to listen all of you. What do you want in that web framework(Easy use of Database, Easy use of XML, GUI Designer, etc...)? I'm wating your answers. Thank you for all answers...! Look at http://wiki.python.org/moin/WebFrameworks Do you *really* need to develop a *new* framework (maybe a scholl exercise - it that case, KISS)? Personnally I use Karrigell at home, simple, nice. A+ Laurent. -- http://mail.python.org/mailman/listinfo/python-list
Re: Python for EXIF-info-additions ?
Bror Johansson wrote: Is there somewhere some Python-module that can be used for adding EXIF-info to JPEG files? (Modules for extraction of EXIF-data are easily found, but lacks - as I see it - capacity to add new tags.) Hi, this is a feature that I want to add to FreeImagePy. It's not so difficult, but now I haven't time to do it. If you want to spend some hours for make enjoying yourself and all the python community, email me! :) /BJ Bye, Michele -- http://mail.python.org/mailman/listinfo/python-list
Re: Python and STL efficiency
Marc 'BlackJack' Rintsch wrote: In [EMAIL PROTECTED], Tim N. van der Leeuw wrote: (your C++ code contains some C#-isms, such as omitting the '.h' in the include statements). That's no C#-ism, that's C++. The standard C++ header names don't have a trailing '.h'. ``gcc`` prints deprecation warnings if you write the names with '.h'. Ciao, Marc 'BlackJack' Rintsch We stand corrected. --Tim -- http://mail.python.org/mailman/listinfo/python-list
Loading module via full path
Hi all. Is there a way to load a module given a full path to the module without extending sys.path first? Andre' -- http://mail.python.org/mailman/listinfo/python-list
Re: Questions on exceptions
On Mon, 21 Aug 2006 00:40:14 -0700, sc_wizard29 wrote: Hi everyone, I've just finished studying O'Reilly's Learning python and since I come from the Java world, there are some things that bother me concerning python's exception handling. In Java, all methods must declare the exceptions throwed (I'm speaking of checked exceptions)... but this is not the case in Python. So my question is : how can I know which exceptions I must catch ? (am I supposed to believe what's written in the documentation ? am I supposed to read the source code to see which exceptions are throwed ?) How do you know what objects a method will return? Are you supposed to believe the documentation? Are you supposed to read the source code? Exceptions are no different. If a method claims to raise ValueError, but sometimes raises TypeError, I call that a bug, regardless of whether the line which causes it is int(x) + str(y) or raise TypeError('My documentation is incomplete'). Also, can someone explain me why there is no try...except...finally statement ? Historical reasons. I believe that Python 2.5 will support it. For example, the following code snippet is not valid, but what would be the correct python way to do it ? myFile = open('file.txt') # assume file exists try: for nextLine in file: nextLine = nextLine.rstrip('\n');print line = + nextLine except IOError: print Error while reading from file finally: myFile.close Nested try...except blocks. -- Steven D'Aprano -- http://mail.python.org/mailman/listinfo/python-list
Re: Stack trace in C
Jean-Paul Calderone [EMAIL PROTECTED] wrote: On Tue, 25 Jul 2006 14:20:41 +0200, Andre Poenitz [EMAIL PROTECTED] wrote: Bear with me - I am new to Python. (And redirect me to a more suitable newsgroup in case this one is not appropriate.) I am trying to embed Python into a C++ application and want to get back a backtrace in case of errors in the python code. I think you'd have more luck with the traceback module, which has such methods as format_exception and print_tb. That's where I got my 'inspiration' from. Unfortunately my attempt to translate this into C failed, and I can't see the reason. Thanks for the hint nevertheless Andre' -- http://mail.python.org/mailman/listinfo/python-list
Re: Stack trace in C
Just [EMAIL PROTECTED] wrote: On Tue, 25 Jul 2006 14:20:41 +0200, Andre Poenitz wrote: Bear with me - I am new to Python. (And redirect me to a more suitable newsgroup in case this one is not appropriate.) I am trying to embed Python into a C++ application and want to get back a backtrace in case of errors in the python code. I think you'd have more luck with the traceback module, which has such methods as format_exception and print_tb. From C, PyErr_Print() is often handy (if only for debugging). I'd like to display the backtrace i a fancy gui widget, and PyErr_Print sends everything to stderr... Andre' -- http://mail.python.org/mailman/listinfo/python-list
Re: Help in using introspection to simplify repetitive code
As you mention, wether the methods take arguments or not is something to have into account. And they do take arguments, and a variable number of them, so AFAIK hooking with __getattr__ or __getattribute__ will not work, as you can only get the method name with that. I was thinking of some __call__ overriding, but I've never done it before and I don't know if this could be the way to go. -- Un saludo, Javier -- http://mail.python.org/mailman/listinfo/python-list
Detect current virtual desktop
Hello Pythonists, I'd like to write for myself a tiny program that counts time spent on each virtual desktop (in GNOME). In order to do that, I need my program to detect the current virtual desktop. I've googled for it for about one hour and couldn't find any solution. The closest thing I found is set of tutorials: http://www.pygtk.org/articles.html Unfortunately, none of them answers my questions: How to detect current virtual desktop in GNOME? How to detect a virtual desktop change? -- http://automatthias.wordpress.com -- http://mail.python.org/mailman/listinfo/python-list
Re: Python and STL efficiency
Licheng Fang wrote: I was using VC++.net and IDLE, respectively. I had expected C++ to be way faster. However, while the python code gave the result almost instantly, the C++ code took several seconds to run! Can somebody explain this to me? Or is there something wrong with my code? in the Python example, the four strings in your example are shared, so you're basically copying 4 pointers to the list. in the C++ example, you're creating 4 string objects. /F -- http://mail.python.org/mailman/listinfo/python-list
Re: sum and strings
On Fri, 18 Aug 2006 19:08:37 -0700, Paul Rubin wrote: If the args are strings, the above is a quadratic time algorithm and it's better to throw an error than create such a trap for an unwary user. That's a nonsense argument. There is no shortage of slow algorithms, and some of them are built into Python. When did O(n**2) become an error condition? And overhead matters: if I'm only doing a few concatenations, it is significantly faster to add the strings using + than to use join() (at least in Python 2.3 -- YMMV): s = timeit.Timer(''.join(L), L=['a'*50, 'b'*50, 'c'*50]) s.timeit() 1.3470098972320557 t = timeit.Timer(a+b+c, a,b,c = 'a'*50, 'b'*50, 'c'*50) t.timeit() 1.0698421001434326 There's a word for optimizations that actually result in code running 25% slower. I applaud that Python's language developers care about efficiency. I applaud that the documentation warns people about traps and potential areas of inefficiency. But I think it is a shame that sum() does a special type-check to avoid something which is only sometimes slow. It doesn't protect against O(n**2) performance; it merely protects against just one of an infinite number of possible traps for the unwary. I would have thought it would be better for sum() to raise a warning, not an exception. If we take seriously the argument that sum implies addition, and that string concatenation isn't really addition, then sum() should also refuse to operate on lists and tuples and any other non-numeric class. Either would be better than sum() protecting the user from himself, except when it doesn't. -- Steven D'Aprano -- http://mail.python.org/mailman/listinfo/python-list
Re: Python and STL efficiency
How did you compile the C++ executable? I assume that it is Release mode? Then are the optimization switches enabled? Is it compiled as Native Win32 or Managed application? I suspect that other than what other posters have suggested about your code, the difference in speed is due to the way you build your C++ executable... HTH, Ray Licheng Fang wrote: Hi, I'm learning STL and I wrote some simple code to compare the efficiency of python and STL. //C++ #include iostream #include string #include vector #include set #include algorithm using namespace std; int main(){ vectorstring a; for (long int i=0; i1 ; ++i){ a.push_back(What do you know?); a.push_back(so long...); a.push_back(chicken crosses road); a.push_back(fool); } setstring b(a.begin(), a.end()); unique_copy(b.begin(), b.end(), ostream_iteratorstring(cout, \n)); } #python def f(): a = [] for i in range(1): a.append('What do you know') a.append('so long...') a.append('chicken crosses road') a.append('fool') b = set(a) for s in b: print s I was using VC++.net and IDLE, respectively. I had expected C++ to be way faster. However, while the python code gave the result almost instantly, the C++ code took several seconds to run! Can somebody explain this to me? Or is there something wrong with my code? -- http://mail.python.org/mailman/listinfo/python-list
Re: Python and STL efficiency
Licheng Fang wrote: Hi, I'm learning STL and I wrote some simple code to compare the efficiency of python and STL. I was using VC++.net and IDLE, respectively. I had expected C++ to be way faster. However, while the python code gave the result almost instantly, the C++ code took several seconds to run! Can somebody explain this to me? Or is there something wrong with my code? Just a guess: immutable strings might be Python's advantage. Due to your benchmark's simplicity you end up with 1 string instances in C++ and just four str-s (and a lot of pointers) in Python. What happens if you replace 'string' with 'const char *' in C++ ? (Note that this modification is a bit unfair to Python as it would not detect equal strings in different memory locations) Peter -- http://mail.python.org/mailman/listinfo/python-list
Re: What do you want in a new web framework?
[EMAIL PROTECTED] wrote: Now, I'm working on a new web framework. I tried many test on the other programming languages. Then i decided to use python on my web framework project. Now i want to listen all of you. What do you want in that web framework(Easy use of Database, Easy use of XML, GUI Designer, etc...)? I'm wating your answers. Thank you for all answers...! Write it in PHP, Ruby, Java, anything -- but not in Python :-) Peter -- http://mail.python.org/mailman/listinfo/python-list
Re: Help in using introspection to simplify repetitive code
[EMAIL PROTECTED] wrote: And they do take arguments, and a variable number of them, so AFAIK hooking with __getattr__ or __getattribute__ will not work, as you can only get the method name with that. why not just return the bound method *object* (a callable), and let the caller call that as usual (see Terry's last example). (hint: x.foo() can be written f=getattr(x,foo); f()) /F -- http://mail.python.org/mailman/listinfo/python-list
Py_BuildValue(I, ...) does not work
Hallo! I have a problem with Py_BuildValue: I want to convert an unsigned int to a PyObject *. http://docs.python.org/api/arg-parsing.html says that I can use I as a format string. But it does not work :-\ Here is my simplified code: $ cat -n mini.c 1 #include Python.h 2 3 static PyObject * 4 mini_foo(PyObject *self, PyObject *args) 5 { 6 /* should be 3735928495 not -559038801 */ 7 unsigned int v = 0xdeadbeafL; /* byte representation */ 8 9 return Py_BuildValue(I, v); 10 } 11 12 static PyMethodDef 13 mini_methods[] = { 14 { foo, mini_foo, METH_NOARGS, 15 bla. }, 16 { NULL, NULL, 0, NULL } 17 }; 18 19 PyMODINIT_FUNC 20 initmini(void) 21 { 22 Py_InitModule(mini, mini_methods); 23 } $ cat -n setup.py 1 from distutils.core import setup, Extension 2 3 module1 = Extension('mini', sources = ['mini.c']) 4 5 setup(name = 'mini', 6ext_modules = [ module1] ) 7 $ python setup.py build running build running build_ext building 'mini' extension cc -pthread -fno-strict-aliasing -DNDEBUG -O2 -pipe -DTHREAD_STACK_SIZE=0x2 -fPIC -fPIC -I/usr/local/include/python2.4 -c mini.c -o build/temp.openbsd-3.9-i386-2.4/mini.o cc -pthread -shared -fPIC -L/usr/obj/i386/python-2.4.2p0/Python-2.4.2 build/temp.openbsd-3.9-i386-2.4/mini.o -o build/lib.openbsd-3.9-i386-2.4/mini.so $ cd build/lib.openbsd-3.9-i386-2.4 $ ls mini.so $ python Python 2.4.2 (#1, Mar 2 2006, 14:17:22) [GCC 3.3.5 (propolice)] on openbsd3 Type help, copyright, credits or license for more information. import mini mini.foo() Traceback (most recent call last): File stdin, line 1, in ? SystemError: bad format char passed to Py_BuildValue Is Python's documentation wrong (I hope not)? Or, have I missed anything? Tanks in advance, Martin -- http://mail.python.org/mailman/listinfo/python-list
Regular Expression question
Hi, I am having some difficulty trying to create a regular expression. Consider: tag1 name=john/ br/ tag2 value=adj__tall__/ tag1 name=joe/ tag1 name=jack/ tag2 value=adj__short__/ Whenever a tag1 is followed by a tag 2, I want to retrieve the values of the tag1:name and tag2:value attributes. So my end result here should be john, tall jack, short My low quality regexp re.compile('tag1.+?name=(.+?).*?(?!tag1).*?=adj__(.*?)__', re.DOTALL) cannot handle the case where there is a tag1 that is not followed by a tag2. findall returns john, tall joe, short Ideas? Thanks. -- http://mail.python.org/mailman/listinfo/python-list
Re: sum and strings
Steven D'Aprano wrote: On Fri, 18 Aug 2006 19:08:37 -0700, Paul Rubin wrote: If the args are strings, the above is a quadratic time algorithm and it's better to throw an error than create such a trap for an unwary user. That's a nonsense argument. There is no shortage of slow algorithms, and some of them are built into Python. When did O(n**2) become an error condition? And overhead matters: if I'm only doing a few concatenations, it is significantly faster to add the strings using + than to use join() (at least in Python 2.3 -- YMMV): s = timeit.Timer(''.join(L), L=['a'*50, 'b'*50, 'c'*50]) s.timeit() 1.3470098972320557 t = timeit.Timer(a+b+c, a,b,c = 'a'*50, 'b'*50, 'c'*50) t.timeit() 1.0698421001434326 There's a word for optimizations that actually result in code running 25% slower. I applaud that Python's language developers care about efficiency. I applaud that the documentation warns people about traps and potential areas of inefficiency. But I think it is a shame that sum() does a special type-check to avoid something which is only sometimes slow. It doesn't protect against O(n**2) performance; it merely protects against just one of an infinite number of possible traps for the unwary. I would have thought it would be better for sum() to raise a warning, not an exception. If we take seriously the argument that sum implies addition, and that string concatenation isn't really addition, then sum() should also refuse to operate on lists and tuples and any other non-numeric class. Either would be better than sum() protecting the user from himself, except when it doesn't. Well, present that on python-dev. Georg -- http://mail.python.org/mailman/listinfo/python-list
Re: Input from the same file as the script
Dennis Lee Bieber wrote: Can the input to the python script be given from the same file as the script itself. e.g., when we execute a python script with the command 'python scriptName', can the input be given in someway ? Redirecting? Ugh... Off-hand, I'd say NO There is no way to tell the python interpreter where the program ends and the run data begins. maybe, as an UGLY hack he coud use some the comments -- Under construction -- http://mail.python.org/mailman/listinfo/python-list
Re: Regular Expression question
[EMAIL PROTECTED] wrote: Hi, I am having some difficulty trying to create a regular expression. Consider: tag1 name=john/ br/ tag2 value=adj__tall__/ tag1 name=joe/ tag1 name=jack/ tag2 value=adj__short__/ Whenever a tag1 is followed by a tag 2, I want to retrieve the values of the tag1:name and tag2:value attributes. So my end result here should be john, tall jack, short My low quality regexp re.compile('tag1.+?name=(.+?).*?(?!tag1).*?=adj__(.*?)__', re.DOTALL) cannot handle the case where there is a tag1 that is not followed by a tag2. findall returns john, tall joe, short Ideas? Have you tried this: 'tag1.+?name=(.+?).*?(?=tag2).*?=adj__(.*?)__' ? HTH, Rob -- http://mail.python.org/mailman/listinfo/python-list
Re: Small Troll on notation of variables over time
Hendrik van Rooyen wrote: What do you guys think? You could get something similar using an object, such as class Hist(object): def __init__(self): self.vals = [None] def __call__(self, index=-1): return self.vals[index] def set(self, val): self.vals.append(val) a = Hist() a.set(5) print a() a.set('hi there') print a() print a(-2) Which prints 5 hi there 5 -- Jeremy Sanders http://www.jeremysanders.net/ -- http://mail.python.org/mailman/listinfo/python-list
Re: What do you want in a new web framework?
Marc 'BlackJack' Rintsch wrote: emrahayanoglu wrote: Now i want to listen all of you. What do you want in that web framework(Easy use of Database, Easy use of XML, GUI Designer, etc...)? Don't think that yet another Python web framework is really needed. Why not? I know that some people are probably basking in the glory of supposedly having their favourite framework recently blessed by the BDFL, whilst others lament the almost unfair rejection of their own framework on possibly dubious grounds by the very same person (thus seeing their winner takes all strategy backfire totally), but open source and various other network-effect movements benefit from lots of people trying different things (the scratch your own itch observation) rather than everyone gathering together for one big strategy meeting. Certainly, I'd recommend against anyone starting out on such a project without having at least looked at the state of the Web frameworks scene [1] and Python Web programming in general [2] (a resource which I've recently updated in order to remove a degree of incoherency introduced over the years), but apart from some Zope-based tools, I haven't seen much GUI-designer-friendly stuff in the Python frameworks scene, for example, nor does XML (in its widest W3C sense) seem to be well-integrated into most frameworks (4Suite and some other less hyped frameworks aside). So it's not just a case of picking one of the more popular frameworks-du-jour, especially since many of them seem to have their own wheel-reinvention tendencies despite protests to the contrary. Paul [1] http://wiki.python.org/moin/WebFrameworks [2] http://wiki.python.org/moin/WebProgramming -- http://mail.python.org/mailman/listinfo/python-list
Re: Regular Expression question
Thanks, i just tried it but I got the same result. I've been thinking about it for a few hours now and the problem with this approach is that the .*? before the (?=tag2) may have matched a tag1 and i don't know how to detect it. And even if I could, how would I make the search reset its start position to the second tag1 it found? -- http://mail.python.org/mailman/listinfo/python-list
Re: sum and strings
Alex Martelli wrote: In terms of performance, however, the simple loop that you (rhamph) posted is generally best -- e.g., with Python 2.5c1 on a MacbookPro: brain:~/downloads alex$ python -mtimeit -s'deep=[range(9)]*9' 's=sum(deep,[])' 10 loops, best of 3: 11.2 usec per loop brain:~/downloads alex$ python -mtimeit -s'deep=[range(9)]*9' 's=[] for sublist in deep: s.extend(sublist)' 10 loops, best of 3: 6.92 usec per loop at least on this machine, map(s.extend) is slightly faster than the loop: timeit -sdeep=[range(9)]*9 s=[] for sublist in deep: s.extend(sublist) 10 loops, best of 3: 5.59 usec per loop timeit -sdeep=[range(9)]*9 s=[] map(s.extend, deep) 10 loops, best of 3: 5.26 usec per loop /F -- http://mail.python.org/mailman/listinfo/python-list
Re: Regular Expression question
I am not expert of REs yet, this my first possible solution: import re txt = tag1 name=john/ br/ tag2 value=adj__tall__/ tag1 name=joe/ tag1 name=jack/ tag2 value=adj__short__/ tfinder = r# The opening the tag to find \s* # Possible space or newline (tag[12]) # First subgroup, the identifier, tag1 or tag2 \s+ # There must be a space or newline or more (?:name|value) # Name or value, non-grouping \s* # Possible space or newline = # The = \s* # Possible space or newline # Opening ([^]*)# Second subgroup, the tag string, it can't contain # Closing of the string \s* # Possible space or newline /? # One optional ending / \s* # Possible space or newline # The closing of the tag ?# Greedy, match the first closing patt = re.compile(tfinder, flags=re.I+re.X) prec_type = prec_string = for mobj in patt.finditer(txt): curr_type, curr_string = mobj.groups() if curr_type == tag2 and prec_type == tag1: print prec_string, curr_string.replace(adj__, ).strip(_) prec_type = curr_type prec_string = curr_string Bye, bearophile -- http://mail.python.org/mailman/listinfo/python-list
Re: Detect current virtual desktop
Maciej Bliziński wrote: How to detect current virtual desktop in GNOME? How to detect a virtual desktop change? Take a look at http://wallpapoz.sourceforge.net/ Harald -- http://mail.python.org/mailman/listinfo/python-list
Re: sum and strings
Steven D'Aprano wrote: That's a nonsense argument. There is no shortage of slow algorithms, and some of them are built into Python. When did O(n**2) become an error condition? And overhead matters: if I'm only doing a few concatenations, it is significantly faster to add the strings using + than to use join() (at least in Python 2.3 -- YMMV): s = timeit.Timer(''.join(L), L=['a'*50, 'b'*50, 'c'*50]) s.timeit() 1.3470098972320557 t = timeit.Timer(a+b+c, a,b,c = 'a'*50, 'b'*50, 'c'*50) t.timeit() 1.0698421001434326 and what exactly does the fact that Python can do operator-based dispatch much faster than it can do method-based dispatch have to do with sum's inability to add strings ? did you have some kind of zero overhead for some function calls optimization in mind ? /F -- http://mail.python.org/mailman/listinfo/python-list
Re: Small Troll on notation of variables over time
You are about 7 months early. -- Piet van Oostrum [EMAIL PROTECTED] URL: http://www.cs.uu.nl/~piet [PGP 8DAE142BE17999C4] Private email: [EMAIL PROTECTED] -- http://mail.python.org/mailman/listinfo/python-list
Re: Regular Expression question
[EMAIL PROTECTED] wrote: Thanks, i just tried it but I got the same result. I've been thinking about it for a few hours now and the problem with this approach is that the .*? before the (?=tag2) may have matched a tag1 and i don't know how to detect it. Maybe like this: 'tag1.+?name=(.+?).*?(?:)(?=tag2).*?=adj__(.*?)__' HTH, Rob -- http://mail.python.org/mailman/listinfo/python-list
Re: Regular Expression question
got zero results on this one :) -- http://mail.python.org/mailman/listinfo/python-list
Re: Regular Expression question
[EMAIL PROTECTED] wrote: Hi, I am having some difficulty trying to create a regular expression. Consider: tag1 name=john/ br/ tag2 value=adj__tall__/ tag1 name=joe/ tag1 name=jack/ tag2 value=adj__short__/ Whenever a tag1 is followed by a tag 2, I want to retrieve the values of the tag1:name and tag2:value attributes. So my end result here should be john, tall jack, short import re data = tag1 name=john/ br/ tag2 value=adj__tall__/ tag1 name=joe/ tag1 name=jack/ tag2 value=adj__short__/ elems = re.findall((tag1|tag2)\s+(\w+)=\([^\]*)\/, data) for i in range(len(elems)-1): if elems[i][0] == tag1 and elems[i+1][0] == tag2: print elems[i][2], elems[i+1][2] /F -- http://mail.python.org/mailman/listinfo/python-list
Re: Python for EXIF-info-additions ?
I think you can find what do you need into this repository, it's a creative commons tool: https://svn.berlios.de/svnroot/repos/cctools/publisher/branches/flickr-storage-branch/ take a look in the follow directory: ccpublisher/jpeg/ I'm not sure if it's what you want, let me know. See you, Dilly On 8/21/06, Michele Petrazzo [EMAIL PROTECTED] wrote: Bror Johansson wrote: Is there somewhere some Python-module that can be used for adding EXIF-info to JPEG files? (Modules for extraction of EXIF-data are easily found, but lacks - as I see it - capacity to add new tags.) Hi, this is a feature that I want to add to FreeImagePy. It's not so difficult, but now I haven't time to do it. If you want to spend some hours for make enjoying yourself and all the python community, email me! :) /BJ Bye, Michele -- http://mail.python.org/mailman/listinfo/python-list -- http://mail.python.org/mailman/listinfo/python-list
RE: how to use python com server in c++?
Hello, you have to use the low level API methods for access and then the methods of IDispatch since the win32com gateway only supports late bound calls for dispatch interfaces. e.g. IDispatch* pDisp; CoCreateInstance( ... CLSID_Leelay, , IID_IDispatch, ...pDisp); // Add Call without any error checking LCID lcid = LOCALE_USER_DEFAULT; OLECHAR* pwszName = _T(Add); DISPID dispid; pDispatch-GetIDsOfNames(IID_NULL, pwszName, 1, lcid, dispid); VARIANTARG vargsArgs[2]; VariantInit(vargsArgs[0]); VariantInit(vargsArgs[1]); vargsArgs[0].vt = VT_I4; vargsArgs[0].lVal = 5; vargsArgs[1].vt = VT_I4; vargsArgs[1].lVal = 8; DISPPARAMS dispparParams = {vargsArgs, 0, 1, NULL}; VARIANT varResult; VariantInit( varResult); HRESULT hr = pDispatch-Invoke(dispid, IID_NULL, lcid, DISPATCH_METHOD, dispparParams, varResult, NULL, NULL); Or use a library which has some support for late bound calls, e.g. ATL: CComQIPtrIDispatch spIDispatch; hr = spIDispatch.CoCreateInstance(CLSID_ComServer); CComDispatchDriver spSumDisp(spIDispatch); CComVariant svarcResult; CComVariant svarcParam1(5); CComVariant svarcParam2(8); spSumDisp.Invoke2(LAdd, svarcParam1, svarcParam1, svarcResult); Stefan -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Leo Jay Sent: Saturday, August 19, 2006 5:23 PM To: python-list@python.org Subject: how to use python com server in c++? dear all, i have a python com server like this: import win32com.server.register class HelloWorld: _reg_clsid_ = {B0EB5AAB-0465-4D54-9CF9-04ADF7F73E4E} _reg_desc_ = 'Python test com server' _reg_progid_= Leojay.ComServer _public_methods_= ['Add', 'Mul'] def Add(self, a, b): return a+b def Mul(self, a, b): return a*b if __name__ == '__main__': win32com.server.register.UseCommandLine(HelloWorld) after registering the com server, i can use it in visual basic .net: Dim a As Integer = 5 Dim b As Integer = 8 Dim h As Object = CreateObject(Leojay.ComServer) MsgBox(h.Add(a, b).ToString() + + h.Mul(a, b).ToString()) but i don't know how to use it in visual c++. who has any idea about using this com server in viusal c++? a detailed sample of early binding would be better, thanks. -- Best Regards, Leo Jay -- http://mail.python.org/mailman/listinfo/python-list -- http://mail.python.org/mailman/listinfo/python-list
Re:
wrote: Hi guys, we are looking for a python developer for a European project. This project is multilangual and free it is called EuroCv and it need a module for exporting data in PDF. As web developer I try to create this module but It's too complicate for me. Check out the service www.eurocv.eu for more details. Contact us by Skype chat system our nick is eurocv. Thanks have you looked at the reportlab module? http://www.reportlab.org/ -- http://mail.python.org/mailman/listinfo/python-list
IDLE with python 2.5
Hi, I've just read in Python 2.5 description that IDLE 'executes code in a separate process', using a TCP connection on port 127.0.0.1 to communicate. Does it mean that we can now debug embedded python with IDLE ? Thanks for any feedback, Emmanuel -- http://mail.python.org/mailman/listinfo/python-list
Re: Regular Expression question
[EMAIL PROTECTED] wrote: Hi, I am having some difficulty trying to create a regular expression. Steve, I find this tool is great for debugging regular expressions. http://kodos.sourceforge.net/ Just put some sample text in one window, your trial RE in another, and Kodos displays a wealth of information on what matches. Try it. - Paddy. -- http://mail.python.org/mailman/listinfo/python-list
Re: Python and STL efficiency
Fredrik Lundh wrote: in the Python example, the four strings in your example are shared, so you're basically copying 4 pointers to the list. in the C++ example, you're creating 4 string objects. /F In which case, Licheng, you should try using the /GF switch. This will tell Microsoft C++ compiler to pool identical string literals together. :) -- http://mail.python.org/mailman/listinfo/python-list
Re: What do you want in a new web framework?
[EMAIL PROTECTED] wrote: Hello Everyone, Now, I'm working on a new web framework. I tried many test on the other programming languages. Then i decided to use python on my web framework project. Now i want to listen all of you. What do you want in that web framework(Easy use of Database, Easy use of XML, GUI Designer, etc...)? I'm wating your answers. Thank you for all answers...! King Regards, Emrah Ayanoglu Nothing in particular. But I would like to know about portability issues of frameworks between different implementations of Python. A pythonic, yet existing webframework allocating Java / dotNet resources could find its niche. -- http://mail.python.org/mailman/listinfo/python-list
Re: text editor suggestion?
John Salerno wrote: I'd really like to learn vim, but I spent days just trying to figure out how to get the syntax highlighting and indentation working, where these settings are and how to edit them, and it still doesn't work for me. It just feels so insurmountable that I can't even start working with it yet because I don't know how to tailor the settings. Create a vimrc file (if you use Unix: ~/.vimrc) with the following lines in it: syntax on set autoindent set smartindent If you find that using vim is hard, try using evim (easy vim). It is part of the standard vim distribution (actually it's the same program). Anyway, I suggest learning the classic modal vim, it's really worth it. -- Roberto Bonvallet -- http://mail.python.org/mailman/listinfo/python-list
Re: Python for EXIF-info-additions ?
Bruno Dilly wrote: I think you can find what do you need into this repository, it's a creative commons tool: https://svn.berlios.de/svnroot/repos/cctools/publisher/branches/flickr-storage-branch/ take a look in the follow directory: ccpublisher/jpeg/ I'm not sure if it's what you want, let me know. This is more and more times harder than I need! This code add the exif tags to the image by itself, but I need only to wrap and add some python code for make freeimagepy talk with the tags freeimage's functions. Only this! All the tags code for add/remove/modify them are already inside freeimage! See you, Dilly Bye, Michele -- http://mail.python.org/mailman/listinfo/python-list
Re: Python and STL efficiency
Ray wrote: in the C++ example, you're creating 4 string objects. In which case, Licheng, you should try using the /GF switch. This will tell Microsoft C++ compiler to pool identical string literals together. in what way does that change the implementation of C++'s string type ? /F -- http://mail.python.org/mailman/listinfo/python-list
Re: Py_BuildValue(I, ...) does not work
Martin Kulas [EMAIL PROTECTED] wrote: I have a problem with Py_BuildValue: I want to convert an unsigned int to a PyObject *. http://docs.python.org/api/arg-parsing.html says that I can use I as a format string. But it does not work :-\ I tried your examples under linux. It fails under python 2.3 in the same fashion as you noted, but works under 2.4. On my system (debian/testing) I have python 2.4.4c0 installed. Handling of these sized integers 0x8000 changed from 2.3 to 2.4 so maybe this was a fixed bug? I can't seem to find the point release changelogs though! $ python2.3 setup.py build $ cd build/lib.linux-i686-2.3/ $ python2.3 Python 2.3.5 (#2, Jun 13 2006, 23:12:55) [GCC 4.1.2 20060613 (prerelease) (Debian 4.1.1-4)] on linux2 Type help, copyright, credits or license for more information. import mini mini.foo() Traceback (most recent call last): File stdin, line 1, in ? SystemError: bad format char passed to Py_BuildValue $ python2.4 setup.py build $ cd build/lib.linux-i686-2.4 $ python2.4 Python 2.4.4c0 (#2, Jun 14 2006, 22:35:41) [GCC 4.1.2 20060613 (prerelease) (Debian 4.1.1-4)] on linux2 Type help, copyright, credits or license for more information. import mini mini.foo() 3735928495L -- Nick Craig-Wood [EMAIL PROTECTED] -- http://www.craig-wood.com/nick -- http://mail.python.org/mailman/listinfo/python-list
Re: MS SQL Server: NT Authentication. Possible?
code import adodbapi db = adodbapi.connect (Provider=sqloledb;Data Source=VODEV1;Initial Catalog=EVOBACK;Integrated Security=SSPI;) q = db.cursor () q.execute (SELECT SYSTEM_USER) print q.fetchone () q.close () /code Cool! That works :-) Thanks a lot (again) Tim! Have a great week Dirk -- http://mail.python.org/mailman/listinfo/python-list
Re: Help in using introspection to simplify repetitive code
Fredrik Lundh wrote: [EMAIL PROTECTED] wrote: And they do take arguments, and a variable number of them, so AFAIK hooking with __getattr__ or __getattribute__ will not work, as you can only get the method name with that. why not just return the bound method *object* (a callable), and let the caller call that as usual (see Terry's last example). (hint: x.foo() can be written f=getattr(x,foo); f()) /F I can tell you from my experience that this works; I've used this before to make something very much like this proxy-class: class RequestCalculations(object): def __init__(self, request): self.serviceType, self.facade = makeMessageFacadeInstance(request) return def __getattr__(self, name): return getattr(self.facade, name) (rest of the code omitted) Cheers, --Tim -- http://mail.python.org/mailman/listinfo/python-list
Re: Python and STL efficiency
Ray wrote: Fredrik Lundh wrote: in the Python example, the four strings in your example are shared, so you're basically copying 4 pointers to the list. in the C++ example, you're creating 4 string objects. /F In which case, Licheng, you should try using the /GF switch. This will tell Microsoft C++ compiler to pool identical string literals together. :) The code still creates a new string - instance each time it tries to append a const char* to the vectorstring ... You should instead create the string-objects ahead of time, outside of the loop. Regards, --Tim -- http://mail.python.org/mailman/listinfo/python-list
Re: Disable close button in management window.(KDE- pyQT)
HI, I am talking about the close button X, that appears when I execute my application (pyQt), in kde. Thanks.. David Boddie escreveu: Gabriel - BR wrote: Hi,,, Is possible disable the close button in KDE management window? Using python+qt? Can you say exactly which window you're talking about? The Control Center or something else? David -- http://mail.python.org/mailman/listinfo/python-list
Re: Python and STL efficiency
Licheng Fang wrote: I was using VC++.net and IDLE, respectively. I had expected C++ to be way faster. However, while the python code gave the result almost instantly, the C++ code took several seconds to run! Can somebody explain this to me? Or is there something wrong with my code? It must be the debugging, the compiler or a poor STL implementation. With gcc 4 it runs instantly on my computer (using -O2), even with 10x the number of values. If the problem is that C++ has to make lots of new strings, as other posters have suggested, then you could do something like const string foo = What do you know?; for (long int i=0; i1 ; ++i){ a.push_back(foo); ... } as many C++ implementations use reference counting for identical strings. Jeremy -- Jeremy Sanders http://www.jeremysanders.net/ -- http://mail.python.org/mailman/listinfo/python-list
Re: Python and STL efficiency
Jeremy Sanders a écrit : Licheng Fang wrote: I was using VC++.net and IDLE, respectively. I had expected C++ to be way faster. However, while the python code gave the result almost instantly, the C++ code took several seconds to run! Can somebody explain this to me? Or is there something wrong with my code? It must be the debugging, the compiler or a poor STL implementation. With gcc 4 it runs instantly on my computer (using -O2), even with 10x the number of values. If the problem is that C++ has to make lots of new strings, as other posters have suggested, then you could do something like const string foo = What do you know?; for (long int i=0; i1 ; ++i){ a.push_back(foo); ... } as many C++ implementations use reference counting for identical strings. Jeremy As a matter of fact, do not count on that. Use a vectorstring* just in case. -- http://mail.python.org/mailman/listinfo/python-list
Re: Python and STL efficiency
Tim N. van der Leeuw wrote: Ray wrote: Fredrik Lundh wrote: in the Python example, the four strings in your example are shared, so you're basically copying 4 pointers to the list. in the C++ example, you're creating 4 string objects. /F In which case, Licheng, you should try using the /GF switch. This will tell Microsoft C++ compiler to pool identical string literals together. :) The code still creates a new string - instance each time it tries to append a const char* to the vectorstring ... You should instead create the string-objects ahead of time, outside of the loop. Regards, --Tim Alternatively, slow down the Python implementation by making Python allocate new strings each time round: a.append('%s' % 'What do you know') ... for each of your string-appends. But even then, the python-code is still near-instant. Cheers, --Tim -- http://mail.python.org/mailman/listinfo/python-list
Re: Small Troll on notation of variables over time
Piet van Oostrum [EMAIL PROTECTED] Wrote: | You are about 7 months early. | -- Am I? - Early for what - a seven months premature baby is small indeed... - Hendrik -- http://mail.python.org/mailman/listinfo/python-list
Re: Small Troll on notation of variables over time
Jeremy Sanders [EMAIL PROTECTED] wrote: | Hendrik van Rooyen wrote: | | What do you guys think? | | You could get something similar using an object, such as | | class Hist(object): | | def __init__(self): | self.vals = [None] | | def __call__(self, index=-1): | return self.vals[index] | | def set(self, val): | self.vals.append(val) | | a = Hist() | | a.set(5) | print a() | | a.set('hi there') | print a() | print a(-2) | | Which prints | 5 | hi there | 5 - Sneaky! - I like this - Hendrik -- http://mail.python.org/mailman/listinfo/python-list
Re: Regular Expression question
On 2006-08-21, [EMAIL PROTECTED] [EMAIL PROTECTED] wrote: Hi, I am having some difficulty trying to create a regular expression. Consider: tag1 name=john/ br/ tag2 value=adj__tall__/ tag1 name=joe/ tag1 name=jack/ tag2 value=adj__short__/ Whenever a tag1 is followed by a tag 2, I want to retrieve the values of the tag1:name and tag2:value attributes. So my end result here should be john, tall jack, short Ideas? It seems to me that an html parser might be a better solution. Here's a slapped-together example. It uses a simple state machine. from HTMLParser import HTMLParser class MyHTMLParser(HTMLParser): def __init__(self): HTMLParser.__init__(self) self.state = get name self.name_attrs = None self.result = {} def handle_starttag(self, tag, attrs): if self.state == get name: if tag == tag1: self.name_attrs = attrs self.state = found name elif self.state == found name: if tag == tag2: name = None for attr in self.name_attrs: if attr[0] == name: name = attr[1] adj = None for attr in attrs: if attr[0] == value and attr[1][:3] == adj: adj = attr[1][5:-2] if name == None or adj == None: print Markup error: expected attributes missing. else: self.result[name] = adj self.state = get name elif tag == tag1: # A new tag1 overrides the old one self.name_attrs = attrs p = MyHTMLParser() p.feed( tag1 name=john/ br/ tag2 value=adj__tall__/ tag1 name=joe/ tag1 name=jack/ tag2 value=adj__short__/ ) print repr(p.result) p.close() There's probably a better way to search for attributes in attr than for attr in attrs, but I didn't think of it, and the example I found on the net used the same idiom. The format of attrs seems strange. Why isn't it a dictionary? -- Neil Cerutti Sermon Outline: I. Delineate your fear II. Disown your fear III. Displace your rear --Church Bulletin Blooper -- http://mail.python.org/mailman/listinfo/python-list
Re: What do you want in a new web framework?
On 8/20/06, Dave Richards [EMAIL PROTECTED] wrote: Really, really good documentation. Dave ... Which is the one thing no Python web framework provides. :( A framework with really good documentation (preferably translated into multiple languages) would be, I'm sure, the PHP/Ruby on Rails killer everyone seem to hope for. On 20 Aug 2006 11:58:50 -0700, [EMAIL PROTECTED] [EMAIL PROTECTED] wrote: Hello Everyone, Now, I'm working on a new web framework. I tried many test on the other programming languages. Then i decided to use python on my web framework project. Now i want to listen all of you. What do you want in that web framework(Easy use of Database, Easy use of XML, GUI Designer, etc...)? I'm wating your answers. Thank you for all answers...! King Regards, Emrah Ayanoglu -- http://mail.python.org/mailman/listinfo/python-list -- http://mail.python.org/mailman/listinfo/python-list -- mvh Björn -- http://mail.python.org/mailman/listinfo/python-list
Re: Regular Expression question
[EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] Hi, I am having some difficulty trying to create a regular expression. Consider: tag1 name=john/ br/ tag2 value=adj__tall__/ tag1 name=joe/ tag1 name=jack/ tag2 value=adj__short__/ Whenever a tag1 is followed by a tag 2, I want to retrieve the values of the tag1:name and tag2:value attributes. So my end result here should be john, tall jack, short A pyparsing solution may not be a speed demon to run, but doesn't take too long to write. Some short explanatory comments: - makeHTMLTags returns a tuple of opening and closing tags, but this example does not use any closing tags, so simpler to just discard them (only use zero'th return value) - Your example includes not only tag1 and tag2 tags, but also a br tag, which is presumably ignorable. - The value returned from calling the searchString generator includes named fields for the different tag attributes, making it easy to access the name and value tag attributes. - The expression generated by makeHTMLTags will also handle tags with other surprising attributes that we didn't anticipate (such as br clear='all'/ or tag2 value='adj__short__' modifier='adv__very__'/) - Pyparsing leaves the values as adj__tall__ and adj__short__, but some simple string slicing gets us the data we want The pyparsing home page is at http://pyparsing.wikispaces.com. -- Paul from pyparsing import makeHTMLTags tag1 = makeHTMLTags(tag1)[0] tag2 = makeHTMLTags(tag2)[0] br = makeHTMLTags(br)[0] # define the pattern we're looking for, in terms of tag1 and tag2 # and specify that we wish to ignore br tags patt = tag1 + tag2 patt.ignore(br) for tokens in patt.searchString(data): print %s, %s % (tokens.startTag1.name, tokens.startTag2.value[5:-2]) Prints: john, tall jack, short Printing tokens.dump() gives: ['tag1', ['name', 'jack'], True, 'tag2', ['value', 'adj__short__'], True] - empty: True - name: jack - startTag1: ['tag1', ['name', 'jack'], True] - empty: True - name: jack - startTag2: ['tag2', ['value', 'adj__short__'], True] - empty: True - value: adj__short__ - value: adj__short__ -- http://mail.python.org/mailman/listinfo/python-list
Problem of function calls from map()
Hi, there. 'lines' is a large list of strings each of which is seperated by '\t' lines = ['bla\tbla\tblah', 'bh\tb\tb', ... ] I wanna split each string into a list. For speed, using map() instead of 'for' loop. 'map(str.split, lines)' works fine , but... when I was trying: l = map(str.split('\t'), lines) I got TypeError: 'list' object is not callable. To avoid function call overhead, I am not willing to use lambda function either. So how to put '\t' argument to split() in map() ? Thanks. -- http://mail.python.org/mailman/listinfo/python-list
Re: MS SQL Server: NT Authentication. Possible?
Very strange. It works when I directly run the script, but when I use this script as a CGI-script on a webserver, I get this error: File D:\Web\test\adodbapi.py, line 224, in connect raise DatabaseError(e) adodbapi.DatabaseError: (-2147352567, 'Exception occurred.', (0, 'Microsoft OLE DB Provider for SQL Server', Login failed for user '(null)'. Reason: Not associated with a trusted SQL Server connection., None, 0, -2147467259), None) The script on the webserver is started with the user who is logged on to the client-computer (not a webserver-user). I checked this with username = os.environ.get('REMOTE_USER') in the script. What's wrong when a webserver runs this script?! Dirk -- http://mail.python.org/mailman/listinfo/python-list
Dynamic RadioButton creation with Python + Qt
Hello, I'm trying to create dynamic RadioButton as follows: for i in out.keys(): msg = radioButton_ + str(i) msg2 = 20 * x msg = QRadioButton(self.buttonGroup_interfaces, msg) msg.setGeometry(QRect(30,msg2,121,23)) msg.setTect(i) x += 1 The problem is that Python is creating all RadioButton as msg and not the value of msg so i can't access the RadioButton after the creation. Is there a way i can create the RadioButton with diferent names?? Thanks in advance, Wagner. -- http://mail.python.org/mailman/listinfo/python-list
Re: Modules... paths... newbie confusion
MrBlueSky wrote: I wonder if someone could clarify how Python knows where modules are - or at least point to some documentation that might help me? Here's what I've been trying: I've installed Python 2.4 Windows, and have also installed tkinter, pmw, cx_Oracle, mssql and pytz (phew!) all under my c:\python24 folder. But when I try to import pytz or import MSSQL in a Python shell (via IDLE) it's not recognised - yet import Tkinter, import Pmw and import cx_Oracle all work. I've experimented with sys.path to get the import of pytz to work, but without success so far. I feel as if I'm missing some key piece of information on how this all fits together! Please, help! John You may have to add the path of the module to a system environment variable PYTHONPATH to make it work. -- http://mail.python.org/mailman/listinfo/python-list
Re: Problem of function calls from map()
Dasn wrote: So how to put '\t' argument to split() in map() ? How much is the lambda costing you, according to your profiler? Anyway, what you really want is a list comprehension: l = [line.split('\t') for line in lines] -- http://mail.python.org/mailman/listinfo/python-list
Re: write eof without closing
On 2006-08-21, Alex Martelli [EMAIL PROTECTED] wrote: Grant Edwards [EMAIL PROTECTED] wrote: ... IIRC, ctrl-Z is not used _in_files_ to represent EOF. Only when text is being entered at the console. Easy to test, if you have Windows: I might, but I won't admit it in public. :) n='foo.txt' s='ba\r\n'+chr(26)+'bo\r\r' open(n,'wb').write(s) ss=open(n).read() ss 'ba\n' As you see, in _text_ files on Windows a control-Z (char(26), AKA '\x1a') does indeed represent end of file -- a convention going back to CP/M (which lacked metadata to represent file length except in multiples of 256 characters, if I recall correctly) That's correct. and is still followed by Windows (and by Python running on Windows). Very interesting. I thought that windows had abandoned that. I remember having problems under DOS/Windows caused by an old text editor that put a ctrl-Z at the end of the file -- probably a result of the other programs reading the file in binary mode and seeing the ctrl-Z. Nevertheless I doubt it would help the original poster -- I think, like /F and you, that a line-end and flush may be what he needs. -- Grant Edwards grante Yow! Am I elected yet? at visi.com -- http://mail.python.org/mailman/listinfo/python-list
Re: Dynamic RadioButton creation with Python + Qt
Wagner Garcia Campagner wrote: I'm trying to create dynamic RadioButton as follows: for i in out.keys(): msg = radioButton_ + str(i) msg2 = 20 * x msg = QRadioButton(self.buttonGroup_interfaces, msg) msg.setGeometry(QRect(30,msg2,121,23)) msg.setTect(i) x += 1 The problem is that Python is creating all RadioButton as msg and not the value of msg so i can't access the RadioButton after the creation. Is there a way i can create the RadioButton with diferent names?? if you want to keep track of a list of things, store them in a list. /F -- http://mail.python.org/mailman/listinfo/python-list
How to decode a string
To be able to decode a string successfully, I need to know what coding it is in. The string can be coded in utf8 or in windows-1250 or in another coding. Is there a method how to find out the string coding. Thank you for help L. -- http://mail.python.org/mailman/listinfo/python-list
Re: permanent tempfile?
Colin I am trying to create a temp file, however the file that is Colin created is still there after the program has completed. Why is Colin this so? After you call os.remove(filename) it's still there? My version of your script works for me: import tempfile, os filename = tempfile.mkstemp()[1] print filename # test it ... fout = open(filename, 'w') fout.write(just a text file) fout.close() os.remove(filename) print os.path.exists(filename) Running it I get this output: /tmp/tmp6CUDA- False Maybe the semantics on Windows are different. Skip -- http://mail.python.org/mailman/listinfo/python-list
Re: Regular Expression question
[EMAIL PROTECTED] wrote: got zero results on this one :) Really? s = '''tag1 name=john/ br/ tag2 value=adj__tall__/ tag1 name=joe/ tag1 name=jack/ tag2 value=adj__short__/''' pat = re.compile('tag1.+?name=(.+?).*?(?:)(?=tag2).*?=adj__(.*?)__', re.DOTALL) m = re.findall(pat, s) m [('john', 'tall'), ('joe', 'short')] Regards, Rob -- http://mail.python.org/mailman/listinfo/python-list
Re: Modules... paths... newbie confusion
MrBlueSky schrieb: I wonder if someone could clarify how Python knows where modules are - or at least point to some documentation that might help me? Here's what I've been trying: I've installed Python 2.4 Windows, and have also installed tkinter, pmw, cx_Oracle, mssql and pytz (phew!) all under my c:\python24 folder. But when I try to import pytz or import MSSQL in a Python shell (via IDLE) it's not recognised - yet import Tkinter, import Pmw and import cx_Oracle all work. Normally extensions should go into a subdirectory of c:\python24\Lib\site-packages. Everything that comes with a windows installer usually installs itself exactly there. In those cases no messing about with PYTHONPATH or sys.path should be necessary. HTH Koczian -- Dr. Sibylle Koczian Universitaetsbibliothek, Abt. Naturwiss. D-86135 Augsburg e-mail : [EMAIL PROTECTED] -- http://mail.python.org/mailman/listinfo/python-list
Re: Problem of function calls from map()
Dasn wrote: Hi, there. 'lines' is a large list of strings each of which is seperated by '\t' lines = ['bla\tbla\tblah', 'bh\tb\tb', ... ] I wanna split each string into a list. For speed, using map() instead of 'for' loop. 'map(str.split, lines)' works fine , but... when I was trying: l = map(str.split('\t'), lines) I got TypeError: 'list' object is not callable. To avoid function call overhead, I am not willing to use lambda function either. So how to put '\t' argument to split() in map() ? You can't. Use a lambda or list-comprehension. map(lambda l: l.split(\t), lines) [l.split(\t) for l in lines] Diez -- http://mail.python.org/mailman/listinfo/python-list
Re: istep() addition to itertool? (Was: Re: Printing n elements per line in a list)
On 2006-08-19, Rhamphoryncus [EMAIL PROTECTED] wrote: unexpected wrote: If have a list from 1 to 100, what's the easiest, most elegant way to print them out, so that there are only n elements per line. I've run into this problem a few times, and although many solutions have been presented specifically for printing I would like to present a more general alternative. from itertools import chain def istepline(step, iterator): i = 0 while i step: yield iterator.next() i += 1 def istep(iterable, step): iterator = iter(iterable) # Make sure we won't restart iteration while True: # We rely on istepline()'s side-effect of progressing the # iterator. start = iterator.next() rest = istepline(step - 1, iterator) yield chain((start,), rest) for i in rest: pass # Exhaust rest to make sure the iterator has # progressed properly. Would anybody else find this useful? Maybe worth adding it to itertool? Your note me curious enough to re-read the itertools documentation, and I found the following in 5.16.3 Recipes: def grouper(n, iterable, padvalue=None): grouper(3, 'abcdefg', 'x') -- ('a','b','c'), ('d','e','f'), ('g','x','x') return izip(*[chain(iterable, repeat(padvalue, n-1))]*n) Wish I'd found that yesterday. ;) -- Neil Cerutti -- http://mail.python.org/mailman/listinfo/python-list
Re: How to decode a string
Lad wrote: To be able to decode a string successfully, I need to know what coding it is in. ask whoever provided the string. The string can be coded in utf8 or in windows-1250 or in another coding. Is there a method how to find out the string coding. in general, no. if you have enough text, you may guess, but the right approach for that depends on the application. /F -- http://mail.python.org/mailman/listinfo/python-list
Re: Dynamic RadioButton creation with Python + Qt
Thanks Fredrik, Your suggestion solved my problems! Thanks, Wagner. From: Fredrik Lundh [EMAIL PROTECTED] To: python-list@python.org Subject: Re: Dynamic RadioButton creation with Python + Qt Date: Mon, 21 Aug 2006 16:20:09 +0200 Wagner Garcia Campagner wrote: I'm trying to create dynamic RadioButton as follows: for i in out.keys(): msg = radioButton_ + str(i) msg2 = 20 * x msg = QRadioButton(self.buttonGroup_interfaces, msg) msg.setGeometry(QRect(30,msg2,121,23)) msg.setTect(i) x += 1 The problem is that Python is creating all RadioButton as msg and not the value of msg so i can't access the RadioButton after the creation. Is there a way i can create the RadioButton with diferent names?? if you want to keep track of a list of things, store them in a list. /F -- http://mail.python.org/mailman/listinfo/python-list -- http://mail.python.org/mailman/listinfo/python-list
Re: Re:
Hi Keith Perkins Yes of course but we are looking for a developer who help us too. Keith Perkins wrote: wrote: Hi guys, we are looking for a python developer for a European project. This project is multilangual and free it is called EuroCv and it need a module for exporting data in PDF. As web developer I try to create this module but It's too complicate for me. Check out the service www.eurocv.eu for more details. Contact us by Skype chat system our nick is eurocv. Thanks have you looked at the reportlab module? http://www.reportlab.org/ -- http://mail.python.org/mailman/listinfo/python-list
Python Syntax Highlighting Module
Hello, I have an idea for a project which involves an editor that supports syntax highlighting. This would be for any language, particularly php, html, css, etc. I would like to write this program using python. It would only make sense to base this upon existing open source code. My question is there a python module or examples on how to write a code editor which supports modulated syntax highlighting? Thank you, Blaine -- http://mail.python.org/mailman/listinfo/python-list
Re: Create a Multilanguage PDF in Python
I can't upload in the PYTHONPATH but in a normal folder of our site. Exist another way to do it? Thanks Rob Wolfe wrote: Perseo wrote: Hi again, WORKS!!! I download all I need as python + reportlab. Only 2 questions: 1. I need all of this package? because it is 6Mb! I'm afraid you need all of it. BTW My reportlab package is only 3MB... hmm strange. 2. How can I connect my software with MySql. In my Hosting is present the Python support but I don't thing that the MySQLdb is present. How can I solve this little problem? You can install MySQLdb wherever you want. You need only to make sure the module is in your PYTHONPATH. HTH, Rob -- http://mail.python.org/mailman/listinfo/python-list
Re: Need advice on how to improve this function
Matthew Wilson wrote: I wrote a function that converts a tuple of tuples into html. For example: In [9]: x Out[9]: ('html', ('head', ('title', 'this is the title!')), ('body', ('h1', 'this is the header!'), ('p', 'paragraph one is boring.'), ('p', 'but paragraph 2 ', ('a', {'href': 'http://example.com'}, 'has a link'), '!'))) In [10]: as_html(x, sys.stdout) html head titlethis is the title!/title /head body h1this is the header!/h1 pparagraph one is boring./p pbut paragraph 2 a href=http://example.com;has a link/a!/p /body /html I'd like to know ways to make it better (more efficient, able to deal with enormous-size arguments, etc). How would I write this as a generator? Here's the definition for as_html: def as_html(l, s): Convert a list or tuple into html and write it to stream s. if isinstance(l, (tuple, list)): tagname = l[0] if isinstance(l[1], dict): attributes = ' '.join(['%s=%s' % (k, l[1][k]) for k in l[1]]) s.write('%s %s' % (tagname, attributes)) else: s.write('%s' % tagname) if tagname in ('html', 'head', 'body'): s.write('\n\n') for ll in l[1:]: as_html(ll, s) s.write('/%s' % tagname) if tagname not in ('a', 'b', 'ul'): s.write('\n\n') elif isinstance(l, str): s.write(l) All comments welcome. TIA Before you put too much work into this you might want to take a look at HTMLgen: http://www.python.net/crew/friedrich/HTMLgen/html/main.html -Larry -- http://mail.python.org/mailman/listinfo/python-list
Re: Python Syntax Highlighting Module
[EMAIL PROTECTED] wrote: Hello, I have an idea for a project which involves an editor that supports syntax highlighting. This would be for any language, particularly php, html, css, etc. I would like to write this program using python. It would only make sense to base this upon existing open source code. My question is there a python module or examples on how to write a code editor which supports modulated syntax highlighting? Google: SilverCity Cheers, Brian -- http://mail.python.org/mailman/listinfo/python-list
Re: uploading files to file system/zipping/downloading problems
OriginalBrownster wrote: I am currently uploading a file from a users computer to the file system on my server using python, just reading the file and writing the binaries. total_data=' ' while True: data = upload_file.file.read(8192) if not data: break total_data += data f = open(target_file_name, 'wb') f.write(total_data) f.close However when i download the file from the server it is not intact and it cannot be opened. It is happening with every type of file. It seemed to be working before and now it is..maybe I goofed up and deleted something. However I can't seem to find it. any ideas?? Two problems: First, If you start total_data with a single space (as it shows in your posted code). Then the output file has a space prepended to the file's contents and that is NOT what you probably wanted. Secondly, You are overwriting the files contents every time through the loop. Your open, would need to be outside the loop (above the while) and your close should be outside the loop also. Something more like: total_data='' f = open(target_file_name, 'wb') while True: data = upload_file.file.read(8192) if not data: break total_data += data f.write(total_data) f.close You should take a look at shutil module. It is copyfile method that makes your code must simpler (and faster I'm sure). do import shutl help(shutil.copyfile) import shutil shutil.copyfile(uload_file_name, target_file_name) -Larry Bates -- http://mail.python.org/mailman/listinfo/python-list
Re: What do you want in a new web framework?
Hello Everyone, I've just read all of the answers. Most of yours said that there are many web frameworks ,so it is nonsense to make a new web framework in python. Now I'm using and testing all of the frameworks in python also asp.net, jsp and java servlet, perl web frameworks and ruby on rails. Some of them have good positive points like that asp.net have gridviews to show data records, ruby on rails have ajax support, etc... The framework that i'll make, includes most of the positive points of the other frameworks. Maybe, it's a mix of web frameworks. I want to use dojo toolkit for javascript in my framework, and make a gui designer like Visual Studio and Sun Creator, etc... After that, may be you'll change your mind. And i want to listen your advices. Please feel free to say everything to me about framework. I'm waiting your answers. Best Regards, Emrah Ankara/Turkey -- http://mail.python.org/mailman/listinfo/python-list