Re: More version woes

2010-01-18 Thread Steven D'Aprano
On Sun, 17 Jan 2010 23:15:28 -0800, Jive Dadson wrote: > Sorry. That deprecation warning has nothing to do with the slowness. It > does torque my jaw, however. Komodo costs money, and Python 2.6 broke > it. @#^&!!! (Again.) > > So, the new question is, does anyone know how to make Komodo 3.5 ru

Re: More version woes

2010-01-18 Thread Jive Dadson
Steven D'Aprano wrote: On Sun, 17 Jan 2010 23:15:28 -0800, Jive Dadson wrote: Sorry. That deprecation warning has nothing to do with the slowness. It does torque my jaw, however. Komodo costs money, and Python 2.6 broke it. @#^&!!! (Again.) So, the new question is, does anyone know how to ma

Re: C-API: Get scope in function

2010-01-18 Thread moerchendiser2k3
Perfect, this helped me a lot, thx! :) -- http://mail.python.org/mailman/listinfo/python-list

Re: How to install local module other than in "site-packages"?

2010-01-18 Thread Jive Dadson
Thankee. I had just figgered that out. I wrote everything up in a message titled "The answer," but I accidentally created a new thread with it. I'll post it in this thread. -- http://mail.python.org/mailman/listinfo/python-list

Re: More version woes

2010-01-18 Thread Steven D'Aprano
On Mon, 18 Jan 2010 00:08:35 -0800, Jive Dadson wrote: >> I suspect that they'll probably tell you that since the latest version >> of Komodo is 5.2, and you're using 3.5, you should stop using a version >> that is over four years old and almost certainly not supported. >> >> >> > Yep. They wa

Re: enhancing 'list'

2010-01-18 Thread Peter Otten
samwyse wrote: > Lately, I've slinging around a lot of lists, and there are some simple > things I'd like to do that just aren't there. > > s.count(x[, cmp[, key]]) > - return number of i‘s for which s[i] == x. 'cmp' specifies a custom > comparison function of two arguments, as in '.sort'. 'key

LAST CALL FOR PAPERS: TOOLS EUROPE 2010

2010-01-18 Thread Lorenzo Bettini
== LAST CALL FOR PAPERS (Deadline: January 22, 2010) TOOLS EUROPE 2010 48th International Conference Objects, Models, Compone

ctypes: nested structures and pointers

2010-01-18 Thread Gabriele Modena
Hi all, I am trying to learn ctypes and I am facing some problems In wrapping two nested structs. <--- begin C code > struct dev_callbacks;// Prototype the callback struct typedef struct { const struct dev_callbacks* pdc; char acName[DEVICE_NAME_LENGTH]; chip_type ct;

Generic Python Benchmark suite?

2010-01-18 Thread Anand Vaidya
Is there a generic python benchmark suite in active development? I am looking forward to comparing some code on various python implementations (primarily CPython 2.x, CPython 3.x, UnladenSwallow, Psyco). I am happy with something that gives me a relative number eg: ULS is 30% faster than CPy2.x et

Re: substitution

2010-01-18 Thread superpollo
superpollo ha scritto: hi. what is the most pythonic way to substitute substrings? eg: i want to apply: foo --> bar baz --> quux quuux --> foo so that: fooxxxbazyyyquuux --> barxxxquuxyyyfoo bye i explain better: say the subs are: quuux --> foo foo --> bar baz --> quux then i cannot ap

substitution

2010-01-18 Thread superpollo
hi. what is the most pythonic way to substitute substrings? eg: i want to apply: foo --> bar baz --> quux quuux --> foo so that: fooxxxbazyyyquuux --> barxxxquuxyyyfoo bye -- http://mail.python.org/mailman/listinfo/python-list

Re: More version woes

2010-01-18 Thread Diez B. Roggisch
Yep. They want $295, and I cannot justify that for personal use. I'll be looking for a cheaper one. There are bazillion discussions in this NG about IDEs and editors. GIYF. Diez -- http://mail.python.org/mailman/listinfo/python-list

Re: Generic Python Benchmark suite?

2010-01-18 Thread Stefan Behnel
Anand Vaidya, 18.01.2010 10:58: > Is there a generic python benchmark suite in active development? > [...] > PS: I think a benchmark should cover file / network, database I/O, > data structures (dict, list etc), object creation/manipulation, > numbers, measure looping inefficiencies, effects of ca

Re: substitution

2010-01-18 Thread Peter Otten
superpollo wrote: > superpollo ha scritto: >> hi. >> >> what is the most pythonic way to substitute substrings? >> >> eg: i want to apply: >> >> foo --> bar >> baz --> quux >> quuux --> foo >> >> so that: >> >> fooxxxbazyyyquuux --> barxxxquuxyyyfoo >> >> bye > > i explain better: > > say

Re: maintain 2 versions of python on my computer

2010-01-18 Thread Gertjan Klein
Duncan Booth wrote: > @(C:\Python26\Python -x %~f0 %* || pause) && goto:EOF > import sys > print sys.version > # raise RuntimeError # uncomment to trigger the 'pause' That is nice! This should probably be in the documentation, here: http://docs.python.org/using/cmdline.ht

Re: The answer

2010-01-18 Thread Dave Angel
Jive Dadson wrote: alex23 wrote: > > Actually, if you're using Python 2.6+/3.x, you can effectively skip > steps 1-5, as these versions now support user site-packages. > > Rather than create a Module folder and modify your PYTHONPATH, add (if > it doesn't exist already) the following folder: >

Re: Is python not good enough?

2010-01-18 Thread Phlip
On Jan 12, 7:09 am, ikuta liu wrote: > Go language try to merge low level, hight level and browser language. Go uses := for assignment. This means, to appease the self-righteous indignation of the math professor who would claim = should mean "equality"... ...you gotta type a shift and 2 charac

Re: substitution

2010-01-18 Thread Steven D'Aprano
On Mon, 18 Jan 2010 11:15:37 +0100, superpollo wrote: > hi. > > what is the most pythonic way to substitute substrings? > > eg: i want to apply: > > foo --> bar > baz --> quux > quuux --> foo > > so that: > > fooxxxbazyyyquuux --> barxxxquuxyyyfoo For simple cases, just use replace: >>> s

Re: Is python not good enough?

2010-01-18 Thread Tim Chase
Phlip wrote: On Jan 12, 7:09 am, ikuta liu wrote: Go language try to merge low level, hight level and browser language. Go uses := for assignment. This means, to appease the self-righteous indignation of the math professor who would claim = should mean "equality"... ...you gotta type a shif

Re: enhancing 'list'

2010-01-18 Thread samwyse
On Jan 18, 1:56 am, Terry Reedy wrote: > On 1/17/2010 5:37 PM, samwyse wrote: > > > > > > > Consider this a wish list.  I know I'm unlikely to get any of these in > > time for for my birthday, but still I felt the need to toss it out and > > see what happens. > > > Lately, I've slinging around a l

Re: enhancing 'list'

2010-01-18 Thread samwyse
On Jan 18, 3:06 am, Peter Otten <[email protected]> wrote: > samwyse wrote: > > Lately, I've slinging around a lot of lists, and there are some simple > > things I'd like to do that just aren't there. > > > s.count(x[, cmp[, key]]) > > - return number of i‘s for which s[i] == x.  'cmp' specifies a c

Re: enhancing 'list'

2010-01-18 Thread samwyse
On Jan 17, 11:30 pm, Asun Friere wrote: > On Jan 18, 9:37 am, samwyse wrote: > > > Consider this a wish list.  I know I'm unlikely to get any of these in > > time for for my birthday, but still I felt the need to toss it out and > > see what happens. > > > Lately, I've slinging around a lot of li

Re: enhancing 'list'

2010-01-18 Thread Peter Otten
samwyse wrote: > On Jan 18, 3:06 am, Peter Otten <[email protected]> wrote: >> samwyse wrote: >> > Lately, I've slinging around a lot of lists, and there are some simple >> > things I'd like to do that just aren't there. >> >> > s.count(x[, cmp[, key]]) >> > - return number of i‘s for which s[i] ==

Re: The answer

2010-01-18 Thread samwyse
On Jan 17, 8:30 pm, Jive Dadson wrote: > Okay, with your help I've figured it out.  Instructions are below, but > read the caveat by Ben Fenny in this thread.  All this stuff is good for > one default version of Python only.  The PYTHONPATH described below, for > example, cannot specify a version

Re: substitution

2010-01-18 Thread Anthra Norell
superpollo wrote: hi. what is the most pythonic way to substitute substrings? eg: i want to apply: foo --> bar baz --> quux quuux --> foo so that: fooxxxbazyyyquuux --> barxxxquuxyyyfoo bye Try the code below the dotted line. It does any number of substitutions and handles overlaps corre

Re: substitution

2010-01-18 Thread Iain King
On Jan 18, 10:21 am, superpollo wrote: > superpollo ha scritto: > > > hi. > > > what is the most pythonic way to substitute substrings? > > > eg: i want to apply: > > > foo --> bar > > baz --> quux > > quuux --> foo > > > so that: > > > fooxxxbazyyyquuux --> barxxxquuxyyyfoo > > > bye > > i explai

Re: enhancing 'list'

2010-01-18 Thread samwyse
On Jan 18, 6:20 am, Peter Otten <[email protected]> wrote: > Note that the cmp() builtin and the cmp parameter for list.sort() are gone > in Python 3. I've got Python 3 installed, and am using it for most new development. In this case case, however, I'm writing for the Google App Engine, which is

Re: enhancing 'list'

2010-01-18 Thread Stefan Behnel
samwyse, 18.01.2010 13:49: > Curiously, no matter how I > order my PATH, the wrong version seems to appear first more than half > the time! I'm seriously considering renaming all my Python 3 code to > use a .py3 file extension. You should be able to start the interpreter as "python3.1" to be sure

Parse a log file

2010-01-18 Thread [email protected]
Hello to all! I want to parse a log file with the following format for example: TIMESTAMPEOperation FileName Bytes 12/Jan/2010:16:04:59 +0200 EXISTS sample3.3gp 37151 12/Jan/2010:16:04:59 +0200 EXISTSsample3.3gp 37151 12/Jan/2010:16:04:59 +0200 EX

Re: Is python not good enough?

2010-01-18 Thread David Cournapeau
On Mon, Jan 18, 2010 at 8:03 PM, Phlip wrote: > This means, to appease the self-righteous indignation of the math > professor who would claim = should mean "equality"... Much more likely, this is part of the stated goal of making go very easy to analyse (to build tools and so that go is very fas

Re: r"string" vs R"string

2010-01-18 Thread Colin W.
On 17-Jan-10 18:27 PM, Steven D'Aprano wrote: On Sun, 17 Jan 2010 11:13:48 -0500, Roy Smith wrote: In article, "Colin W." wrote: On 17-Jan-10 02:16 AM, Terry Reedy wrote: On 1/17/2010 1:55 AM, Brendan Miller wrote: Is there any difference whatsoever between a raw string beginning with th

Re: Parse a log file

2010-01-18 Thread samwyse
On Jan 18, 6:52 am, "[email protected]" wrote: > Hello to all! > I want to parse a log file with the following format for > example: >               TIMESTAMPE            Operation     FileName > Bytes > 12/Jan/2010:16:04:59 +0200   EXISTS       sample3.3gp   37151 > 12/Jan/2010:16:04:59 +0200  EXI

Re: substitution

2010-01-18 Thread Iain King
On Jan 18, 12:41 pm, Iain King wrote: > On Jan 18, 10:21 am, superpollo wrote: > > > > > superpollo ha scritto: > > > > hi. > > > > what is the most pythonic way to substitute substrings? > > > > eg: i want to apply: > > > > foo --> bar > > > baz --> quux > > > quuux --> foo > > > > so that: > >

Re: substitution

2010-01-18 Thread Peter Otten
Iain King wrote: > Not sure if it's the most pythonic, but I'd probably do it like this: > > def token_replace(string, subs): > subs = dict(subs) > tokens = {} > for i, sub in enumerate(subs): > tokens[sub] = i > tokens[i] = sub > cu

Re: substitution

2010-01-18 Thread superpollo
it looked simpler when i posted, but i realize that the problem is non trivial. thanks to everybody. i guess that the algorithm would be easier if it was known in advance that the string to substitute must have some specific property, say: 1) they all must start with "XYZ" 2) they all have t

Re: Is python not good enough?

2010-01-18 Thread Anh Hai Trinh
On Jan 18, 6:03 pm, Phlip wrote: > On Jan 12, 7:09 am, ikuta liu wrote: > > > Go language try to merge low level, hight level and browser language. > > Go uses := for assignment. Except that it doesn't. := is a declaration. s := "foo" is short for var s string = "foo" Cheers, aht -- h

Re: Changing var names

2010-01-18 Thread Jean-Michel Pichavant
Victor Subervi wrote: On Fri, Jan 15, 2010 at 3:15 PM, Adam Tauno Williams mailto:[email protected]>> wrote: On Fri, 2010-01-15 at 13:27 -0400, Victor Subervi wrote: > Hi; > Well it took me *less than a day* to fix the following problems: > -- bare excepts (accidentally

Re: Inheriting methods but over-riding docstrings

2010-01-18 Thread Gabriel Genellina
En Sun, 17 Jan 2010 23:23:45 -0300, Steve Holden escribió: Gabriel Genellina wrote: Methods don't have docstrings; functions do. So one has to "clone" the function to set a new docstring. On behalf of all methods I would like to say "We demand the right to docstrings". print abs.__doc__

substitution

2010-01-18 Thread Adi Eyal
> From: superpollo > To: > Date: Mon, 18 Jan 2010 11:15:37 +0100 > Subject: substitution > hi. > > what is the most pythonic way to substitute substrings? > > eg: i want to apply: > > foo --> bar > baz --> quux > quuux --> foo > > so that: > > fooxxxbazyyyquuux --> barxxxquuxyyyfoo > > bye Using

Re: substitution

2010-01-18 Thread Iain King
On Jan 18, 2:17 pm, Adi Eyal wrote: > > From: superpollo > > To: > > Date: Mon, 18 Jan 2010 11:15:37 +0100 > > Subject: substitution > > hi. > > > what is the most pythonic way to substitute substrings? > > > eg: i want to apply: > > > foo --> bar > > baz --> quux > > quuux --> foo > > > so that:

python gui ide under linux..like visual studio ;) ?

2010-01-18 Thread ted
Hi at all... Can someone please give me some advice, about a good IDE with control GUI under Linux ? Actually i know QT Creator by Nokia which i can use with Python (but i don't know how). And, a good library for access to database (mysql, sql server, oracle) ? Thank you very much ! bye -- htt

Re: multithreading, performance, again...

2010-01-18 Thread Oktaka Com
On 30 Aralık 2009, 17:44, mk wrote: > Hello everyone, > > I have figured out (sort of) how to do profiling of multithreaded > programs with cProfile, it goes something like this: > > #!/usr/local/bin/python > > import cProfile > import threading > > class TestProf(threading.Thread): >      def __i

Re: substitution

2010-01-18 Thread Mel
superpollo wrote: > hi. > > what is the most pythonic way to substitute substrings? > > eg: i want to apply: > > foo --> bar > baz --> quux > quuux --> foo > > so that: > > fooxxxbazyyyquuux --> barxxxquuxyyyfoo This is simple -- maybe a bit brutal -- and if the strings get long it will be

Re: basic Class in Python

2010-01-18 Thread bartc
"Wolfgang Rohdewald" wrote in message news:[email protected]... On Monday 18 January 2010, BarryJOgorman wrote: TypeError: object._new_() takes no parameters def _init_(self, name, job=None, pay=0): __init__ needs two underscores left and right An

Proper display of XMLRPCserver exceptions

2010-01-18 Thread Jean-Michel Pichavant
To all using xmlrpclib, I had trouble getting a proper display of my exceptions occuring on the server. Basically, xmlrpclib only display the exception itself without any traceback, on the client side. Something like :2"> Ok then there's a key error, but how the hell am I supposed to know w

Re: substitution

2010-01-18 Thread Nobody
On Mon, 18 Jan 2010 11:21:54 +0100, superpollo wrote: >> what is the most pythonic way to substitute substrings? > say the subs are: > > quuux --> foo > foo --> bar > baz --> quux > > then i cannot apply the subs in sequence (say, .replace() in a loop), > otherwise: > > fooxxxbazyyyquuux -->

Re: Is python not good enough?

2010-01-18 Thread Phlip
On Jan 18, 5:59 am, Anh Hai Trinh wrote: > > Go uses := for assignment. > > Except that it doesn't. := is a declaration. Ah, and that's why Go is easy for cheap parsers to rip. Tx all! I was formerly too mortified to proceed - now I'm back in the Go camp. They fixed the hideous redundancy of J

Re: Generic Python Benchmark suite?

2010-01-18 Thread Dotan Cohen
> What do you suggest? > $ man time -- Dotan Cohen http://what-is-what.com http://gibberish.co.il -- http://mail.python.org/mailman/listinfo/python-list

not and is not problem

2010-01-18 Thread superpollo
hi: #!/usr/bin/env python data = "seq=123" name , value = data.split("=") print name print value if not name == "seq": print "DOES NOT PRINT OF COURSE..." if name is not "seq": print "WTF! WHY DOES IT PRINT?" help please. bye -- http://mail.python.org/mailman/listinfo/python-list

ANN: shpaml 0.94b

2010-01-18 Thread Steve Howell
Hi everybody, I would like to announce the latest version of shpaml, which is an indentation-based markup language similar to haml, but different. Shpaml allows you to author HTML-like content with an indentation- based syntax that eliminates the need to write and read close tags and angle bracket

Re: not and is not problem

2010-01-18 Thread Stephen Hansen
On Mon, Jan 18, 2010 at 7:43 AM, superpollo wrote: > #!/usr/bin/env python > data = "seq=123" > name , value = data.split("=") > print name > print value > if not name == "seq": >print "DOES NOT PRINT OF COURSE..." > if name is not "seq": >print "WTF! WHY DOES IT PRINT?" > Because name r

Re: not and is not problem

2010-01-18 Thread D'Arcy J.M. Cain
On Mon, 18 Jan 2010 16:43:25 +0100 superpollo wrote: > hi: > if name is not "seq": > print "WTF! WHY DOES IT PRINT?" Perhaps they aren't the same object. Some values are guaranteed to be the same (e.g. True and False) but not all. Try "!=" instead of "is not" in that experssion. -- D'Arc

Re: substitution

2010-01-18 Thread Anthra Norell
Anthra Norell wrote: superpollo wrote: hi. what is the most pythonic way to substitute substrings? eg: i want to apply: foo --> bar baz --> quux quuux --> foo so that: fooxxxbazyyyquuux --> barxxxquuxyyyfoo bye So it goes. The more it matters, the sillier the misatakes. The method __ini

Re: not and is not problem

2010-01-18 Thread Arnaud Delobelle
On 18 Jan, 15:43, superpollo wrote: > hi: > > #!/usr/bin/env python > data = "seq=123" > name , value = data.split("=") > print name > print value > if not name == "seq": >      print "DOES NOT PRINT OF COURSE..." > if name is not "seq": >      print "WTF! WHY DOES IT PRINT?" > > help please. > >

What is a list compression in Python?

2010-01-18 Thread Kit
Hello Everyone, I am not sure if I have posted this question in a correct board. Can anyone please teach me: What is a list compression in Python? Would you mind give me some list compression examples? Thanks & really appreciate that. Kit -- http://mail.python.org/mailman/listinfo/python-list

Re: not and is not problem

2010-01-18 Thread J
On Mon, Jan 18, 2010 at 10:43, superpollo wrote: > hi: > > #!/usr/bin/env python > data = "seq=123" > name , value = data.split("=") > print name > print value > if not name == "seq": >    print "DOES NOT PRINT OF COURSE..." > if name is not "seq": >    print "WTF! WHY DOES IT PRINT?" is will ret

Re: What is a list compression in Python?

2010-01-18 Thread superpollo
Kit ha scritto: Hello Everyone, I am not sure if I have posted this question in a correct board. Can anyone please teach me: What is a list compression in Python? Would you mind give me some list compression examples? Thanks & really appreciate that. Kit i think that's compreHENsion... htt

Re: What is a list compression in Python?

2010-01-18 Thread Simon Brunning
2010/1/18 Kit : > Hello Everyone, I am not sure if I have posted this question in a > correct board. Can anyone please teach me: > > What is a list compression in Python? Perhaps you mean a list comprehension? If so, see . -- Cheers

Re: substitution

2010-01-18 Thread Duncan Booth
Adi Eyal wrote: > Using regular expressions the answer is short (and sweet) > > mapping = { > "foo" : "bar", > "baz" : "quux", > "quuux" : "foo" > } > > pattern = "(%s)" % "|".join(mapping.keys()) > repl = lambda x : mapping.get(x.group(1), x.group(1)) > s = "fooxxxbazyy

Re: not and is not problem

2010-01-18 Thread Steven D'Aprano
On Mon, 18 Jan 2010 16:43:25 +0100, superpollo wrote: > hi: > > #!/usr/bin/env python > data = "seq=123" > name , value = data.split("=") > print name > print value > if not name == "seq": > print "DOES NOT PRINT OF COURSE..." > if name is not "seq": > print "WTF! WHY DOES IT PRINT?"

Re: What is a list compression in Python?

2010-01-18 Thread Stephen Hansen
On Mon, Jan 18, 2010 at 8:07 AM, Kit wrote: > Hello Everyone, I am not sure if I have posted this question in a > correct board. Can anyone please teach me: > > What is a list compression in Python? > > Would you mind give me some list compression examples? > Do you mean list *comprehension*? If

Re: substitution

2010-01-18 Thread Anthra Norell
superpollo wrote: hi. what is the most pythonic way to substitute substrings? eg: i want to apply: foo --> bar baz --> quux quuux --> foo so that: fooxxxbazyyyquuux --> barxxxquuxyyyfoo bye Third attempt. Clearly something doesn't work right. My code gets clipped on the way up. I have

Re: substitution

2010-01-18 Thread Steven D'Aprano
On Mon, 18 Jan 2010 06:23:44 -0800, Iain King wrote: > On Jan 18, 2:17 pm, Adi Eyal wrote: [...] >> Using regular expressions the answer is short (and sweet) >> >> mapping = { >>         "foo" : "bar", >>         "baz" : "quux", >>         "quuux" : "foo" >> >> } >> >> pattern = "(%s)" % "|".join

Re: What is a list compression in Python?

2010-01-18 Thread Steven D'Aprano
On Mon, 18 Jan 2010 08:07:41 -0800, Kit wrote: > Hello Everyone, I am not sure if I have posted this question in a > correct board. Can anyone please teach me: > > What is a list compression in Python? Google "python list comprehension". If Google is broken for you, try Yahoo, or any other sear

py.test-1.2.0: junitxml, standalone test scripts, pluginization

2010-01-18 Thread holger krekel
Hi all, i just released some bits related to automated testing with Python: py-1.2.0: py.test core which grew junitxml, standalone-script generation pytest-xdist-1.0: separately installable dist-testing & looponfailing plugin pytest-figleaf-1.0: separately installable figleaf-coverage te

Re: Arrrrgh! Another module broken

2010-01-18 Thread Grant Edwards
On 2010-01-18, Jive Dadson wrote: > I just found another module that broke when I went to 2.6. Gnuplot. > Apparently one of its routines has a parameter named "with." That used > to be okay, and now it's not. I remember seeing depreicated warnings about that _years_ ago, and I would have swor

Re: Is python not good enough?

2010-01-18 Thread Steven D'Aprano
On Mon, 18 Jan 2010 03:03:26 -0800, Phlip wrote: > On Jan 12, 7:09 am, ikuta liu wrote: > >> Go language try to merge low level, hight level and browser language. > > Go uses := for assignment. > > This means, to appease the self-righteous indignation of the math > professor who would claim =

Re: Is python not good enough?

2010-01-18 Thread Steven D'Aprano
On Mon, 18 Jan 2010 07:37:36 -0800, Phlip wrote: > They fixed the hideous redundancy of Java without the ill-defined scope > issues of Python Which ill-defined scope issues are you referring to? -- Steven -- http://mail.python.org/mailman/listinfo/python-list

Python decorator syntax limitations

2010-01-18 Thread Jonathan S
Hi all, The following is what I want to do, but this results in a syntax error: @news_page('template.html').lookup(News, 'news_id', 'news') def view(request, group, news): pass What does work is the equivalent old way of doing decorating: def view(request, group, news): pass view = ne

Re: substitution

2010-01-18 Thread Iain King
On Jan 18, 4:26 pm, Steven D'Aprano wrote: > On Mon, 18 Jan 2010 06:23:44 -0800, Iain King wrote: > > On Jan 18, 2:17 pm, Adi Eyal wrote: > [...] > >> Using regular expressions the answer is short (and sweet) > > >> mapping = { > >>         "foo" : "bar", > >>         "baz" : "quux", > >>        

Re: Python decorator syntax limitations

2010-01-18 Thread Steve Howell
On Jan 18, 8:44 am, Jonathan S wrote: > Hi all, > The following is what I want to do, but this results in a syntax > error: > > @news_page('template.html').lookup(News, 'news_id', 'news') > def view(request, group, news): >     pass > > What does work is the equivalent old way of doing decorating:

Re: not and is not problem

2010-01-18 Thread Jean-Michel Pichavant
Steven D'Aprano wrote: On Mon, 18 Jan 2010 16:43:25 +0100, superpollo wrote: hi: #!/usr/bin/env python data = "seq=123" name , value = data.split("=") print name print value if not name == "seq": print "DOES NOT PRINT OF COURSE..." if name is not "seq": print "WTF! WHY DOES IT PRI

Re: ctypes: nested structures and pointers

2010-01-18 Thread Gabriele Modena
On Mon, Jan 18, 2010 at 10:33 AM, Gabriele Modena wrote: >  1. what is the correct (pythonic) way to capture the prototype > definition of dev_callbacks and the relation between that structure > and dev_info? > >  2. is it correct to wrap "connect", "transceive" and "disconnect" in > separate stru

Re: Python decorator syntax limitations

2010-01-18 Thread Lie Ryan
On 01/19/10 03:44, Jonathan S wrote: > Any suggestions? I have my reasons for doing this, (news_page is a > class, and __call__ is used to wrap the template.) > I'm sure this is a limitation in the syntax, but would parenthesis > somewhere help? The restriction[1] is put in there since Guido has a

Re: Generic Python Benchmark suite?

2010-01-18 Thread Antoine Pitrou
Le Mon, 18 Jan 2010 11:30:16 +0100, Stefan Behnel a écrit : > Anand Vaidya, 18.01.2010 10:58: >> Is there a generic python benchmark suite in active development? [...] >> PS: I think a benchmark should cover file / network, database I/O, >> data structures (dict, list etc), object creation/manipul

Re: Python decorator syntax limitations

2010-01-18 Thread Peter Otten
Jonathan S wrote: > Hi all, > The following is what I want to do, but this results in a syntax > error: > > > @news_page('template.html').lookup(News, 'news_id', 'news') > def view(request, group, news): > pass > > > What does work is the equivalent old way of doing decorating: > > > def

Re: Generic Python Benchmark suite?

2010-01-18 Thread Antoine Pitrou
Le Mon, 18 Jan 2010 01:58:42 -0800, Anand Vaidya a écrit : > Is there a generic python benchmark suite in active development? I am > looking forward to comparing some code on various python implementations > (primarily CPython 2.x, CPython 3.x, UnladenSwallow, Psyco). > > I am happy with something

using super

2010-01-18 Thread Jean-Michel Pichavant
class SubClass(Base): colour = "Red" def parrot(self): """docstring for Subclass""" return super(Subclass, self).parrot() I'm not a big fan of super, but I'm still wondering if >>> return super(self.__class__, self).parrot() would have made it. What if Subclass has mo

Re: python gui ide under linux..like visual studio ;) ?

2010-01-18 Thread Antoine Pitrou
Le Mon, 18 Jan 2010 15:32:36 +0100, ted a écrit : > > And, a good library for access to database (mysql, sql server, oracle) ? If you want something high-level: http://www.sqlalchemy.org/ You won't regret it :) -- http://mail.python.org/mailman/listinfo/python-list

Re: using super

2010-01-18 Thread Duncan Booth
Jean-Michel Pichavant wrote: > class SubClass(Base): colour = "Red" def parrot(self): """docstring for Subclass""" return super(Subclass, self).parrot() > I'm not a big fan of super, but I'm still wondering if > > >>> return super(self.__class__,

Re: Is python not good enough?

2010-01-18 Thread MRAB
Phlip wrote: On Jan 12, 7:09 am, ikuta liu wrote: Go language try to merge low level, hight level and browser language. Go uses := for assignment. This means, to appease the self-righteous indignation of the math professor who would claim = should mean "equality"... ...you gotta type a shi

Re: Python decorator syntax limitations

2010-01-18 Thread Aahz
In article <[email protected]>, Lie Ryan wrote: > >If you are sure you can put up a convincing argument for lifting this >restriction, and you are willing to put some time arguing, you are >welcome to start a thread in the python-dev mailing list. Be sure to >read about previous discus

Re: substitution

2010-01-18 Thread Adi Eyal
> From: Steven D'Aprano > To: [email protected] > Date: 18 Jan 2010 16:26:48 GMT > Subject: Re: substitution > On Mon, 18 Jan 2010 06:23:44 -0800, Iain King wrote: > >> On Jan 18, 2:17 pm, Adi Eyal wrote: > [...] >>> Using regular expressions the answer is short (and sweet) >>> >>> mapping =

Re: Python decorator syntax limitations

2010-01-18 Thread Arnaud Delobelle
[email protected] (Aahz) writes: > In article <[email protected]>, > Lie Ryan wrote: >> >>If you are sure you can put up a convincing argument for lifting this >>restriction, and you are willing to put some time arguing, you are >>welcome to start a thread in the python-dev mailing

Re: lightweight encryption of text file

2010-01-18 Thread Aahz
In article , Daniel Fetchinson wrote: > >Well, that's sort of true about learning a complex API :) But it's >also true that I'm not storing anything really valuable in the file >but still wouldn't want to leave it lying around in plain text. In >case I lose the laptop with the file I seriously do

Re: using super

2010-01-18 Thread Jean-Michel Pichavant
Duncan Booth wrote: Jean-Michel Pichavant wrote: class SubClass(Base): colour = "Red" def parrot(self): """docstring for Subclass""" return super(Subclass, self).parrot() I'm not a big fan of super, but I'm still wondering if return super(self.__cl

Unable to install numpy

2010-01-18 Thread vsoler
Hi all, I just download Numpy, and tried to install it using "numpy-1.4.0- win32-superpack-python2.6.exe" I get an error: "Python version 2.6 required, which was not found in the Registry" However, I am using Python 2.6 every day. I'm running Windows 7. What can I do? -- http://mail.python.or

Re: Unable to install numpy

2010-01-18 Thread Robert Kern
On 2010-01-18 14:02 PM, vsoler wrote: Hi all, I just download Numpy, and tried to install it using "numpy-1.4.0- win32-superpack-python2.6.exe" I get an error: "Python version 2.6 required, which was not found in the Registry" However, I am using Python 2.6 every day. I'm running Windows 7.

Re: using super

2010-01-18 Thread Arnaud Delobelle
Jean-Michel Pichavant writes: [...] > Then is there a reason why return super(Subclass, self).parrot() > would be prefered over the "classic" return Base.parrot(self) > ? > > Or is it just a matter of preference ? Using super() calls the next method in the class's Method Resolution O

Re: force URLencoding script

2010-01-18 Thread João
On Jan 15, 4:46 pm, r0g wrote: > João wrote: > > On Jan 15, 2:38 pm, r0g wrote: > >> João wrote: > >>> On Jan 14, 5:58 pm, r0g wrote: > João wrote: > > On Jan 12, 10:07 pm, r0g wrote: > >> João wrote: > > for the following data, > > authentication = "UID=somestring&" >

Re: force URLencoding script

2010-01-18 Thread João
On Jan 15, 4:46 pm, r0g wrote: > João wrote: > > On Jan 15, 2:38 pm, r0g wrote: > >> João wrote: > >>> On Jan 14, 5:58 pm, r0g wrote: > João wrote: > > On Jan 12, 10:07 pm, r0g wrote: > >> João wrote: > > for the following data, > > authentication = "UID=somestring&" >

Re: Python decorator syntax limitations

2010-01-18 Thread Jonathan S
Thanks a lot, all of you! This was really helpful. (or at least give me the inspiration I needed to finish it.) I'm sure this is a use case where most other options are less readable than the chain of methods in the decorator. In this use case, I had a lot of Django views to which access permissio

Re: python gui ide under linux..like visual studio ;) ?

2010-01-18 Thread Mike Driscoll
On Jan 18, 8:32 am, ted wrote: > Hi at all... > Can someone please give me some advice, about a good IDE with control > GUI under Linux ? > > Actually i know QT Creator by Nokia which i can use with Python (but i > don't know how). > > And, a good library for access to database (mysql, sql server,

Re: I really need webbrowser.open('file://') to open a web browser

2010-01-18 Thread Timur Tabi
On Sat, Jan 16, 2010 at 3:43 PM, Paul Boddie wrote: > Generally, the desktop-specific tools should know that a browser is > the appropriate application for an HTML file, and testing with both > xdg-open, gnome-open and "kfmclient openURL" seems to open browsers on > HTML files (using file:///...)

form mailer for info + files

2010-01-18 Thread Gregory
There is code all over on how to create a form mailer. I need an example that will show how to upload two files and send them along with form field info. Is it required to overwrite the python cgi.fieldstorage to do this? Working with Python 2.4.3. -- http://mail.python.org/mailman/listinfo/python

Re: searching and storing large quantities of xml!

2010-01-18 Thread dads
Thanks all, took your advice and have been playing all weekend which has been great fun. ElementTree is awesome. I created a script that organises the xml as they're in year blocks and I didn't realise the required xml is mixed up with other xml. Plus the volumes are much greater than I realised, I

Re: Generic Python Benchmark suite?

2010-01-18 Thread Terry Reedy
On 1/18/2010 4:58 AM, Anand Vaidya wrote: Is there a generic python benchmark suite in active development? I am looking forward to comparing some code on various python implementations (primarily CPython 2.x, CPython 3.x, UnladenSwallow, Psyco). You might find this interesting if you have not s

Re: Parse a log file

2010-01-18 Thread Tim Chase
[email protected] wrote: I want to parse a log file with the following format for example: TIMESTAMPEOperation FileName Bytes 12/Jan/2010:16:04:59 +0200 EXISTS sample3.3gp 37151 12/Jan/2010:16:04:59 +0200 EXISTSsample3.3gp 37151 12/Jan/2010:16:04:

inner methods and recursion

2010-01-18 Thread Steve Howell
Hi, I have a style/design question relating to recursion and inner methods. I wrote some code recently that implements a recursive algorithm that takes several parameters from the original caller. Once the algorithm starts running and recursing, those parameters remain the same, so I define an in

Re: r"string" vs R"string

2010-01-18 Thread Terry Reedy
On 1/18/2010 8:01 AM, Colin W. wrote: On 17-Jan-10 18:27 PM, Steven D'Aprano wrote: On Sun, 17 Jan 2010 11:13:48 -0500, Roy Smith wrote: In article, "Colin W." wrote: On 17-Jan-10 02:16 AM, Terry Reedy wrote: On 1/17/2010 1:55 AM, Brendan Miller wrote: Is there any difference whatsoever be

  1   2   >