Re: ~ bit-wise unary operator

2007-09-26 Thread Lawrence D'Oliveiro
In message <[EMAIL PROTECTED]>, Hrvoje Niksic wrote: > If you want 16-bit unsigned arithmetic, use 2**16 + ~a, which yields > 57557. Or why not use "0x ^ a", which returns the same thing. -- http://mail.python.org/mailman/listinfo/python-list

Re: database persistence with mysql, sqlite

2007-09-26 Thread Lawrence D'Oliveiro
In message <[EMAIL PROTECTED]>, Bryan Olson wrote: > Lawrence D'Oliveiro wrote: >> In Bryan Olson wrote: >> >>> coldpizza wrote: >>>> It turned out that the method above ('SELECT * FROM TABLE LIMIT L1, >>>> L2') works ok both w

Re: Delete values from a string using the index

2007-09-26 Thread Lawrence D'Oliveiro
In message <[EMAIL PROTECTED]>, [EMAIL PROTECTED] wrote: > How do I delete or remove values from a list or string using the > index. Note you can't do it with a string, since that's not mutable. -- http://mail.python.org/mailman/listinfo/python-list

Re: Question about quoting style.

2007-10-01 Thread Lawrence D'Oliveiro
In message <[EMAIL PROTECTED]>, Steven W. Orr wrote: > foo=bar # No quotes needed > echo $foo # Also none needed Actually, it's not clear to me that quotes will never be needed on the second line. Unless foo is always going to have the value "bar". -- http://mai

Re: Why doesn't Python's "robotparser" like Wikipedia's "robots.txt" file?

2007-10-01 Thread Lawrence D'Oliveiro
In message <[EMAIL PROTECTED]>, John Nagle wrote: > For some reason, Python's parser for "robots.txt" files > doesn't like Wikipedia's "robots.txt" file: > > >>> import robotparser > >>> url = 'http://wikipedia.org/robots.txt' > >>> chk = robotparser.RobotFileParser() > >>> chk.set_url(ur

Re: module confusion

2007-10-01 Thread Lawrence D'Oliveiro
In message <[EMAIL PROTECTED]>, Robert Kern wrote: > Not all of the modules in a package are imported by importing the > top-level package. You can't import packages, only modules. > os.path is a particularly weird case because it is just an alias to the > platform-specific path-handling module;

Re: The Modernization of Emacs: terminology buffer and keybinding

2007-10-02 Thread Lawrence D'Oliveiro
In message <[EMAIL PROTECTED]>, Kamen TOMOV wrote: > On Sun, Sep 30 2007, Klaus Schilling wrote: > >> private property is unethical > > How I craved to read that! > > Viva la revolution! Ewige Blumenkraft! French-Canadian bean soup! -- http://mail.python.org/mailman/listinfo/python-list

Re: module confusion

2007-10-03 Thread Lawrence D'Oliveiro
In message <[EMAIL PROTECTED]>, Robert Kern wrote: > Lawrence D'Oliveiro wrote: > >> In message <[EMAIL PROTECTED]>, Robert >> Kern wrote: >> >>> Not all of the modules in a package are imported by importing the >>> top-le

Re: module confusion

2007-10-03 Thread Lawrence D'Oliveiro
In message <[EMAIL PROTECTED]>, Steve Holden wrote: > You *can* import a package ... You're right. I was misremembering the behaviour of PyCrypto, where importing the upper-level packages do little more than give you a list of what algorithms are available. -- http://mail.python.org/mailman/list

Re: python 2.5 and 3gb switch

2007-10-03 Thread Lawrence D'Oliveiro
In message <[EMAIL PROTECTED]>, neil wrote: > The scene is very large requiring me to use a 3gb switch enabled version > of Blender and of course boot into a 3gb XP. Why not just use a proper 64-bit OS? Since Blender is also open-source, there's no requirement that you be hobbled by Dimdows. --

Re: The Modernization of Emacs: terminology buffer and keybinding

2007-10-03 Thread Lawrence D'Oliveiro
In message <[EMAIL PROTECTED]>, George Neuner wrote: > Dictionaries used to be the arbiters of the language ... No they didn't. Before Doctor Johnson, there were no dictionaries. -- http://mail.python.org/mailman/listinfo/python-list

Re: module confusion

2007-10-03 Thread Lawrence D'Oliveiro
In message <[EMAIL PROTECTED]>, Ben Finney wrote: > Lawrence D'Oliveiro <[EMAIL PROTECTED]> writes: > >> On my Gentoo system: >> >> >>> import os >> >>> os.path >> >> >> It's just a variable

Re: module confusion

2007-10-03 Thread Lawrence D'Oliveiro
In message <[EMAIL PROTECTED]>, Carsten Haese wrote: > On Thu, 2007-10-04 at 11:11 +1300, Lawrence D'Oliveiro wrote: > >> In Python, all names _are_ variables. They are not "bound" to objects. >> The value of os.path is a pointer. > > No. "os.pa

Re: The Modernization of Emacs: terminology buffer and keybinding

2007-10-03 Thread Lawrence D'Oliveiro
In message <[EMAIL PROTECTED]>, Steve Holden wrote: > Lawrence D'Oliveiro wrote: >> In message <[EMAIL PROTECTED]>, George Neuner >> wrote: >> >>> Dictionaries used to be the arbiters of the language ... >> >> No they didn't. Be

RE: Mysqldb printing sql and params ... NEVER MIND

2007-10-03 Thread Lawrence D'Oliveiro
In message <[EMAIL PROTECTED]>, Sells, Fred wrote: > el stupido here "accidently" put a couple of print statements into a > mysqldb module when eclipse opened it from the link in the stacktrace; Dimdows, right? -- http://mail.python.org/mailman/listinfo/python-list

Re: s.split() on multiple separators

2007-10-04 Thread Lawrence D'Oliveiro
In message <[EMAIL PROTECTED]>, Antoon Pardon wrote: > On 2007-10-01, Gabriel Genellina <[EMAIL PROTECTED]> wrote: > >> En Sun, 30 Sep 2007 16:16:30 -0300, <[EMAIL PROTECTED]> escribi?: >> From my POV, if I want sequence from here to there, it should include >>> both here and there. >>> >>> I

Re: Algebraic Modules For Python

2007-10-04 Thread Lawrence D'Oliveiro
In message <[EMAIL PROTECTED]>, Shawn Milochik wrote: > On 10/1/07, Brandon McGinty <[EMAIL PROTECTED]> wrote: >> > >> Brandon McGinty >> McGinty Soft Ltd. >> Website design, configuration, and maintenance >> Python and PHP coder > > So let me get this straight: > > You label yourself as a code

Re: slice last 4 items from a list

2007-10-04 Thread Lawrence D'Oliveiro
In message <[EMAIL PROTECTED]>, John Machin wrote: > On Oct 2, 6:27 am, brad <[EMAIL PROTECTED]> wrote: >> Is this the correct way to slice the last 4 items from a list? >> >> x = [1,2,3,4,5,6,7,8,9] >> print x[-4:] >> >> It works, but is it Pythonic? > > It's Pythonic. It's also unambiguous, unl

Re: Web service client using https

2007-10-04 Thread Lawrence D'Oliveiro
In message <[EMAIL PROTECTED]>, [EMAIL PROTECTED] wrote: >I am trying to connect .NET web service using HTTPS. I wrote a > python script using https. For that need to send SOAP message to the > server. But it is giving error 401.3 execution access is denied.(SOAP > message not processing)

Re: A question about subprocess

2007-10-04 Thread Lawrence D'Oliveiro
In message <[EMAIL PROTECTED]>, JD wrote: > I want send my jobs over a whole bunch of machines (using ssh). The > jobs will need to be run in the following pattern: > > (Machine A) (Machine B) (Machine C) > > Job A1 Job B1Job C1 > > Job A2 Job B2

Re: Convert on uppercase unaccentent unicode character

2007-10-04 Thread Lawrence D'Oliveiro
In message <[EMAIL PROTECTED]>, Duncan Booth wrote: > Steve Holden <[EMAIL PROTECTED]> wrote: > >>> No, that will uppercase the string, but it doesn't (and shouldn't) >>> strip the accents: >>> >> I can agree that is doesn't (though I am taking your word for it), but >> a French person will defi

Re: The Modernization of Emacs: terminology buffer and keybinding

2007-10-04 Thread Lawrence D'Oliveiro
In message <[EMAIL PROTECTED]>, Bent C Dalager wrote: > Unfortunately, these days English almost always means American English... North American or South American? Seems like USAmericans speak a little different English from other Americans... -- http://mail.python.org/mailman/listinfo/python-li

Re: python autoconf macro for building ming extension

2007-10-04 Thread Lawrence D'Oliveiro
In message <[EMAIL PROTECTED]>, Daniel Nogradi wrote: > It might be slightly off topic here but couldn't find a more suitable > place for this question: > > I'm trying to build the python binding for ming -- http://ming.sf.net > -- but for some reason the python macro for autoconf -- python.m4 --

Re: A question about subprocess

2007-10-04 Thread Lawrence D'Oliveiro
In message <[EMAIL PROTECTED]>, Lawrence D'Oliveiro wrote: > ... each one waiting for a remote process > on some master machine to terminate. Of course, "master" there should be "slave". :) -- http://mail.python.org/mailman/listinfo/python-list

Re: The Modernization of Emacs: terminology buffer and keybinding

2007-10-04 Thread Lawrence D'Oliveiro
In message <[EMAIL PROTECTED]>, George Neuner wrote: > The Christian Bible says "In the beginning was the Word..." Which is an English mistranslation from the Greek "logos". -- http://mail.python.org/mailman/listinfo/python-list

Re: A question about subprocess

2007-10-04 Thread Lawrence D'Oliveiro
In message <[EMAIL PROTECTED]>, Carl Banks wrote: > On Wed, 03 Oct 2007 16:46:20 +, JD wrote: >> >> I want send my jobs over a whole bunch of machines (using ssh). The jobs >> will need to be run in the following pattern: >> >> (Machine A) (Machine B) (Machine C) >> >> Job A1

Re: module confusion

2007-10-04 Thread Lawrence D'Oliveiro
In message <[EMAIL PROTECTED]>, Steven D'Aprano wrote: > ... pedants ... When people use that word against me, it's generally a sign they're trying not to admit I'm right. -- http://mail.python.org/mailman/listinfo/python-list

Re: The Modernization of Emacs: terminology buffer and keybinding

2007-10-04 Thread Lawrence D'Oliveiro
In message <[EMAIL PROTECTED]>, Steve Holden wrote: > Lawrence D'Oliveiro wrote: > >> In message <[EMAIL PROTECTED]>, George Neuner >> wrote: >> >>> The Christian Bible says "In the beginning was the Word..." >> >> Which

Re: module confusion

2007-10-04 Thread Lawrence D'Oliveiro
In message <[EMAIL PROTECTED]>, Steven D'Aprano wrote: > What does type(os.path) return when you try it? It returns the type of the value contained in that variable, of course: >>> import os >>> os.path = 3 >>> type(os.path) See, it's just a variable, like any other. -- http:/

Re: module confusion

2007-10-04 Thread Lawrence D'Oliveiro
In message <[EMAIL PROTECTED]>, Neil Cerutti wrote: > On 2007-10-03, Lawrence D'Oliveiro <[EMAIL PROTECTED]> > wrote: >> In message <[EMAIL PROTECTED]>, Ben Finney wrote: >> >>> Lawrence D'Oliveiro <[EMAIL PROTECTED]> writes

Re: Python "implements " equivalent?

2007-10-04 Thread Lawrence D'Oliveiro
In message <[EMAIL PROTECTED]>, Wojciech Gryc wrote: > I'm a seasoned Java programmer and quite a big fan of interfaces... > i.e. The idea that if I make a number of distinct classes that > implement interface X, I can pass them all as parameters to functions > or whatnot that require an X object.

Re: gui toolkits: the real story? (Tkinter, PyGTK, etc.)

2007-10-04 Thread Lawrence D'Oliveiro
In message <[EMAIL PROTECTED]>, Grant Edwards wrote: > You've got to admit that Tk "just works", although as a result > it looks ugly and foreign on all platforms. Sort of a "pidgin GUI". :) -- http://mail.python.org/mailman/listinfo/python-list

Re: Duplicate content filter..

2007-10-04 Thread Lawrence D'Oliveiro
In message <[EMAIL PROTECTED]>, Abandoned wrote: > I want to a idea for how can i find duplicate pages quickly and fast ? Compute a hash based on a canonicalized version of the content? Disregard white space, line wrap, upper/lower case, possibly even punctuation etc so that you get the same hash

Re: Combine two dictionary...

2007-10-04 Thread Lawrence D'Oliveiro
In message <[EMAIL PROTECTED]>, Abandoned wrote: > I want to total score.. > For example >> > dict1={1: 4, 3: 5}... and 2 millions element >> > dict2={3: 3, 8: 6}... and 3 millions element > > result should be dict3={1:4, 3:8, 8:6} Don't people like one-liners? :) dict((k, dict1.get(k, 0)

Re: module confusion

2007-10-05 Thread Lawrence D'Oliveiro
In message <[EMAIL PROTECTED]>, Robert Kern wrote: > Lawrence D'Oliveiro wrote: >> In message <[EMAIL PROTECTED]>, Steven D'Aprano wrote: >> >>> What does type(os.path) return when you try it? >> >> It returns the type of the value conta

Re: module confusion

2007-10-05 Thread Lawrence D'Oliveiro
In message <[EMAIL PROTECTED]>, Marc 'BlackJack' Rintsch wrote: > To me a `variable` is made of a name, a memory address, a data type, and > a value. In languages like C the address and type are attached to the > name while in Python both are attached to the value. How does C++ with RTTI fit int

Re: supplying password to subprocess.call('rsync ...'), os.system('rsync ...')

2007-10-06 Thread Lawrence D'Oliveiro
In message <[EMAIL PROTECTED]>, timw.google wrote: > I want to write a python script that runs rsync on a given directory > and host. I build the command line string, but when I try to run > subprocess.call(cmd), or p=subprocess.Popen(cmd, shell=True),or > os.system(cmd), I get prompted for my log

Re: The Modernization of Emacs: terminology buffer and keybinding

2007-10-07 Thread Lawrence D'Oliveiro
In message <[EMAIL PROTECTED]>, [EMAIL PROTECTED] wrote: > For example, a dog with no owner, wandering freely (adverb), would not be > called a free dog (adjective), to mean possessing freedom. Yes it would. City council regulations would commonly contain phrases such as "dogs are not allowed to

Re: The fundamental concept of continuations

2007-10-14 Thread Lawrence D'Oliveiro
In message <[EMAIL PROTECTED]>, Barb Knox wrote: > Instead of function A returning to its caller, the > caller provides an additional argument (the "continuation") which is a > function B to be called by A with A's result(s). That's just a callback. I've been doing that in C code (and other simil

Re: How do I add users using Python scripts on a Linux machine

2007-01-09 Thread Lawrence D'Oliveiro
In message <[EMAIL PROTECTED]>, Piet van Oostrum wrote: > Lawrence D'Oliveiro <[EMAIL PROTECTED]> (LD) wrote: > In message <[EMAIL PROTECTED]>, Piet van Oostrum wrote: > >> The scenario is as follows: Suppose the script starts with the line: >> #!

Re: piping question

2006-04-18 Thread Lawrence D'Oliveiro
In article <[EMAIL PROTECTED]>, Biggmatt <[EMAIL PROTECTED]> wrote: >The problem is that i want it to >get the stdout as the program runs, not hold it all till it's >finished. This has been discussed before. If the program you're trying to control buffers its output and gives no option to disab

Re: multiline comments

2006-04-19 Thread Lawrence D'Oliveiro
In article <[EMAIL PROTECTED]>, Edward Elliott <[EMAIL PROTECTED]> wrote: >ML has a >very elegant system for nested comments with (* and *). Which, if you mistype an opening or closing comment symbol, can lead to some very mysterious syntax errors. -- http://mail.python.org/mailman/listinfo/p

Re: Activating Batch Files from Python

2006-04-19 Thread Lawrence D'Oliveiro
In article <[EMAIL PROTECTED]>, "Jeff Groves" <[EMAIL PROTECTED]> wrote: >How can I use the .bat file to set environmental vars from Python? How about sourcing it from a shell, then using that same shell instance to run the programs? -- http://mail.python.org/mailman/listinfo/python-list

Re: perspective on ruby

2006-04-20 Thread Lawrence D'Oliveiro
In article <[EMAIL PROTECTED]>, Edward Elliott <[EMAIL PROTECTED]> wrote: >The fact that even >numeric literals are objects make me suspicious of Ruby as a >general-purpose language though. Isn't Python going that way? -- http://mail.python.org/mailman/listinfo/python-list

Re: newbie OO question

2006-04-20 Thread Lawrence D'Oliveiro
In article <[EMAIL PROTECTED]>, Jeremy Winters <[EMAIL PROTECTED]> wrote: from SegmentValue import * I remember in the old days a computing support guy saying he refused to help any users with FORTRAN questions unless they had an "IMPLICIT NONE" in every program block. The corresponding

Re: proposed Python logo

2006-04-21 Thread Lawrence D'Oliveiro
In article <[EMAIL PROTECTED]>, "Michael Tobis" <[EMAIL PROTECTED]> wrote: >"Is this the right room for an argument?" > >http://geosci.uchicago.edu/~tobis/snake.png Too rigid-looking somehow. I think get rid of the straight right-angle lines. -- http://mail.python.org/mailman/listinfo/python-l

Re: Activating Batch Files from Python

2006-04-21 Thread Lawrence D'Oliveiro
In article <[EMAIL PROTECTED]>, "Jeff Groves" <[EMAIL PROTECTED]> wrote: >>How about sourcing it from a shell, then using that same shell instance >>to run the programs? > >How would I do that? As I've said, I haven't found a Python command >that lets you send multiple commands to the same shell

Re: a subprocess qns

2006-04-21 Thread Lawrence D'Oliveiro
In article <[EMAIL PROTECTED]>, [EMAIL PROTECTED] wrote: >i wanted to start execute a command and put it in the background. i am >using Unix. >Usually i start this command using something like this : >"/path/somecmd &" with the "&" to put it to background. Even if it's in the background with "&

Re: proposed Python logo

2006-04-21 Thread Lawrence D'Oliveiro
In article <[EMAIL PROTECTED]>, Grant Edwards <[EMAIL PROTECTED]> wrote: >Sincy Python wasn't named after the snake, why the insistence >on using a snake in the logo? ... >I think something Monty Python related would be better. How >about a nice can of spam? Six words: copyright violation ... t

Re: proposed Python logo

2006-04-21 Thread Lawrence D'Oliveiro
In article <[EMAIL PROTECTED]>, "Michael Tobis" <[EMAIL PROTECTED]> wrote: >I think the colon as snake-eyes thing is a big win I liked that bit too. Whatever changes are made, that should be kept. -- http://mail.python.org/mailman/listinfo/python-list

Re: Can you create an instance of a subclass with an existing instance of the base class?

2006-04-21 Thread Lawrence D'Oliveiro
In article <[EMAIL PROTECTED]>, "Sandra-24" <[EMAIL PROTECTED]> wrote: >Can you create an instance of a subclass using an existing instance of >the base class? I think you're taking Python's OO-ness too seriously. One of the strengths of Python is that it can _look_ like an OO language without

Re: perspective on ruby

2006-04-21 Thread Lawrence D'Oliveiro
In article <[EMAIL PROTECTED]>, Edward Elliott <[EMAIL PROTECTED]> wrote: >XML? Conceptually (and more elegantly) covered >as LISP s-expressions. "...Lisp is still #1 for key algorithmic techniques such as recursion and condescension." -- Verity Stob

Re: Powerful Command line parsers

2006-04-21 Thread Lawrence D'Oliveiro
In article <[EMAIL PROTECTED]>, John Machin <[EMAIL PROTECTED]> wrote: >To meet your specifications, the module would need to incorporate a >mini-language: > >if a and (b or c): nasty("blah 1") >if not (a or b or c or d): nasty("blah 2") >if a and c and not d: nasty("blah 3") Prolog-style predi

Re: proposed Python logo

2006-04-22 Thread Lawrence D'Oliveiro
In article <[EMAIL PROTECTED]>, Dennis Lee Bieber <[EMAIL PROTECTED]> wrote: >On Fri, 21 Apr 2006 16:13:53 -0700, "Carl J. Van Arsdall" ><[EMAIL PROTECTED]> declaimed the following in comp.lang.python: > >> Lawrence D'Oliveiro wrote: >&g

Re: Looking for resources for making the jump from Java to Python easier and more productive

2006-04-22 Thread Lawrence D'Oliveiro
In article <[EMAIL PROTECTED]>, "ToddLMorgan" <[EMAIL PROTECTED]> wrote: >I'm looking for the common types of mistakes that say a Java/C# or >even C++ developer may commonly make. Using subclassing when you don't have to. For instance, you might have a Java method which takes an argument of typ

Re: Looking for resources for making the jump from Java to Python easier and more productive

2006-04-22 Thread Lawrence D'Oliveiro
In article <[EMAIL PROTECTED]>, "ToddLMorgan" <[EMAIL PROTECTED]> wrote: >Are there python specific equivalents to the common Patterns, >Anti-Patterns and Refactoring books that are so prevalent as >reccomended reading in C++ and Java? I don't think they exist. Such books are targeted more towar

Re: Raising a specific OSError

2006-04-22 Thread Lawrence D'Oliveiro
In article <[EMAIL PROTECTED]>, David Hirschfield <[EMAIL PROTECTED]> wrote: >When I attempt to perform a file operation on a non-existent file, I get >an OSError: [Errno 2], but what if I want to raise one of those myself? raise OSError(2, "No such file or directory") -- http://mail.python.or

Re: another question about buffers

2006-04-22 Thread Lawrence D'Oliveiro
In article <[EMAIL PROTECTED]>, [EMAIL PROTECTED] wrote: >databack = sockobj.recv(1028) >if databack: > print 'caught a message %s bytes ' % len(databack) >else: > print 'fail to recieve data from server' > >the output in the terminal runs fine until it fails to get the >databack, it

Re: send cookie on request with urllib2

2006-04-22 Thread Lawrence D'Oliveiro
In article <[EMAIL PROTECTED]>, [EMAIL PROTECTED] (John J. Lee) wrote: >"No," scolded Yoda. "Do, or do not. There is no try." Convincing argument against exceptions, don't you think. :) -- http://mail.python.org/mailman/listinfo/python-list

Re: FOUNDIT (was Re: massive threading performance)

2006-04-22 Thread Lawrence D'Oliveiro
In article <[EMAIL PROTECTED]>, Paul Sijben <[EMAIL PROTECTED]> wrote: >I found that the problem was caused by the sending thread not giving >control back quickly enough to the receiving thread. > >Also in going through the code I found an old self.s.setblocking(0)call >that was no longer relevan

Re: Uniquifying a list?

2006-04-22 Thread Lawrence D'Oliveiro
In article <[EMAIL PROTECTED]>, Felipe Almeida Lessa <[EMAIL PROTECTED]> wrote: >"list(set(x))" is the clear winner with almost O(1) performance. Moral: in an interpreted language, use builtins as much as possible. -- http://mail.python.org/mailman/listinfo/python-list

Re: [OT] Any Python lullabies?

2006-04-22 Thread Lawrence D'Oliveiro
In article <[EMAIL PROTECTED]>, Ralf Muschall <[EMAIL PROTECTED]> wrote: >Christos Georgiou wrote: >> ... that I can sing to my newborn son (actually, born yesterday)? > >...but the baby probably won't see the difference. Boy, some people do take the "born yesterday" bit to heart. don't they. :

Re: a flattening operator?

2006-04-22 Thread Lawrence D'Oliveiro
In article <[EMAIL PROTECTED]>, "gangesmaster" <[EMAIL PROTECTED]> wrote: >as we all know, * (asterisk) can be used to "inline" or "flatten" a >tuple into an argument list, i.e.: > >def f(a, b, c): >... >x = (1,2,3) >f(*x) > >so... mainly for symmetry's sake, why not make a "flattening" opera

Re: another question about buffers

2006-04-22 Thread Lawrence D'Oliveiro
In article <[EMAIL PROTECTED]>, [EMAIL PROTECTED] wrote: >i think it may be, Moral: don't use arbitrary values as booleans. -- http://mail.python.org/mailman/listinfo/python-list

Re: Can you create an instance of a subclass with an existing instance of the base class?

2006-04-22 Thread Lawrence D'Oliveiro
In article <[EMAIL PROTECTED]>, "Sandra-24" <[EMAIL PROTECTED]> wrote: >Now that is a clever little trick. I never would have guessed you can >assign to __class__, Python always surprises me in it's sheer >flexibility. That's because you're still thinking in OO terms. -- http://mail.python.org/

Re: Can you create an instance of a subclass with an existing instance of the base class?

2006-04-23 Thread Lawrence D'Oliveiro
In article <[EMAIL PROTECTED]>, "Sandra-24" <[EMAIL PROTECTED]> wrote: >However in this case I'm simply getting an object (an mp_request object >from mod_python) passed into my function, and before I pass it on to >the functions that make up and individual web page it is modified by >adding membe

Re: Looking for resources for making the jump from Java to Python easier and more productive

2006-04-24 Thread Lawrence D'Oliveiro
In article <[EMAIL PROTECTED]>, "gene tani" <[EMAIL PROTECTED]> wrote: >http://www.ferg.org/projects/python_gotchas.html Amazing. Backslashes are listed as not one, but _two_ items on the list. The problem is not with Python at all, it is with the MS-DOS foundations of Windows. When directory

Re: Looking for resources for making the jump from Java to Python easier and more productive

2006-04-24 Thread Lawrence D'Oliveiro
In article <[EMAIL PROTECTED]>, bruno at modulix <[EMAIL PROTECTED]> wrote: >Lawrence D'Oliveiro wrote: >> In article <[EMAIL PROTECTED]>, >> "ToddLMorgan" <[EMAIL PROTECTED]> wrote: >> >>>I'm looking for the common

Re: Looking for resources for making the jump from Java to Python easier and more productive

2006-04-24 Thread Lawrence D'Oliveiro
In article <[EMAIL PROTECTED]>, "Mike Orr" <[EMAIL PROTECTED]> wrote: >Lawrence D'Oliveiro wrote: >> "ToddLMorgan" <[EMAIL PROTECTED]> wrote: >> >Are there python specific equivalents to the common Patterns, >> >Anti-Patterns

Re: Probability Problem

2006-04-24 Thread Lawrence D'Oliveiro
In article <[EMAIL PROTECTED]>, Elliot Temple <[EMAIL PROTECTED]> wrote: >Problem: Randomly generate 10 integers from 0-100 inclusive, and sum >them. Do that twice. What is the probability the two sums are 390 apart? I think the sum would come close to a normal distribution. -- http://mail.py

Re: Multiple hierarchies and method overloading

2006-04-25 Thread Lawrence D'Oliveiro
In article <[EMAIL PROTECTED]>, "Ben Cartwright" <[EMAIL PROTECTED]> wrote: >Philippe Martin wrote: > >> I renamed A_Func(self) to fix that ... but is there a cleaner way around ? > >When using multiple inheritence, the order of the base classes matters! When you have to start worrying about com

Re: Can you create an instance of a subclass with an existing instance of the base class?

2006-04-25 Thread Lawrence D'Oliveiro
In article <[EMAIL PROTECTED]>, bruno at modulix <[EMAIL PROTECTED]> wrote: >Lawrence D'Oliveiro wrote: >(snip) >> I think you're taking Python's OO-ness too seriously. One of the >> strengths of Python is that it can _look_ like an OO language w

Re: Looking for resources for making the jump from Java to Python easier and more productive

2006-04-27 Thread Lawrence D'Oliveiro
In article <[EMAIL PROTECTED]>, bruno at modulix <[EMAIL PROTECTED]> wrote: >Lawrence D'Oliveiro wrote: >> In article <[EMAIL PROTECTED]>, >> bruno at modulix <[EMAIL PROTECTED]> wrote: >> >> >>>Lawrence D'Oliveiro wrote:

Re: OOP / language design question

2006-04-27 Thread Lawrence D'Oliveiro
In article <[EMAIL PROTECTED]>, Duncan Booth <[EMAIL PROTECTED]> wrote: >Carl Banks wrote: > >> You know, Python's __init__ has almost the same semantics as C++ >> constructors (they both initialize something that's already been >> allocated in memory, and neither can return a substitute object).

Re: OOP / language design question

2006-04-27 Thread Lawrence D'Oliveiro
In article <[EMAIL PROTECTED]>, "Carl Banks" <[EMAIL PROTECTED]> wrote: >bruno at modulix wrote: >> [EMAIL PROTECTED] wrote: >> > I was wondering, why you always have to remember to call bases' >> > constructors >> >> >> s/constructors/__init__/ >> >> the __init__() method is *not* the construct

Re: Can you create an instance of a subclass with an existing instance of the base class?

2006-04-27 Thread Lawrence D'Oliveiro
In article <[EMAIL PROTECTED]>, Bruno Desthuilliers <[EMAIL PROTECTED]> wrote: >Sandra-24 a écrit : >> Lawrence D'Oliveiro wrote: >> >>>In article <[EMAIL PROTECTED]>, >>> "Sandra-24" <[EMAIL PROTECTED]> wrote: >>&

Re: Can you create an instance of a subclass with an existing instance of the base class?

2006-04-27 Thread Lawrence D'Oliveiro
In article <[EMAIL PROTECTED]>, bruno at modulix <[EMAIL PROTECTED]> wrote: >Lawrence D'Oliveiro wrote: >> In article <[EMAIL PROTECTED]>, >> bruno at modulix <[EMAIL PROTECTED]> wrote: >> >> >>>Lawrence D'Oliveiro wrote:

Re: Multiple equates

2008-11-24 Thread Lawrence D'Oliveiro
Cameron Laird wrote: > I've been trying to decide if there's any sober reason to advocate > the one-liner > > map(lambda i: a.__setitem__(i, False), [x1, x2, x3, ..., x1024]) Are lambdas like the Dark Side of Python? :) -- http://mail.python.org/mailman/listinfo/python-list

Re: Palette-mode PNG images

2008-11-24 Thread Lawrence D'Oliveiro
Lawrence D'Oliveiro wrote: > Ideally I'd like to create a PNG file with just two bits per pixel, with > four colour-table entries of my choice. I'm using PyCairo > <http://www.cairographics.org/pycairo/> to do the drawing, but that > doesn't seem to suppo

Re: Python surpasses Perl in popularity?

2008-11-24 Thread Lawrence D'Oliveiro
[EMAIL PROTECTED] wrote: > I would venture so far to say that perl is todays 'C'.. Perl is the FORTRAN of scripting languages. Python is in some ways like Pascal. Java is like COBOL. C? Who knows... -- http://mail.python.org/mailman/listinfo/python-list

Re: Security implications of using open() on untrusted strings.

2008-11-24 Thread Lawrence D'Oliveiro
Jorgen Grahn wrote: > Seems to me you simply want to know beforehand that the reading will > work. But you can never check that! You can stat(2) the file, or > open-and-close it -- and then a microsecond later, someone deletes the > file, or replaces it with another one, or write-protects it, or

Re: 3.0rc3: 'os.extsep' gone ... ?

2008-11-24 Thread Lawrence D'Oliveiro
"Martin v. Löwis" wrote: > That doesn't really explain it. It always was os.path.extsep, > but it *also* was os.extsep. > > I don't know the rationale for this change myself, either. Probably because it's considered platform-specific. -- http://mail.python.org/mailman/listinfo/python-list

Re: Printing digits in one place

2008-11-24 Thread Lawrence D'Oliveiro
Oltmans wrote: > Bytes Transfered so far X > > and X will increase and cursor should stay at this position. Most terminal emulators are VT100-compatible these days. You could use something like [80D to move back to the beginning of the same line. -- http://mail.python.org/mailman/listinfo/pytho

Re: 3.0rc3: 'os.extsep' gone ... ?

2008-11-25 Thread Lawrence D'Oliveiro
Terry Reedy wrote: > The doc for os.path begins "This module implements some useful functions > on pathnames". os.path contains functions that work differently on different systems. It is in fact a variable that is initialized to point to posixpath, ntpath etc as appropriate for the current sys

Re: Getting in to metaprogramming

2008-11-27 Thread Lawrence D'Oliveiro
Rafe wrote: > In the name of self-education can anyone share some pointers, links, > modules, etc that I might use to begin learning how to do some > "metaprogramming". Fred Brooks, in his classic "Mythical Man-Month", defined "metaprogramming" as simply a very high-level form of programming, us

Re: Is the behavior expected?

2008-11-27 Thread Lawrence D'Oliveiro
Michele Simionato wrote: > Guido and the Common Lisp implementors are happy with mutating the loop > index. I myself prefer the functional way. I'd agree with you, except Python doesn't provide any way to create user-defined constants, so constant loop indices have no precedent. -- http://mail.p

Re: end of print = lower productivity ?

2008-12-01 Thread Lawrence D'Oliveiro
In message <[EMAIL PROTECTED]>, [EMAIL PROTECTED] wrote: > Now the print statement disappeared, and I have to write print("f") > instead. These parentheses not only take time to write, they also make > me think twice about using print for debugging purposes. Trouble is, print defaulted to printin

Re: Emacs vs. Eclipse vs. Vim

2008-12-01 Thread Lawrence D'Oliveiro
In message <[EMAIL PROTECTED]>, Roy Smith wrote: > Likewise for the source control (CVS, SVN, P4, etc) integrations [in > emacs]. Discovered that by accident today. Had a conflicted update in Subversion, fixed it up, saved the file, switched to a terminal window, typed "svn status", and lo and be

Re: Multiple equates

2008-12-02 Thread Lawrence D'Oliveiro
In message <[EMAIL PROTECTED]>, Cameron Laird wrote: > In article <[EMAIL PROTECTED]>, > Lawrence D'Oliveiro <[EMAIL PROTECTED]> wrote: > >>Cameron Laird wrote: >> >>> I've been trying to decide if there's any sober reason to advoca

Linear2D

2008-12-02 Thread Lawrence D'Oliveiro
I've decided to give Github a go, with a simple project containing some routines for performing 2D linear transformations . This takes a functional rather than procedural approach. For example, a function to construct a matrix that maps a source rectangle to a

Re: Multiple equates

2008-12-03 Thread Lawrence D'Oliveiro
Cameron Laird wrote: >def f1(Match): >return Something missing here? -- http://mail.python.org/mailman/listinfo/python-list

Re: Running a Python script from crontab

2008-12-03 Thread Lawrence D'Oliveiro
In message <[EMAIL PROTECTED]>, Astley Le Jasper wrote: > The trouble is that obviously I get no console when using crontab so > can't see any traceback. Cron normally sends you mail if a cron task generated any output (this should include error messages). -- http://mail.python.org/mailman/listin

Re: Multiple equates

2008-12-03 Thread Lawrence D'Oliveiro
In message <[EMAIL PROTECTED]>, Cameron Laird wrote: >def shell_escape(Arg) : >"""returns Arg suitably escaped for use as a command-line argument >to Bash.""" > >pattern = r"[\<\>\"\'\|\&\$\#\;\(\)\[\]\{\}\`\!\~\ \\]" >def f1(Match): > return "\\" + Match.group

Re: Running a Python script from crontab

2008-12-03 Thread Lawrence D'Oliveiro
In message <[EMAIL PROTECTED]>, Philip Semanchuk wrote: > In my experience, the environment in which a cron job runs is > different from the environment in which some command line scripts run... Which is true, but again, cron should report the environment in the mail message. For example, here ar

Don't you just love writing this sort of thing :)

2008-12-03 Thread Lawrence D'Oliveiro
for \ Entry \ in \ sorted \ ( f for f in os.listdir(PatchesDir) if PatchDatePat.search(f) != None ) \ : Patch = (open, gzip.GzipFile)[Entry.endswith(".gz")](os.path.join(PatchesDir, Entry), "r") ... read from Patch ... Patch.close() #

Re: Multiple equates

2008-12-03 Thread Lawrence D'Oliveiro
In message <[EMAIL PROTECTED]>, Cameron Laird wrote: > There's a realm within Pythonia that favors lambdalessness. Why is that? Was Rossum frightened in his cradle by a lambda when he was a baby? Are some people afraid of lambdas the way others are afraid of spiders? -- http://mail.python.org/mai

Re: Don't you just love writing this sort of thing :)

2008-12-04 Thread Lawrence D'Oliveiro
In message <[EMAIL PROTECTED]>, Duncan Booth wrote: > Have you ever considered trying to write readable code instead? > > (I must admit I haven't checked whether GZipFile works with the 'with' > statement... That's why I prefer writing _correct_ code instead. -- http://mail.python.org/mailma

Re: Running a Python script from crontab

2008-12-04 Thread Lawrence D'Oliveiro
In message <[EMAIL PROTECTED]>, Astley Le Jasper wrote: > On Dec 4, 12:34 am, Lawrence D'Oliveiro <[EMAIL PROTECTED] > central.gen.new_zealand> wrote: >> >> For example, here are some headers from a recent run of the >> maildir backup task I have scheduled

Re: Don't you just love writing this sort of thing :)

2008-12-04 Thread Lawrence D'Oliveiro
In message <[EMAIL PROTECTED]>, Cong Ma wrote: > The "if ... != None" is not necessary... "if PatchDatePat.search(f)" is > OK. I don't do that. -- http://mail.python.org/mailman/listinfo/python-list

Re: Don't you just love writing this sort of thing :)

2008-12-05 Thread Lawrence D'Oliveiro
In message <[EMAIL PROTECTED]>, Steven D'Aprano wrote: > On Fri, 05 Dec 2008 13:27:35 +1300, Lawrence D'Oliveiro wrote: > >> In message <[EMAIL PROTECTED]>, Cong >> Ma wrote: >> >>> The "if ... != None" is not necessary.

<    1   2   3   4   5   6   7   8   9   10   >