Ah, ctypes

2009-06-01 Thread Lawrence D'Oliveiro
I wrote some code months ago to output 1-bit-per-pixel PNG files from Python, doing direct calls to libpng using ctypes, because PIL didn't give me sufficient control over colour tables and pixel depths. I thought the code was working fine. I left it aside for some months, came back to it a week o

Re: What text editor is everyone using for Python

2009-06-01 Thread Lawrence D'Oliveiro
In message , Albert van der Horst wrote: > You can carry vim (or Edwin's editor for that matter) on a FAT > [USB] stick. > (As they say: "Speak softly, and carry a large stick.") I like that. :) -- http://mail.python.org/mailman/listinfo/python-list

Re: What text editor is everyone using for Python

2009-06-01 Thread Lawrence D'Oliveiro
In message , Albert van der Horst wrote: > An indication of how one can see one is in emacs is also appreciated. How about, hit CTRL/G and see if the word "Quit" appears somewhere. -- http://mail.python.org/mailman/listinfo/python-list

Re: Ah, ctypes

2009-06-02 Thread Lawrence D'Oliveiro
In message , Nick Craig- Wood wrote: > As a ctypes user I found this an interesting story - thanks for > posting it! By the way, I hate wildcard imports. In the ctypes docs, they recommend you do this from ctypes import * but I prefer this: import ctypes as ct which explains the "ct.

Re: Using C++ and ctypes together: a vast conspiracy? ;)

2009-06-02 Thread Lawrence D'Oliveiro
In message , Sebastian Wiesner wrote: > > >> That said I've used C++ with ctypes loads of times, but I always wrap >> the exported stuff in extern "C" { } blocks. > > No wonder, you have never actually used C++ with C types. An extern "C" > clause tells the compiler to generate C functions (mo

Re: Seach for encrypted socket wrapper

2009-06-02 Thread Lawrence D'Oliveiro
In message <4a24f0cc$0$3278$8e6e7...@newsreader.ewetel.de>, Hans Müller wrote: > display clientCalculation > module in COBOL (yes, big, old but it > works well) > (python, wxpython)<- Network connection ->C-Lib beeing called from > COBO

Re: Using C++ and ctypes together: a vast conspiracy? ;)

2009-06-03 Thread Lawrence D'Oliveiro
In message , Kay Schluehr wrote: > On 3 Jun., 05:51, Lawrence D'Oliveiro central.gen.new_zealand> wrote: > >> In message , Sebastian Wiesner wrote: >> >> > >> >> >> That said I've used C++ with ctypes loads of times, but I alw

Re: Project source code layout?

2009-06-03 Thread Lawrence D'Oliveiro
In message , Allen Fowler wrote: > I'm new to Python, and am looking for some suggestions as to the source > code layout for a new project. Is this the development layout or the deployment layout? The two need not bear any resemblance. -- http://mail.python.org/mailman/listinfo/python-list

Re: Project source code layout?

2009-06-04 Thread Lawrence D'Oliveiro
In message , Allen Fowler wrote: > I was hoping to keep the dev layout as close to deployment possible. Completely different purposes. For example, the actual production database and config files form no part of your development project, do they? And conversely, utility scripts that might be u

Re: What text editor is everyone using for Python

2009-06-04 Thread Lawrence D'Oliveiro
In message , Nick Craig- Wood wrote: > You quit emacs with Ctrl-X Ctrl-C. That's "save-buffers-kill-emacs". If you don't want to save buffers, the exit sequence is alt-tilde, f, e. -- http://mail.python.org/mailman/listinfo/python-list

Re: What text editor is everyone using for Python

2009-06-04 Thread Lawrence D'Oliveiro
In message , Albert van der Horst wrote: > Memories of Atari 260/520/1040 that had a keyboard with a key actually > marked ... HELP. And the OLPC machines have a key marked "reveal source". -- http://mail.python.org/mailman/listinfo/python-list

Re: Project source code layout?

2009-06-04 Thread Lawrence D'Oliveiro
In message , Allen Fowler wrote: > 1) Do you use virtualpython? No idea what that is. > 2) How do you load the modules in your lib directory? At the beginning of my scripts, I have a sequence like test_mode = False # True for testing, False for production if test_mode : home_

Re: Yet another unicode WTF

2009-06-04 Thread Lawrence D'Oliveiro
In message , Ron Garret wrote: > Python 2.6.2 on OS X 10.5.7: Same result, Python 2.6.1-3 on Debian Unstable. My $LANG is en_NZ.UTF-8. > ... I always thought one of the fundamental > invariants of unix processes was that there's no way for a process to > know what's on the other end of its stdo

Re: Project source code layout?

2009-06-04 Thread Lawrence D'Oliveiro
In message , Dave Angel wrote: > Rather than editing the source files at install time, consider just > using an environment variable in your testing environment, which would > be missing in production environment. I'd still need to define that environment variable in a wrapper script, which mea

Re: Yet another unicode WTF

2009-06-04 Thread Lawrence D'Oliveiro
In message , Gabriel Genellina wrote: > Python knows the terminal encoding (or at least can make a good guess), > but a file may use *any* encoding you want, completely unrelated to your > terminal settings. It should still respect your localization settings, though. -- http://mail.python.org/

Re: python way to automate IE8's File Download dialog

2009-06-04 Thread Lawrence D'Oliveiro
In message <4f4f3e86-170a-4ad9-934d-4fa5b7d23...@n4g2000vba.googlegroups.com>, monogeo wrote: > I am able to use PAMIE 2.0 to automate IE7's File Download dialog, but > the same approach/code fails on IE8. I don't understand why you need to automate a GUI front-end, meant for human use, to a f

Re: Project source code layout?

2009-06-04 Thread Lawrence D'Oliveiro
In message , Jean-Paul Calderone wrote: > On Thu, 04 Jun 2009 21:33:13 +1200, Lawrence D'Oliveiro > wrote: > >>In message , Allen >>Fowler wrote: >> >>> I was hoping to keep the dev layout as close to deployment possible. >> >>Completely d

Re: Odd closure issue for generators

2009-06-04 Thread Lawrence D'Oliveiro
In message , Brian Quinlan wrote: >>>> c = (lambda : i for i in range(11, 16)) >>>> d = list(c) >>>> for q in d: >...print(q()) >... >15 >15 >15 >15 >15 Try >>> c = ((lambda i : lambda : i)(i) for i in range(11, 16)) >>> d = list(c) >>

Re: Odd closure issue for generators

2009-06-05 Thread Lawrence D'Oliveiro
In message <78180b4c-68b2-4a0c-8594-50fb1ea2f...@c19g2000yqc.googlegroups.com>, Michele Simionato wrote: > The crux is in the behavior of the for loop: > in Python there is a single scope and the loop variable is > *mutated* at each iteration, whereas in Scheme (or Haskell or any > other functio

Re: Project source code layout?

2009-06-05 Thread Lawrence D'Oliveiro
In message , Dave Angel wrote: > Lawrence D'Oliveiro wrote: > >> In message , Dave >> Angel wrote: >> >>> Rather than editing the source files at install time, consider just >>> using an environment variable in your testing environment, which

Re: Adding a Par construct to Python?

2009-06-05 Thread Lawrence D'Oliveiro
In message <77as23f1fhj3...@mid.uni-berlin.de>, Diez B. Roggisch wrote: >> But reduce()? I can't see how you can parallelize reduce(). By its >> nature, it has to run sequentially: it can't operate on the nth item >> until it is operated on the (n-1)th item. > > That depends on the operation in q

Re: singletons

2008-07-16 Thread Lawrence D'Oliveiro
In message <[EMAIL PROTECTED]>, Craig Allen wrote: > ... the ideal is still that > > tl = TehLibrary() would always return the same object. >> class TehLibrary(object) : ... @classmethod ... def __new__(self, cls) : ... return self >>> s = TehLibrary() >>> s == TehLibrary() True

Re: Converting from local -> UTC

2008-07-16 Thread Lawrence D'Oliveiro
In message <[EMAIL PROTECTED]>, Keith Hughitt wrote: > I have a UTC date (e.g. 2008-07-11 00:00:00). I would like to create a > UTC date ... >>> import calendar >>> calendar.timegm((2008, 7, 11, 0, 0, 0, 0, 0, -1)) 1215734400 [EMAIL PROTECTED]> TZ=NZ date -d "00:00:00 01-Jan-1970Z +1215734400 s

Re: Problem with MySQLdb and mod_python

2008-07-16 Thread Lawrence D'Oliveiro
In message <[EMAIL PROTECTED]>, Cyril Bazin wrote: > But it seems, after many tests, that the script stops at the > instruction : "c.execute(requete)" What's the error message? This should be in Apache's error_log file. -- http://mail.python.org/mailman/listinfo/python-list

Re: fork after creating temporary file using NamedTemporaryFile

2008-07-16 Thread Lawrence D'Oliveiro
In message <[EMAIL PROTECTED]>, Sebastian "lunar" Wiesner wrote: > Relying on the destructor is *always* a bad idea, you should always > close files explicitly! There shouldn't be any problem with files opened read-only. -- http://mail.python.org/mailman/listinfo/python-list

Re: Converting from local -> UTC

2008-07-17 Thread Lawrence D'Oliveiro
In message <[EMAIL PROTECTED]>, Gabriel Genellina wrote: > Note that I used %s everywhere (it's just a placeholder, not a format) ... >From /usr/lib64/python2.5/site-packages/MySQLdb/cursors.py, lines 150-151: if args is not None: query = query % db.literal(args) -- http://mail.pytho

Re: singletons

2008-07-17 Thread Lawrence D'Oliveiro
In message <[EMAIL PROTECTED]>, Craig Allen wrote: > On Jul 16, 7:01 pm, Lawrence D'Oliveiro <[EMAIL PROTECTED] > central.gen.new_zealand> wrote: >> >> >>> class TehLibrary(object) : >> >> ... @classmethod >> ... def __new__(se

Re: Python Written in C?

2008-07-21 Thread Lawrence D'Oliveiro
In message <[EMAIL PROTECTED]>, Michiel Overtoom wrote: > Many major text/word processing programs (Emacs, vi, MS-Word) are also > written in C. Does that mean you should do all your text processing in C? How else would you implement a Boyer-Moore algorithm? -- http://mail.python.org/mailman/list

Re: atan2 weirdness

2008-07-21 Thread Lawrence D'Oliveiro
In message <[EMAIL PROTECTED]>, Carsten Haese wrote: > Since pi is close to 3 ... "Biblical pi" = 3. -- http://mail.python.org/mailman/listinfo/python-list

Re: db question

2008-07-21 Thread Lawrence D'Oliveiro
In message <[EMAIL PROTECTED]>, Dennis Lee Bieber wrote: > On Sun, 20 Jul 2008 18:43:03 -0700, "bruce" <[EMAIL PROTECTED]> > declaimed the following in comp.lang.python: >> >> mysql cmd - select * from foo where dog like "%small%"; >> >> sql ="""select * from foo where dog like "%%%s%%" """ >> c

Re: Is this a valid use of 'import'?

2008-07-23 Thread Lawrence D'Oliveiro
In message <[EMAIL PROTECTED]>, Frank Millman wrote: > from Utils.client import * Besides the objections that others have mentioned, I HATE seeing wildcard imports. -- http://mail.python.org/mailman/listinfo/python-list

Re: Function editing with Vim throws IndentError

2008-07-24 Thread Lawrence D'Oliveiro
In message <[EMAIL PROTECTED]>, Matimus wrote: > That isn't the standard. With that setup tabs will show up as 4 > spaces, and still confuse you. Why should that be confusing? The most common tab-stop setting is 4 columns. -- http://mail.python.org/mailman/listinfo/python-list

Re: scanf in python

2008-07-24 Thread Lawrence D'Oliveiro
In message <[EMAIL PROTECTED]>, AMD wrote: > Actually it is quite common, it is used for processing of files not for > reading parameters. You can use it whenever you need to read a simple > csv file or fixed format file which contains many lines with several > fields per line. I do that all the

Re: Attack a sacred Python Cow

2008-07-24 Thread Lawrence D'Oliveiro
In message <[EMAIL PROTECTED]>, Jordan wrote: > Except when it comes to Classes. I added some classes to code that had > previously just been functions, and you know what I did - or rather, > forgot to do? Put in the 'self'. In front of some of the variable > accesses, but more noticably, at the s

Re: Confounded by Python objects

2008-07-24 Thread Lawrence D'Oliveiro
In message <[EMAIL PROTECTED]>, [EMAIL PROTECTED] wrote: > class Channel: > name = '' > sample = [] These are class variables, not instance variables. Take them out, and ... > def __init__(self, name): > self.name = name ... add this line to the above function sel

Re: Broken examples

2008-07-24 Thread Lawrence D'Oliveiro
In message <[EMAIL PROTECTED]>, norseman wrote: > The OOo examples do not work. I have done OOo scripting in Python. What exactly does not work? -- http://mail.python.org/mailman/listinfo/python-list

Re: Function editing with Vim throws IndentError

2008-07-24 Thread Lawrence D'Oliveiro
In message <[EMAIL PROTECTED]>, Matimus wrote: > On Jul 24, 2:54 am, Lawrence D'Oliveiro <[EMAIL PROTECTED] > central.gen.new_zealand> wrote: >> In message >> <[EMAIL PROTECTED]>, >> >> Matimus wrote: >> > That isn't the stan

Re: Attack a sacred Python Cow

2008-07-24 Thread Lawrence D'Oliveiro
In message <[EMAIL PROTECTED]>, Jordan wrote: > On Jul 24, 8:01 pm, Lawrence D'Oliveiro <[EMAIL PROTECTED] > central.gen.new_zealand> wrote: > >> In message >> <[EMAIL PROTECTED]>, >> Jordan wrote: >> >> > Except when it comes to Cl

Re: Broken examples

2008-07-24 Thread Lawrence D'Oliveiro
In message <[EMAIL PROTECTED]>, norseman wrote: > Lawrence D'Oliveiro wrote: > >> In message <[EMAIL PROTECTED]>, norseman >> wrote: >> >>> The OOo examples do not work. >> >> I have done OOo scripting in Python. What exactly does

Re: os.walk question

2008-07-24 Thread Lawrence D'Oliveiro
In message <[EMAIL PROTECTED]>, Fredrik Lundh wrote: > Lanny wrote: > >> How would one make a list of the files in the top directory >> using os.walk. >> >> I need to pick a random file from said list. > > if you want a list of files from a single directory, use listdir, not > walk: > >

Re: Question about inheritence

2008-07-24 Thread Lawrence D'Oliveiro
In message <[EMAIL PROTECTED]>, Fredrik Lundh wrote: > Python doesn't really have constructors; when you create an object, > Python first creates the object and then calls the __init__ method, if > available That's the usual meaning of "constructor". It doesn't actually "construct" the object, it

Re: scanf in python

2008-07-26 Thread Lawrence D'Oliveiro
In message <[EMAIL PROTECTED]>, AMD wrote: >> In message <[EMAIL PROTECTED]>, AMD wrote: >> >>> Actually it is quite common, it is used for processing of files not for >>> reading parameters. You can use it whenever you need to read a simple >>> csv file or fixed format file which contains many l

Re: Function editing with Vim throws IndentError

2008-07-26 Thread Lawrence D'Oliveiro
In message <[EMAIL PROTECTED]>, Matimus wrote: > On Jul 24, 9:32 pm, Lawrence D'Oliveiro <[EMAIL PROTECTED] > central.gen.new_zealand> wrote: > >> In message >> <[EMAIL PROTECTED]>, >> Matimus wrote: >> >> > On Jul 24, 2:54 am, La

Re: Function editing with Vim throws IndentError

2008-07-26 Thread Lawrence D'Oliveiro
In message <[EMAIL PROTECTED]>, Thomas Troeger wrote: > Finally, I'd like to throw in this one from the Linux kernel sources, > from `Documentation/CodingStyle: > > > > Chapter 1: Indentation > > Tabs are 8 characters, and

Re: Attack a sacred Python Cow

2008-07-26 Thread Lawrence D'Oliveiro
In message <[EMAIL PROTECTED]>, [EMAIL PROTECTED] wrote: > On Jul 24, 5:01 am, Lawrence D'Oliveiro <[EMAIL PROTECTED] > central.gen.new_zealand> wrote: > >> In message >> <[EMAIL PROTECTED]>, >> Jordan wrote: >> >> > Excep

Re: Attack a sacred Python Cow

2008-07-26 Thread Lawrence D'Oliveiro
In message <[EMAIL PROTECTED]>, [EMAIL PROTECTED] wrote: > "Support OO but it doesn't have to"? That sounds like saying that in > some Python implementations you'll be able to use OO, but that you > just might bump into a Python distribution ... Change "distribution" to "program" and you're on th

Re: Attack a sacred Python Cow

2008-07-27 Thread Lawrence D'Oliveiro
In message <[EMAIL PROTECTED]>, [EMAIL PROTECTED] wrote: > On Jul 26, 6:47 pm, Lawrence D'Oliveiro <[EMAIL PROTECTED] > central.gen.new_zealand> wrote: >> In message >> <[EMAIL PROTECTED]>, >> >> [EMAIL PROTECTED] wrote: >>

Re: Python program as daemon?

2008-07-27 Thread Lawrence D'Oliveiro
In message <[EMAIL PROTECTED]>, sturlamolden wrote: > Basically it forks twice ... What's the advantage of forking twice over forking once and calling setsid? -- http://mail.python.org/mailman/listinfo/python-list

Re: How to find processes from Python

2008-07-27 Thread Lawrence D'Oliveiro
In message <[EMAIL PROTECTED]>, Johny wrote: > Is there a way how to find out running processes?E.g. how many > Appache's processes are running? Under Linux, every process has a procfs directory /proc/, where is the process ID. In here you will find all kinds of interesting information about th

Re: Attack a sacred Python Cow

2008-07-28 Thread Lawrence D'Oliveiro
In message <[EMAIL PROTECTED]>, [EMAIL PROTECTED] wrote: > On Jul 27, 10:55 pm, Lawrence D'Oliveiro <[EMAIL PROTECTED] > central.gen.new_zealand> wrote: >> In message >> <[EMAIL PROTECTED]>, >> >> >> >> [EMAIL PROTECTED] wrot

Re: SMTP via GMAIL

2008-09-17 Thread Lawrence D'Oliveiro
In message <[EMAIL PROTECTED]>, sui wrote: > Traceback (most recent call last): > File "mail5.py", line 21, in > session = smtplib.SMTP(SMTPserver,port) > File "/usr/local/lib/python2.5/smtplib.py", line 244, in __init__ > (code, msg) = self.connect(host, port) > File "/usr/local/li

Re: CTypes on a 64 bit machine truncates pointers to 32 bits?

2008-09-20 Thread Lawrence D'Oliveiro
In message <[EMAIL PROTECTED]>, Ron Garret wrote: > Default return type is int, which I assumed would be > 64 bits on a 64 bit machine, but turns out it's 32. Stupid. I think preferred ABIs these days are LP64, not ILP64 or LLP64. -- http://mail.python.org/mailman/listinfo/python-list

Re: Regex Help

2008-09-23 Thread Lawrence D'Oliveiro
In message <[EMAIL PROTECTED]>, Support Desk wrote: > Anybody know of a good regex to parse html links from html code? The one I > am currently using seems to be cutting off the last letter of some links, > and returning links like > > http://somesite.co > > or http://somesite.ph > > the code I

Re: finding domain name

2008-09-24 Thread Lawrence D'Oliveiro
In message <[EMAIL PROTECTED]>, Bobby Roberts wrote: > evidently the environ dictionary is off limits on our server. Why? > It can't > be that tough in python to get the current complete url being viewed. > It's a snap in asp(which is my background). Unless, of course, the relevant information

Re: A bit weird dictionary behavior

2008-09-24 Thread Lawrence D'Oliveiro
In message <[EMAIL PROTECTED]>, Terry Reedy wrote: > From this viewpoint, objecters would instead have to argue that it is > wrong to have such implicit calls and that programmers should have to > put them in explicitly. But then again, you want to avoid unexpected restrictions like in Java, whe

Re: Time.sleep(0.0125) not available within Linux

2008-09-24 Thread Lawrence D'Oliveiro
In message <[EMAIL PROTECTED]>, Grant Edwards wrote: > On 2008-09-23, Blubaugh, David A. <[EMAIL PROTECTED]> wrote: > >> I was wondering if anyone has come across the issue of not being allowed >> to have the following within a Python script operating under Linux: >> >> time.sleep(0.0125) > > No

Re: Modifying the system menu

2008-09-24 Thread Lawrence D'Oliveiro
In message <[EMAIL PROTECTED]>, [EMAIL PROTECTED] wrote: > For example say - I am creating multiple desktops for windows - > and I want to give every application the capability to be moved across > different desktops. But doesn't the desktop environment/window manager that provides the multi

Re: Program works great, except under less, cron or execl (Unicode?)

2008-09-24 Thread Lawrence D'Oliveiro
In message <[EMAIL PROTECTED]>, Sam wrote: > So how can I set sys.stdout.encoding so it's UTF-8 when piped through > cat (or anything else). > > I tried assigning to it, but no dice. You could try wrapping it in a file object that does explicit encoding translation, using codecs.EncodedFile

RE: Regex Help

2008-09-25 Thread Lawrence D'Oliveiro
In message <[EMAIL PROTECTED]>, Support Desk wrote: > Thanks for the reply ... A: The vulture doesn't get Frequent Poster miles. Q: What's the difference between a top-poster and a vulture? -- http://mail.python.org/mailman/listinfo/python-list

Re: Not fully OO ?

2008-09-25 Thread Lawrence D'Oliveiro
In message <[EMAIL PROTECTED]>, Craig Allen wrote: > It is clearly possible to write procedural code... that is, > Python does not force object oriented syntax or concepts on you ... Object orientation IS procedural. -- http://mail.python.org/mailman/listinfo/python-list

Re: Not fully OO ?

2008-09-25 Thread Lawrence D'Oliveiro
In message <[EMAIL PROTECTED]>, candide wrote: > "... Python supports OOP and classes to an extent, but is not a full OOP > language." Python allows you to use OO-style constructs, but doesn't force you to have inheritance and subclasses if you don't want to. Duck typing is usually a much more fl

Re: Not fully OO ?

2008-09-26 Thread Lawrence D'Oliveiro
In message <[EMAIL PROTECTED]>, Aaron "Castironpi" Brady wrote: > Wikipedia puts it decently: "mainly for OO programming, but with some > procedural elements." "Procedural" is the opposite of "functional", not "object-oriented". -- http://mail.python.org/mailman/listinfo/python-list

Re: Time.sleep(0.0125) not available within Linux

2008-09-26 Thread Lawrence D'Oliveiro
In message <[EMAIL PROTECTED]>, Steven D'Aprano wrote: > On Wed, 24 Sep 2008 22:18:05 +1200, Lawrence D'Oliveiro wrote: > >> Just a thought, your minimum sleep time is probably limited by the >> resolution of the system "HZ" clock. Type >> >&

Re: [Tkinter] how to keep a window above all other OS windows?

2008-09-26 Thread Lawrence D'Oliveiro
In message <[EMAIL PROTECTED]>, Dennis Lee Bieber wrote: > {I miss the Amiga -- > where one had the option to push a window to the back /without/ losing > focus... made it useful for reading one window while touch-typing data > into the "hidden" window} This sort of thing should be configurable i

Re: Time.sleep(0.0125) not available within Linux

2008-09-26 Thread Lawrence D'Oliveiro
In message <[EMAIL PROTECTED]>, Steven D'Aprano wrote: > On Fri, 26 Sep 2008 19:46:10 +1200, Lawrence D'Oliveiro wrote: > >> In message <[EMAIL PROTECTED]>, Steven D'Aprano >> wrote: >> >>> On Wed, 24 Sep 2008 22:18:05 +1200, Lawre

Re: Time.sleep(0.0125) not available within Linux

2008-09-26 Thread Lawrence D'Oliveiro
In message <[EMAIL PROTECTED]>, Grant Edwards wrote: > Never assume somebody reading the article and attempting to > help you can see the subject line. Why not? -- http://mail.python.org/mailman/listinfo/python-list

Re: Time.sleep(0.0125) not available within Linux

2008-09-26 Thread Lawrence D'Oliveiro
In message <[EMAIL PROTECTED]>, Grant Edwards wrote: > On 2008-09-26, Lawrence D'Oliveiro <[EMAIL PROTECTED]> > wrote: >> In message <[EMAIL PROTECTED]>, Grant Edwards >> wrote: >> >>> Never assume somebody reading the article and attempting

Re: str() should convert ANY object to a string without EXCEPTIONS !

2008-09-27 Thread Lawrence D'Oliveiro
In message <[EMAIL PROTECTED]>, est wrote: > The problem is, why the f**k set ASCII encoding to range(128) Because that's how ASCII is defined. > while str() is internally byte array it should be handled in > range(256) !! But that's for random bytes. How would you convert an a

Re: Not fully OO ?

2008-09-27 Thread Lawrence D'Oliveiro
In message <[EMAIL PROTECTED]>, James Mills wrote: > On Fri, Sep 26, 2008 at 8:20 AM, Lawrence D'Oliveiro > <[EMAIL PROTECTED]> wrote: > >> Object orientation IS procedural. > > Correction: OOP is Imperative. No, "procedural". The functional unit

Re: Not fully OO ?

2008-09-27 Thread Lawrence D'Oliveiro
In message <[EMAIL PROTECTED]>, Aaron "Castironpi" Brady wrote: > I understand that formal proof systems, as well as automated > theorem provers, have been difficult to develop. The basic problem is: having proved that a program satisfies certain formally-specified criteria, how do you prove that

Re: str() should convert ANY object to a string without EXCEPTIONS !

2008-09-28 Thread Lawrence D'Oliveiro
In message <[EMAIL PROTECTED]>, est wrote: > Well, you succeseded in putting all blame to myself alone. Great. Take it as a hint. > When you guy's are dealing with CJK characters in the future, you'll > find out what I mean. Speaking as somebody who HAS dealt with CJK characters in the past--se

Re: Web programming in Python.

2008-09-28 Thread Lawrence D'Oliveiro
In message <[EMAIL PROTECTED]>, Sean DiZazzo wrote: > Have you loaded the modpython module in your httpd.conf? Not relevant for CGIs. -- http://mail.python.org/mailman/listinfo/python-list

Re: closures and dynamic binding

2008-09-28 Thread Lawrence D'Oliveiro
In message <[EMAIL PROTECTED]>, Aaron "Castironpi" Brady wrote: > [Wikipedia] says: > "dynamic scoping can be dangerous and almost no modern languages use > it", but it sounded like that was what closures use. Closures will use whatever the language says they use. LISP used dynamic binding, but t

Re: how to make smtplib.SMTP('localhost') work on window xp

2008-09-28 Thread Lawrence D'Oliveiro
In message <[EMAIL PROTECTED]>, zxo102 wrote: > SMTPServerDisconnected: Connection unexpectedly closed Does the SMTP server on localhost mention anything about the connection attempt in its log? If you telnet/netcat to port 25 on localhost, does anything interesting happen? -- http://mail.python

Re: Python is slow?

2008-09-29 Thread Lawrence D'Oliveiro
In message <[EMAIL PROTECTED]>, sturlamolden wrote: > ... and possibility of interfacing with gnuplot ... Gnuplot is non-Free software. -- http://mail.python.org/mailman/listinfo/python-list

Re: how to replace and string in a "SELECT ... IN ()"

2008-09-29 Thread Lawrence D'Oliveiro
In message <[EMAIL PROTECTED]>, D'Arcy J.M. Cain wrote: > On Fri, 26 Sep 2008 11:00:59 -0500 > "Michael Mabin" <[EMAIL PROTECTED]> wrote: > >> So we can drop a table in an in clause? How is this a use case. >> Cartoons are funny but actual proof that this example using an in-clause >> provides a

Re: how to search multiple textfiles ? (Python is slow ?)

2008-09-29 Thread Lawrence D'Oliveiro
In message <[EMAIL PROTECTED]>, Stef Mientki wrote: > - Pyscripter 110 sec ( PyScripter is the default IDE I use now) > - Delphi 20 .. 35 sec > - Findstr 4 sec What order did you try try them in? Did you try each one more than once, in different orders? Just to rule out filesystem caching effec

Re: how to search multiple textfiles ?

2008-09-29 Thread Lawrence D'Oliveiro
In message <[EMAIL PROTECTED]>, George Sakkis wrote: > $ find -name "*py" | xargs egrep "\bword\b" Better: find -name '*.py' -exec grep -E "\bword\b" {} \; -- http://mail.python.org/mailman/listinfo/python-list

Re: Python style: exceptions vs. sys.exit()

2008-09-29 Thread Lawrence D'Oliveiro
In message <[EMAIL PROTECTED]>, Ross Ridge wrote: > You need either use trial and error to find out, or look at the source. So what's wrong with using the source as documentation? :) -- http://mail.python.org/mailman/listinfo/python-list

Re: Python style: exceptions vs. sys.exit()

2008-09-29 Thread Lawrence D'Oliveiro
In message <[EMAIL PROTECTED]>, Steven D'Aprano wrote: > (1) It's not always available. But we're talking about Python libraries here, right? > (2) Even when the source is available, it is sometimes a legal trap to > read it with respect to patents and copyright. That's not how patents work. --

Re: writing dll in python?

2008-09-29 Thread Lawrence D'Oliveiro
In message <[EMAIL PROTECTED]>, nishalrs wrote: > Should I write all the functions as simple python scripts? Or is there > some facility for creating a .dll like library, that could be more > suitable for what in intend to develop? Start with Python. -- http://mail.python.org/mailman/listinfo/pyt

Re: Python is slow?

2008-09-29 Thread Lawrence D'Oliveiro
In message <[EMAIL PROTECTED]>, r0g wrote: > You can only distribute modifications to gnuplot itself as > patches, but you can distribute it freely ... This must be some new definition of "freely" of which I'm unaware. -- http://mail.python.org/mailman/listinfo/python-list

Re: Python is slow?

2008-09-30 Thread Lawrence D'Oliveiro
In message <[EMAIL PROTECTED]>, r0g wrote: > Lawrence D'Oliveiro wrote: > >> In message <[EMAIL PROTECTED]>, r0g wrote: >> >>> You can only distribute modifications to gnuplot itself as >>> patches, but you can distribute it freely ... >>

Re: how to search multiple textfiles ? (Python is slow ?)

2008-10-01 Thread Lawrence D'Oliveiro
In message <[EMAIL PROTECTED]>, Stef Mientki wrote: > Lawrence D'Oliveiro wrote: > >> In message <[EMAIL PROTECTED]>, Stef >> Mientki wrote: >> >>> I'm really amazed by the speed of Python !! >>> It can only be beaten by findstr,

Re: One class per file?

2008-10-01 Thread Lawrence D'Oliveiro
In message <[EMAIL PROTECTED]>, HCB wrote: > The book "Code Complete" recommends that you put only one class in a > source file ... That would only apply to languages like C with no namespace control. -- http://mail.python.org/mailman/listinfo/python-list

Re: Odd Errors

2008-10-01 Thread Lawrence D'Oliveiro
In message <[EMAIL PROTECTED]>, Aaron "Castironpi" Brady wrote: > Do you ever want to scream from the rooftops, "'append' operates by > side-effect!"? No. It's an effect, not a side-effect. -- http://mail.python.org/mailman/listinfo/python-list

Re: Odd Errors

2008-10-01 Thread Lawrence D'Oliveiro
In message <[EMAIL PROTECTED]>, Steven D'Aprano wrote: > On Wed, 01 Oct 2008 22:14:49 +1300, Lawrence D'Oliveiro wrote: > >> In message >> <[EMAIL PROTECTED]>, >> Aaron "Castironpi" Brady wrote: >> >>> Do you ever

docs.python.org inaccessible

2008-10-02 Thread Lawrence D'Oliveiro
Been getting 403 errors all afternoon. At one time I used to assiduously download PDF files of all the documentation I wanted to refer to. These days I've grown accustomed to just having a bunch of Web browser windows semi-permanently open. Until a rude shock like this happens to hit me. Maybe I

Re: using SSh problem!

2008-10-02 Thread Lawrence D'Oliveiro
In message <[EMAIL PROTECTED]>, sa6113 wrote: > I want to connect form a windows machine to a Linux one using SSH (I use > Paramiko) and simply copy a file to Linux machine. Do you want to be able to connect without having to enter a password? You'll need to set up a public/private key pair for t

Re: Odd Errors

2008-10-02 Thread Lawrence D'Oliveiro
In message <[EMAIL PROTECTED]>, Aaron "Castironpi" Brady wrote: > On Oct 2, 12:52 am, Lawrence D'Oliveiro <[EMAIL PROTECTED] > central.gen.new_zealand> wrote: > >> In message <[EMAIL PROTECTED]>, >> Steven >> >> D'Aprano wr

Re: docs.python.org inaccessible

2008-10-02 Thread Lawrence D'Oliveiro
In message <[EMAIL PROTECTED]>, Terry Reedy wrote: > Seems to be working now, at least if you start at the top with > http://docs.python.org/ Yeah, I can get into it, thanks. Now to get used to the new layout... -- http://mail.python.org/mailman/listinfo/python-list

Re: windows help files ?

2008-10-03 Thread Lawrence D'Oliveiro
In message <[EMAIL PROTECTED]>, Lie Ryan wrote: > ...python's docstring viewer has a less-like pager (or was it less) in > Linux ... It invokes whatever you define in $PAGER. -- http://mail.python.org/mailman/listinfo/python-list

Re: lint for Python?

2008-10-03 Thread Lawrence D'Oliveiro
In message <[EMAIL PROTECTED]>, Pat wrote: > In module one, I have a function: > > def foo( host, userid, password ): > pass > > In module two, I call that function: > > foo( userid, password) > > lint doesn't find that error and it won't be caught until it's called > while the program is

Re: Problem: neither urllib2.quote nor urllib.quote encode the unicode strings arguments

2008-10-03 Thread Lawrence D'Oliveiro
In message <[EMAIL PROTECTED]>, Valery Khamenya wrote: > things like urllib.quote(u"пиво Müller ") fail with error message: > : u'\u043f' Did you try encoding it as UTF-8 first? -- http://mail.python.org/mailman/listinfo/python-list

Re: del and sets proposal

2008-10-05 Thread Lawrence D'Oliveiro
In message <[EMAIL PROTECTED]>, Steven D'Aprano wrote: > Would it really be "confusing" if sets used the same interface as dicts > use? I don't think so. What else could "del aset[x]" mean other than > "delete element x"? Yes, but "x" in what sense? In dicts it's a key, in sets, shouldn't it also

Re: Python 2.6, GUI not working on vista?

2008-10-05 Thread Lawrence D'Oliveiro
In message <[EMAIL PROTECTED]>, Michel Claveau - NoSpam SVP ; merci wrote: > Another way is to de-activate UAC. Please don't be stupid! -- http://mail.python.org/mailman/listinfo/python-list

Re: problem with sockets code

2008-10-05 Thread Lawrence D'Oliveiro
In message <[EMAIL PROTECTED]>, Daniel wrote: > while data: > ... > data = self.rfile.readline().strip() Interpreting a random string value as a Boolean is a bad idea. -- http://mail.python.org/mailman/listinfo/python-list

Re: sftp problem!

2008-10-05 Thread Lawrence D'Oliveiro
In message <[EMAIL PROTECTED]>, sa6113 wrote: > host = "LinuxComputerName" (or its Ip) > port = 22 > > and after runing this code I get this error: > socket.error: (10061, 'Connection refused') Did you try sftp LinuxComputerName just to confirm it's got a listener on port 22? -- http://mai

Re: code critique requested - just 60 lines

2008-10-05 Thread Lawrence D'Oliveiro
In message <[EMAIL PROTECTED]>, Terrence Brannon wrote: > On Oct 2, 11:56 am, [EMAIL PROTECTED] wrote: > >> Terrence Brannon, I suggest you to shorten a lot some of those very >> long lines. > > yes, I wanted to, but was not sure how to continue a line on the next > line in Python. Did you check

Re: del and sets proposal

2008-10-05 Thread Lawrence D'Oliveiro
In message <[EMAIL PROTECTED]>, Steven D'Aprano wrote: > On Sun, 05 Oct 2008 22:11:38 +1300, Lawrence D'Oliveiro wrote: > >> In message <[EMAIL PROTECTED]>, Steven D'Aprano >> wrote: >> >>> Would it really be "confusing" if

<    3   4   5   6   7   8   9   10   11   12   >