Re: Striving for PEP-8 compliance

2010-04-10 Thread Lawrence D'Oliveiro
In message 18988a53-e88f-4abf- a83a-314b16653...@x12g2000yqx.googlegroups.com, Patrick Maupin wrote: I want nothing to do with any programmer who would mis-indent their code. But what happens when you’re trying to reconcile two different indentation conventions? In Python, there can be

Re: Striving for PEP-8 compliance

2010-04-10 Thread Lawrence D'Oliveiro
In message hpokef$gv...@reader1.panix.com, Grant Edwards wrote: On 2010-04-10, Lawrence D'Oliveiro l...@geek-central.gen.new_zealand wrote: In message hpoh5j$35...@reader1.panix.com, Grant Edwards wrote: Anybody who invents another brace-delimited language should be beaten. You always end

Re: Striving for PEP-8 compliance

2010-04-09 Thread Lawrence D'Oliveiro
In message 4bbf6eb8$0$1670$742ec...@news.sonic.net, John Nagle wrote: Lawrence D'Oliveiro wrote: In message mailman.1610.1270655932.23598.python-l...@python.org, Gabriel Genellina wrote: If you only reindent the code (without adding/removing lines) then you can compare the compiled .pyc

Re: Striving for PEP-8 compliance

2010-04-09 Thread Lawrence D'Oliveiro
In message hpoh5j$35...@reader1.panix.com, Grant Edwards wrote: Anybody who invents another brace-delimited language should be beaten. You always end up with a big problem trying to make sure the braces are consistent with the program logic. Would you prefer “begin” and “end” word symbols,

Re: Striving for PEP-8 compliance

2010-04-07 Thread Lawrence D'Oliveiro
In message mailman.1599.1270652040.23598.python-l...@python.org, Tom Evans wrote: I've written a bunch of internal libraries for my company, and they all use two space indents, and I'd like to be more consistent and conform to PEP-8 as much as I can. “A foolish consistency is the hobgoblin

Re: Striving for PEP-8 compliance

2010-04-07 Thread Lawrence D'Oliveiro
In message mailman.1610.1270655932.23598.python-l...@python.org, Gabriel Genellina wrote: If you only reindent the code (without adding/removing lines) then you can compare the compiled .pyc files (excluding the first 8 bytes that contain a magic number and the source file timestamp).

Re: Getting Local MAC Address

2010-04-06 Thread Lawrence D'Oliveiro
In message ec6d247c-a6b0-4f33-a36b-1d33eace6...@k19g2000yqn.googlegroups.com, Booter wrote: I am new to python ans was wondering if there was a way to get the mac address from the local NIC? What if you have more than one? -- http://mail.python.org/mailman/listinfo/python-list

Re: (a==b) ? 'Yes' : 'No'

2010-04-03 Thread Lawrence D'Oliveiro
In message mailman.1345.1269992641.23598.python-l...@python.org, Steve Holden wrote: Lawrence D'Oliveiro wrote: By the way, you don’t need the parentheses. But at the same time, if you don't *absolutely know* you don't need the parentheses ... But you can “abolutely know”—it’s all

Re: Encryption source code with md5

2010-04-03 Thread Lawrence D'Oliveiro
In message 4baf3ac4$0$22903$e4fe5...@news.xs4all.nl, Irmen de Jong wrote: On 28-3-2010 12:08, Lawrence D'Oliveiro wrote: Don’t use MD5. Also, md5 is not an encryption algorithm at all, it is a secure hashing function. You can use hash functions for encryption. -- http://mail.python.org

Re: (a==b) ? 'Yes' : 'No'

2010-03-30 Thread Lawrence D'Oliveiro
In message 7316f3d2-bcc9-4a1a-8598- cdd5d41fd...@k17g2000yqb.googlegroups.com, Joaquin Abian wrote: (a==b) and 'YES' or 'NO' Yes, ugly Why would you say that’s ugly? By the way, you don’t need the parentheses. -- http://mail.python.org/mailman/listinfo/python-list

Re: Usability, the Soul of Python

2010-03-30 Thread Lawrence D'Oliveiro
In message 20100331003241.47fa9...@vulcan.local, Robert Fendt wrote: The braces are gone, and with them the holy wars. Let me start a new one. I would still put in some kind of explicit indicator of the end of the grouping construct: count = 99 while count 0: print u'%d slabs

Re: Usability, the Soul of Python

2010-03-30 Thread Lawrence D'Oliveiro
In message hosnrh$6n...@news.eternal-september.org, Alf P. Steinbach wrote: This is just unsubstantiated opinion, but worse, it makes a tacit assumption that there is best way to do indentation. However, most programmers fall into that trap, and I've done it myself. Having used so many

Re: Encryption source code with md5

2010-03-28 Thread Lawrence D'Oliveiro
In message 91541c26-6f18-40c7- a0df-252a52bb7...@l25g2000yqd.googlegroups.com, catalinf...@gmail.com wrote: It is possible to encrypt with md5 python source code? Don’t use MD5. What option do I have to protect my python source code? Copyright. --

Re: sqlite version on windows

2010-03-26 Thread Lawrence D'Oliveiro
In message mailman.1215.1269608278.23598.python-l...@python.org, Philip Semanchuk wrote: On Mar 26, 2010, at 5:57 AM, Laszlo Nagy wrote: On my Linux system: Python version: 2.6.2 sqlite3.sqlite_version: 3.6.10 On my Windows system: Python version: 2.6.5 sqlite3.sqlite_version: 3.5.9 Why

Re: GIF89A and PIL

2010-03-26 Thread Lawrence D'Oliveiro
In message 2010032618455468300-aptshan...@gmailinvalid, Stephen Hansen wrote: Is it possible to get PIL to save GIF's in GIF89A format, instead of GIF87A? Why? What does GIF do for you that PNG doesn’t? -- http://mail.python.org/mailman/listinfo/python-list

Re: Sniffing encoding type by looking at file BOM header

2010-03-25 Thread Lawrence D'Oliveiro
In message mailman.1139.1269442366.23598.python-l...@python.org, pyt...@bdurham.com wrote: BOM_UTF8 = '\xef\xbb\xbf' Since when does UTF-8 need a BOM? -- http://mail.python.org/mailman/listinfo/python-list

Re: What is pkg-config for ?

2010-03-22 Thread Lawrence D'Oliveiro
In message mailman.987.1269033144.23598.python-l...@python.org, Gabriel Genellina wrote: I fail to see how is this relevant to Python... Well, so many of the questions in this noisegroup seem to be about Windows problems, not Python ones... :) --

Re: GC is very expensive: am I doing something wrong?

2010-03-21 Thread Lawrence D'Oliveiro
In message mailman.963.1268958842.23598.python-l...@python.org, Terry Reedy wrote: No one has discovered a setting of the internal tuning parameters for which there are no bad patterns and I suspect there are not any such. This does not negate Xavier's suggestion that a code change might

Re: import antigravity

2010-03-18 Thread Lawrence D'Oliveiro
In message mailman.820.1268725930.23598.python-l...@python.org, Chris Rebert wrote: I see that you published my unobfuscated e-mail address on USENET for all to see. I obfuscated it for a reason, to keep the spammers away. I'm assuming this was a momentary lapse of judgement, for which I expect

import antigravity

2010-03-16 Thread Lawrence D'Oliveiro
Subtle... -- http://mail.python.org/mailman/listinfo/python-list

Re: Reverse engineering CRC?

2010-03-11 Thread Lawrence D'Oliveiro
In message mailman.452.1268043207.23598.python-l...@python.org, Dave Angel wrote: However, if there's anything in there about how to derive the polynomial algorithm from (a few) samples I missed it entirely. Given that CRC is all just a sequence of xor operations, what happens if you xor

Re: Reverse engineering CRC?

2010-03-11 Thread Lawrence D'Oliveiro
In message 7vlamef7g...@mid.individual.net, Gregory Ewing wrote: I'm going by the fact that the application reports a CRC mismatch when it's wrong. I can't be sure that what it calls a CRC is really a true CRC, but it's more than a simple sum, because changing one bit in the file results in

Re: Knight's tour Warndorff's algorithm problem

2010-03-10 Thread Lawrence D'Oliveiro
In message mailman.527.1268199449.23598.python-l...@python.org, Gabriel Genellina wrote: Warnsdorff's algorithm is heuristic ... Then it shouldn’t be called an “algorithm”. -- http://mail.python.org/mailman/listinfo/python-list

Re: Draft PEP on RSON configuration file format

2010-03-10 Thread Lawrence D'Oliveiro
In message 4b8b5cef$0$1625$742ec...@news.sonic.net, John Nagle wrote: Patrick Maupin wrote: Finding .ini configuration files too limiting, JSON and XML to hard to manually edit, and YAML too complex to parse quickly, I have started work on a new configuration file parser. You're not

Re: Passing FILE * types using ctypes

2010-03-10 Thread Lawrence D'Oliveiro
In message 7vbrvefeg...@mid.individual.net, Gregory Ewing wrote: If you need the same FILE * that Python is using, you may need to use ctypes to extract it out of the file object. Why would Python be using a FILE *? -- http://mail.python.org/mailman/listinfo/python-list

Re: Passing FILE * types using ctypes

2010-03-10 Thread Lawrence D'Oliveiro
In message a83319d7-c199-4532-9816- d002f7fd7...@q16g2000yqq.googlegroups.com, Zeeshan Quireshi wrote: Hello, I'm using ctypes to wrap a library i wrote. I am trying to pass it a FILE *pointer ... Another option is to fix your library not to use stdio directly. --

Re: Executable problem - socket?

2010-02-26 Thread Lawrence D'Oliveiro
In message hm4o2o$9i...@speranza.aioe.org, Gib Bogle wrote: The only clue is that the machines that her program runs on have Python installed, while the one that fails doesn't. Wouldn’t it be a whole lot simpler to install Python on the bloody machine? --

Re: Quoting quotes

2010-02-26 Thread Lawrence D'Oliveiro
In message bda4748c-49ec-4383-81c1-7baaae567...@l19g2000yqb.googlegroups.com, William Lohrmann wrote: The best thing would be to backslash the single quote: print 'The play All\'s Well That Ends Well' Backslash-type escapes are the most general solution to this type of problem. They’re also

Re: When will Java go mainstream like Python?

2010-02-24 Thread Lawrence D'Oliveiro
In message op.u8nfpex8y5e...@laptopwanja, Wanja Gayk wrote: Reference counting is about the worst technique for garbage collection. It avoids the need for garbage collection. It means I can write things like contents = open(filename, r).read() and know the file object will be immediately

Re: Writing an assembler in Python

2010-02-23 Thread Lawrence D'Oliveiro
In message da970fce-bd6b-4eb3-bb66-3ca52cc0f...@k5g2000pra.googlegroups.com, Anh Hai Trinh wrote: On Feb 23, 10:08 am, Lawrence D'Oliveiro l...@geek-central.gen.new_zealand wrote: Let me suggest an alternative approach: use Python itself as the assembler. Call routines in your library

Re: Is this secure?

2010-02-23 Thread Lawrence D'Oliveiro
In message mailman.110.1266935711.4577.python-l...@python.org, mk wrote: I need to generate passwords and I think that pseudo-random generator is not good enough, frankly. So I wrote this function: Much simpler: import subprocess data, _ = subprocess.Popen \ ( args = (pwgen, -nc),

Re: When will Java go mainstream like Python?

2010-02-23 Thread Lawrence D'Oliveiro
In message hm0r5n$1a...@news.eternal-september.org, Martin P. Hellwig wrote: Actually I am still waiting for Java to be mainstream :-) Too late, I think. Sun dilly-dallied over making it open source for too long, until it practically didn’t matter any more. --

Re: When will Java go mainstream like Python?

2010-02-23 Thread Lawrence D'Oliveiro
In message mailman.99.1266915651.4577.python-l...@python.org, Ishwor Gurung wrote: Java - The JVM code been hacked to death by Sun engineers (optimised) Python - The PVM code has seen speed-ups in Unladen or via Pyrex.. ad-infinitum but nowhere as near to JVM Python is still faster, though.

Re: look at the google code

2010-02-23 Thread Lawrence D'Oliveiro
In message 711cb713-4b4a-47f6-8922-ce1ada7d6...@e1g2000yqh.googlegroups.com, lkcl wrote: we couldn't get control of that site for quite some time so started using sourceforget for svn, but the issue tracker on sourceforget is truly dreadful. Damn. I’ve been working on my own fork

Re: formatting a number as percentage

2010-02-23 Thread Lawrence D'Oliveiro
In message 6819f2f8-7a9e-4ea4-a936-c4e00394b...@g28g2000yqh.googlegroups.com, vsoler wrote: I'm trying to print .7 as 70% Just to be perverse: (lambda x : (lambda s : s[:s.index(.)] + s[s.index(.) + 1:] + %)(%.2f % x).lstrip(0))(.7) :) --

Re: Is this secure?

2010-02-23 Thread Lawrence D'Oliveiro
In message 7xwry39tpi@ruckus.brouhaha.com, Paul Rubin wrote: More generally still, passwords regardless of their entropy content are a sucky way to encapsulate cryptographic secrets. They’re a shared secret. How else would you represent a shared secret, if not with a shared secret? --

Re: Interesting talk on Python vs. Ruby and how he would like Python to have just a bit more syntactic flexibility.

2010-02-22 Thread Lawrence D'Oliveiro
In message 1ecc71bf-54ab-45e6-a38a-d1861f092...@v25g2000yqk.googlegroups.com, sjdevn...@yahoo.com wrote: On Feb 20, 1:30 am, Lawrence D'Oliveiro l...@geek-central.gen.new_zealand wrote: In message op.u8at0suda8n...@gnudebst, Rhodri James wrote: In classic Pascal, a procedure was distinct

Re: What's Going on between Python and win7?

2010-02-22 Thread Lawrence D'Oliveiro
In message mailman.60.1266854492.4577.python-l...@python.org, MRAB wrote: Not Python-related. Seems to be pretty common with Windows-related complaints in this group. -- http://mail.python.org/mailman/listinfo/python-list

Re: What's Going on between Python and win7?

2010-02-22 Thread Lawrence D'Oliveiro
In message 873a0tszco@castleamber.com, John Bokma wrote: According to http://msdn.microsoft.com/en-us/library/aa365006(VS.85).aspx There are three types of file links supported in the NTFS file system: hard links, junctions, and symbolic links. This topic is an overview of

Re: Writing an assembler in Python

2010-02-22 Thread Lawrence D'Oliveiro
In message xns9d28186af890cfdnbgui7uhu5h8hrn...@127.0.0.1, Giorgos Tzampanakis wrote: I'm implementing a CPU that will run on an FPGA. I want to have a (dead) simple assembler that will generate the machine code for me. Let me suggest an alternative approach: use Python itself as the

Re: Interesting talk on Python vs. Ruby and how he would like Python to have just a bit more syntactic flexibility.

2010-02-22 Thread Lawrence D'Oliveiro
In message 3aa0205f-1e98-4376-92e4-607f96f13...@k19g2000yqc.googlegroups.com, Michael Sparks wrote: [1] This is perhaps more appropriate because '(a b c) is equivalent to (quote a b c), and quote a b c can be viewed as close to python's expression lambda: a b c You got to be

Re: Interesting talk on Python vs. Ruby and how he would like Python to have just a bit more syntactic flexibility.

2010-02-19 Thread Lawrence D'Oliveiro
In message 87eikjcuzk@benfinney.id.au, Ben Finney wrote: Lawrence D'Oliveiro l...@geek-central.gen.new_zealand writes: In message hlhdsi$2p...@theodyn.ncf.ca, cjw wrote: Aren't lambda forms better described as function? Is this a function? lambda : None What about

Re: Interesting talk on Python vs. Ruby and how he would like Python to have just a bit more syntactic flexibility.

2010-02-19 Thread Lawrence D'Oliveiro
In message 84166541-c10a-47b5-ae5b- b23202624...@q2g2000pre.googlegroups.com, Steve Howell wrote: Some people make the definition of function more restrictive--if it has side effects, it is not a function. Does changing the contents of CPU cache count as a side-effect? --

Re: Interesting talk on Python vs. Ruby and how he would like Python to have just a bit more syntactic flexibility.

2010-02-19 Thread Lawrence D'Oliveiro
In message op.u8at0suda8n...@gnudebst, Rhodri James wrote: In classic Pascal, a procedure was distinct from a function in that it had no return value. The concept doesn't really apply in Python; there are no procedures in that sense, since if a function terminates without supplying an

Re: Interesting talk on Python vs. Ruby and how he would like Python to have just a bit more syntactic flexibility.

2010-02-17 Thread Lawrence D'Oliveiro
In message 60b1abce-4381-46ab-91ed- f2ab2154c...@g19g2000yqe.googlegroups.com, Andrej Mitrovic wrote: Also, lambda's are expressions, not statements ... Is such a distinction Pythonic, or not? For example, does Python distinguish between functions and procedures? --

Re: Interesting talk on Python vs. Ruby and how he would like Python to have just a bit more syntactic flexibility.

2010-02-17 Thread Lawrence D'Oliveiro
In message 8ca440b2-6094-4b35-80c5-81d000517...@v20g2000prb.googlegroups.com, Jonathan Gardner wrote: I used to think anonymous functions (AKA blocks, etc...) would be a nice feature for Python. Then I looked at a stack trace from a different programming language with lots of anonymous

Re: Interesting talk on Python vs. Ruby and how he would like Python to have just a bit more syntactic flexibility.

2010-02-17 Thread Lawrence D'Oliveiro
In message hlhdsi$2p...@theodyn.ncf.ca, cjw wrote: Aren't lambda forms better described as function? Is this a function? lambda : None What about this? lambda : sys.stdout.write(hi there!\n) -- http://mail.python.org/mailman/listinfo/python-list

Re: Few Small Questions Regarding CGI

2010-02-16 Thread Lawrence D'Oliveiro
In message 631b0785-38db-4c12- a82a-7b11e2235...@o16g2000prh.googlegroups.com, joy99 wrote: Is there any other material or URL for step by step learning of CGI. There’s the official spec here http://hoohoo.ncsa.illinois.edu/cgi/interface.html. --

Re: intolerant HTML parser

2010-02-10 Thread Lawrence D'Oliveiro
In message 4b712919$0$6584$9b4e6...@newsspool3.arcor-online.net, Stefan Behnel wrote: Usually PyPI. Where do you think these tools come from? They don’t write themselves, you know. -- http://mail.python.org/mailman/listinfo/python-list

Re: The Case For Do-Once

2010-02-09 Thread Lawrence D'Oliveiro
In message hkoje5$4n...@lust.ihug.co.nz, Lawrence D'Oliveiro wrote: The basic control flow is this: * Unconditionally initialize all dynamic storage to nil * Do the main body of the code, aborting in any error * Regardless of success or failure of the above, dispose of all

The Case For Do-Once

2010-02-08 Thread Lawrence D'Oliveiro
I wrote my first Python extension library over the last couple of weeks. I took note of all the recommendations to keep track of reference counts, to ensure that objects were not disposed when they shouldn’t be, and were when they should. However, the example code seems to use gotos. And the

Re: intolerant HTML parser

2010-02-08 Thread Lawrence D'Oliveiro
In message 4b6fd672$0$6734$9b4e6...@newsspool2.arcor-online.net, Stefan Behnel wrote: Jim, 06.02.2010 20:09: I generate some HTML and I want to include in my unit tests a check for syntax. So I am looking for a program that will complain at any syntax irregularities. First thing to note

Re: ctypes Structure serialization

2010-02-08 Thread Lawrence D'Oliveiro
In message 615b1271-a9b0-4558-8e45- e4370698d...@a16g2000pre.googlegroups.com, rych wrote: I'm not quite familiar with python serialization but the picle module, at least, doesn't seem to be able to serialize a ctypes Structure with array-fields. Remember that a ctypes structure is supposed

Re: DST and datetime

2010-01-03 Thread Lawrence D'Oliveiro
In message 874on82oan@benfinney.id.au, Ben Finney wrote: Or you could use the ready-made wheel maintained by others: tzinfo Objects URL:http://docs.python.org/library/datetime.html#tzinfo-objects But that’s only an abstract base class, which means it doesn’t actually implement

Re: Safe file I/O to shared file (or SQLite) from multi-threaded web server

2010-01-03 Thread Lawrence D'Oliveiro
In message mailman.367.1262529266.28905.python-l...@python.org, Steve Holden wrote: Yes, but not to MySQL, please. Particularly since there is a sword of Damocles hanging over its head while the Oracle takeover of Sun is pending. Ah, I see the FUDsters are crawling out of the woodwork here,

XDG Base Directory Specification

2009-12-27 Thread Lawrence D'Oliveiro
The XDG Base Directory Specification http://standards.freedesktop.org/basedir-spec/latest/ seems like the best idea anyone’s come up with so far to end the dotfile clutter in everyone’s home directories. But it needs application software to support it. I’ve put together a very simple library

Intro To Python Using Turtle Graphics

2009-11-30 Thread Lawrence D'Oliveiro
Done by Northland Polytechnic, available for download under CC-BY-NC-ND here http://www.archive.org/details/IntroductionToPythonUsingTurtleGraphics. Thanks to Colin Jackson for the link. -- http://mail.python.org/mailman/listinfo/python-list

Is It A Directory

2009-11-28 Thread Lawrence D'Oliveiro
When doing recursive directory traversal, sometimes you want to follow symlinks that point at other directories, and sometimes you don’t. Here’s a routine that you can use to check whether a path specifies a directory, with the option to treat a symlink to a directory as a directory, or not:

Re: Python OpenOffice Spreadsheets

2009-11-27 Thread Lawrence D'Oliveiro
In message 486869af-d89f-4261-b4c2- f45af5d3b...@e7g2000vbi.googlegroups.com, r wrote: I find the syntax far to[o] complicated than it should be. That’s because it was originally written for Java programmers. -- http://mail.python.org/mailman/listinfo/python-list

Re: Sqlite3. Substitution of names in query.

2009-11-03 Thread Lawrence D'Oliveiro
In message mailman.2504.1257216390.2807.python-l...@python.org, Carsten Haese wrote: With all due respect, but if your experience is exclusive to MySQL/MySQLdb, your experience means very little for database programming practices in general. I wonder about the veracity of your claims,

Re: Sqlite3. Substitution of names in query.

2009-11-02 Thread Lawrence D'Oliveiro
In message mailman.2442.1257115236.2807.python-l...@python.org, Carsten Haese wrote: Lawrence D'Oliveiro wrote: Says someone who hasn't realized where the real inefficiencies are. Remember what Tony Hoare told us: premature optimization is the root of all evil. These are databases we're

Re: Sqlite3. Substitution of names in query.

2009-11-02 Thread Lawrence D'Oliveiro
In message mailman.2416.1257062070.2807.python-l...@python.org, Dennis Lee Bieber wrote: On Sun, 01 Nov 2009 19:08 +1300, Lawrence D'Oliveiro l...@geek-central.gen.new_zealand declaimed the following in gmane.comp.python.general: On the grounds that Python has more general and powerful

Re: Sqlite3. Substitution of names in query.

2009-11-02 Thread Lawrence D'Oliveiro
In message mailman.2489.1257197791.2807.python-l...@python.org, Robert Kern wrote: On 2009-11-02 14:47 PM, Lawrence D'Oliveiro wrote: For instance, I'm not aware of any database API that lets me do this: sql.cursor.execute \ ( update numbers set flags = flags

Re: Sqlite3. Substitution of names in query.

2009-11-02 Thread Lawrence D'Oliveiro
In message mailman.2509.1257229930.2807.python-l...@python.org, Dennis Lee Bieber wrote: On Tue, 03 Nov 2009 09:41:10 +1300, Lawrence D'Oliveiro l...@geek-central.gen.new_zealand declaimed the following in gmane.comp.python.general: There is no such parsing overhead. I speak from

Re: Sqlite3. Substitution of names in query.

2009-11-01 Thread Lawrence D'Oliveiro
In message mailman.2397.1257034364.2807.python-l...@python.org, Carsten Haese wrote: Lawrence D'Oliveiro wrote: In message mailman.2376.1257005738.2807.python-l...@python.org, Carsten Haese wrote: Lawrence D'Oliveiro wrote: In message mailman.2357.1256964121.2807.python-l...@python.org

Re: Sqlite3. Substitution of names in query.

2009-11-01 Thread Lawrence D'Oliveiro
In message mailman.2418.1257062992.2807.python-l...@python.org, Carsten Haese wrote: Lawrence D'Oliveiro wrote: In message mailman.2397.1257034364.2807.python-l...@python.org, Carsten Haese wrote: On what grounds are you asserting that it's not necessary to mix the two? Please elaborate

Re: Sqlite3. Substitution of names in query.

2009-10-31 Thread Lawrence D'Oliveiro
In message mailman.2357.1256964121.2807.python-l...@python.org, Dennis Lee Bieber wrote: This way regular string interpolation operations (or whatever Python 3.x has replaced it with) are safe to construct the SQL, leaving only user supplied (or program generated) data values to be passed via

Re: Are *.pyd's universal?

2009-10-31 Thread Lawrence D'Oliveiro
In message 6e603d9c-2be0-449c-9c3c- bab49e09e...@13g2000prl.googlegroups.com, Carl Banks wrote: It's not Python that's the issue. The issue is that if you have a module with a .dll extension, other programs could accidentally try to load that module instead of the intended dll, if the module

Re: Are *.pyd's universal?

2009-10-31 Thread Lawrence D'Oliveiro
In message mailman.2365.1256979069.2807.python-l...@python.org, Albert Hopkins wrote: On Sat, 2009-10-31 at 21:32 +1300, Lawrence D'Oliveiro wrote: In message 6e603d9c-2be0-449c-9c3c-bab49e09e...@13g2000prl.googlegroups.com, Carl Banks wrote: Modules will sometimes find themselves

Re: Sqlite3. Substitution of names in query.

2009-10-31 Thread Lawrence D'Oliveiro
In message mailman.2376.1257005738.2807.python-l...@python.org, Carsten Haese wrote: Lawrence D'Oliveiro wrote: In message mailman.2357.1256964121.2807.python-l...@python.org, Dennis Lee Bieber wrote: This way regular string interpolation operations (or whatever Python 3.x has replaced

Re: Are *.pyd's universal?

2009-10-29 Thread Lawrence D'Oliveiro
In message mailman.2268.1256841007.2807.python-l...@python.org, Christian Heimes wrote: On Linux and several other Unices the suffix is .so and not .pyd. Why is that? Or conversely, why isn't it .dll under Windows? -- http://mail.python.org/mailman/listinfo/python-list

Re: Are *.pyd's universal?

2009-10-29 Thread Lawrence D'Oliveiro
In message mailman.2297.1256863331.2807.python-l...@python.org, Christian Heimes wrote: Lawrence D'Oliveiro schrieb: In message mailman.2268.1256841007.2807.python-l...@python.org, Christian Heimes wrote: On Linux and several other Unices the suffix is .so and not .pyd. Why

Re: anydbm, gdbm, dbm

2009-10-28 Thread Lawrence D'Oliveiro
In message b0ec6512-ac80-4372- bdb8-1a8a4e030...@r5g2000yqb.googlegroups.com, Lacrima wrote: I don't understand how I can make a table in DBM database, or a row in a table. Or all data must be stored just as key-value pairs? Maybe you should look at sqlite instead. --

Re: PSP problem showing images

2009-10-27 Thread Lawrence D'Oliveiro
In message mailman.2101.1256636602.2807.python-l...@python.org, Alfons Nonell-Canals wrote: I developed a script which generates some images (is a work about Chemistry) and returns a page with some results and these images. When I run the script from the web browser, all works fine: the

Re: best vi / emacs python features

2009-10-27 Thread Lawrence D'Oliveiro
In message mailman.985.1254933855.2807.python-l...@python.org, Jean-Michel Pichavant wrote: Being a vi fan, I can just tell you that emacs is for loosers, and no one will dare to challenge this. Is it better to be loose or tight? -- http://mail.python.org/mailman/listinfo/python-list

Re: SQL user function returning list for IN clause

2009-10-27 Thread Lawrence D'Oliveiro
In message c601fad6-8126-4f43- b768-62ad6e7ec...@r5g2000yqb.googlegroups.com, Felix wrote: I want to run a query like select * from table a, table b where a.foo IN foobar(b.bar) where foobar is a user function (registered by create_function in pysqlite3) returning a list of integers.

Re: lambda forms within a loop

2009-10-24 Thread Lawrence D'Oliveiro
In message mailman.1990.1256441598.2807.python-l...@python.org, Michal Ostrowski wrote: def MakeLambdaBad(): a = [] for x in [1,2]: a.append(lambda q: x + q) return a Here's another form that should work: def MakeLambdaGood2() : a = [] for x in [1, 2] :

Re: How to write a daemon program to monitor symbolic links?

2009-10-23 Thread Lawrence D'Oliveiro
In message mailman.1942.1256325954.2807.python-l...@python.org, Peng Yu wrote: As far as I know, linux doesn't support a system level way to figure out all the symbolic links point to a give file. Do you know of a system that does? I'm thinking of writing a daemon program which will build a

structread

2009-10-20 Thread Lawrence D'Oliveiro
This routine is so useful, I wonder there's nothing like it in module struct, or anywhere else I'm aware of: def structread(fromfile, decode_struct) : reads sufficient bytes from fromfile to be unpacked according to decode_struct, and returns the unpacked results.

Re: The rap against while True: loops

2009-10-20 Thread Lawrence D'Oliveiro
In message haqq0p$7f...@reader1.panix.com, kj wrote: I use while True-loops often, and intend to continue doing this while True ... My practice with regard to loops is to use constructs such as while (condition) { ... } and do ... while (condition) where condition is the ONLY terminating

Re: Best Way to Handle All Exceptions

2009-07-14 Thread Lawrence D'Oliveiro
In message 93f6a517-63d8-4c80- bf19-4614b7099...@m7g2000prd.googlegroups.com, Carl Banks wrote: Or would you rather let all unexpected exceptions print to standard error, which is often a black hole in non-interactive sitations? Since when? Cron, for example, collects standard error and mails

Re: Best Way to Handle All Exceptions

2009-07-14 Thread Lawrence D'Oliveiro
In message d82cea0b-3327-4a27- b300-08975f7c0...@p28g2000vbn.googlegroups.com, seldan24 wrote: For this particular script, all exceptions are fatal and I would want them to be. I just wanted a way to catch them and log them prior to program termination. You don't need to. They will be

Re: The meaning of = (Was: tough-to-explain Python)

2009-07-14 Thread Lawrence D'Oliveiro
In message pan.2009.07.14.03.45...@remove.this.cybersource.com.au, Steven D'Aprano wrote: Are we supposed to interpret that post as Dumb Insolence or just Dumb? Insolence indeed ... another wanker to plonk, I think. -- http://mail.python.org/mailman/listinfo/python-list

Re: The meaning of = (Was: tough-to-explain Python)

2009-07-13 Thread Lawrence D'Oliveiro
In message h3bogf$oo...@panix3.panix.com, Aahz wrote: In article h3bagu$52...@lust.ihug.co.nz, Lawrence D'Oliveiro l...@geek-central.gen.new_zealand wrote: In message h37gv5$r8...@panix3.panix.com, Aahz wrote: It helps to remember that names and namespaces are in many ways syntactic sugar

Re: Infinite loops and synchronization

2009-07-13 Thread Lawrence D'Oliveiro
In message mailman.3048.1247462046.8015.python-l...@python.org, Vincent Gulinao wrote: Q1: is this a common OK practice? I'm worried infinite loops hogs memory. The problem is not that the loop is infinite, but that it busy-waits, hogging CPU. --

Re: MySQLdb + SSH Tunnel

2009-07-13 Thread Lawrence D'Oliveiro
In message mailman.3035.1247427709.8015.python-l...@python.org, Emile van Sebille wrote: ssh with something like... ssh -lroot -L3306:C:3306 B Watch out for other instances of mysql on A or B... You can use a non-default local port and specify that in your local connection parameters.

Re: Looking for a tool to checkfor python script backward compatibility

2009-07-13 Thread Lawrence D'Oliveiro
In message 4a59951a$0$10853$426a7...@news.free.fr, Baptiste Lepilleur wrote: I'm looking for a tool that could be used in a pre-commit step to check that only features available in a old python version are used, say python 2.3 for example. The only sure way would be to run the script under

Re: send keys to focused window

2009-07-13 Thread Lawrence D'Oliveiro
In message mpg.24c0392b71e8a0eb989...@news.bintube.com, Broken wrote: I am new to Python, and I'm miserably failing to send specific keys to (say) notepad. I don't understand why you need to automate a GUI front-end, meant for human use, to a function that can be directly performed without

Re: Check file is locked?

2009-07-13 Thread Lawrence D'Oliveiro
In message 652cca82-44a3-473f-b640- c2336a9cf...@v15g2000prn.googlegroups.com, Rajat wrote: ... my whole idea is to close the wordpad / notepad application so that I can delete the file and the directory where this file resides. Don't you think the user might have that application open for a

Re: A Bug By Any Other Name ...

2009-07-13 Thread Lawrence D'Oliveiro
In message 4a538a71$0$30236$9b4e6...@newsspool1.arcor-online.net, Stefan Behnel wrote: Lawrence D'Oliveiro wrote: I wonder how many people have been tripped up by the fact that ++n and --n fail silently for numeric-valued n. I doubt that there are many. Plus, you

Re: A Bug By Any Other Name ...

2009-07-13 Thread Lawrence D'Oliveiro
In message mailman.2787.1246986627.8015.python-l...@python.org, MRAB wrote: I wonder whether the problem with assignment in conditionals in C is due to the assignment operator being =. If it was :=, would the error still occur? One of the original C designers, Kernighan or Ritchie, admitted

Re: 2.4 VS 3.1 for simple print

2009-07-11 Thread Lawrence D'Oliveiro
In message 87hbxkm7n2@benfinney.id.au, Ben Finney wrote: For this and other differences introduced in the Python 3.x series, see URL:http://www.python.org/dev/peps/pep-3100/. People never thank you for an RTFM response. -- http://mail.python.org/mailman/listinfo/python-list

Re: The meaning of = (Was: tough-to-explain Python)

2009-07-11 Thread Lawrence D'Oliveiro
In message h37gv5$r8...@panix3.panix.com, Aahz wrote: It helps to remember that names and namespaces are in many ways syntactic sugar for dicts or lists. Interesting, though, that Python insists on maintaining a distinction between c[x] and c.x, whereas JavaScript doesn't bother. --

Re: The meaning of = (Was: tough-to-explain Python)

2009-07-09 Thread Lawrence D'Oliveiro
In message h3291j$mf...@reader1.panix.com, kj wrote: .., Lundh writes: Assignment statements modify namespaces, not objects. counterexample a = [3] b = a These may indeed modify a namespace, not any object. However: a[:] = [4] a [4] b [4] What change

Re: walking a directory with very many files

2009-07-08 Thread Lawrence D'Oliveiro
In message kck0m.406$ze1@news-server.bigpond.net.au, Lie Ryan wrote: Lawrence D'Oliveiro wrote: ... certainly it is characteristic of GUIs to show you all 400,000 files in a directory, or at least try to do so, and either hang for half an hour or run out of memory and crash, rather than

Re: Check file is locked?

2009-07-07 Thread Lawrence D'Oliveiro
In message mailman.2795.1246997268.8015.python-l...@python.org, Christian Heimes wrote: By the way most operating systems don't lock a file when it's opened for reading or writing or even executed. The general conclusion seems to be that mandatory locking is more trouble than it's worth. --

Re: A Bug By Any Other Name ...

2009-07-06 Thread Lawrence D'Oliveiro
In message mailman.2674.1246866966.8015.python-l...@python.org, Tim Golden wrote: The difficulty here is knowing where to put such a warning. You obviously can't put it against the ++ operator as such because... there isn't one. This bug is an epiphenomenon. :) --

Re: Code that ought to run fast, but can't due to Python limitations.

2009-07-06 Thread Lawrence D'Oliveiro
In message 4a4f91f9$0$1587$742ec...@news.sonic.net, John Nagle wrote: (It should be written in C is not an acceptable answer.) I don't see why not. State machines that have to process input byte by byte are well known to be impossible to implement efficiently in high-level languages. That's

Re: A Bug By Any Other Name ...

2009-07-06 Thread Lawrence D'Oliveiro
In message mailman.2714.1246910113.8015.python-l...@python.org, Terry Reedy wrote: ... it is C, not Python, that is out of step with standard usage in math and most languages ... And it is C that introduced == for equality, versus = for assignment, which Python slavishly followed instead of

Re: Multi thread reading a file

2009-07-05 Thread Lawrence D'Oliveiro
In message 025ff4f1$0$20657$c3e8...@news.astraweb.com, Steven D'Aprano wrote: On Sun, 05 Jul 2009 12:12:22 +1200, Lawrence D'Oliveiro wrote: In message 1beffd94-cfe6-4cf6-bd48-2ccac8637...@j32g2000yqh.googlegroups.com, ryles wrote: # Oh... yeah. I really *did* want 'is None

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