Re: Classes as namespaces?

2010-03-27 Thread J. Clifford Dyer
On Sat, Mar 27, 2010 at 04:28:56AM -0700, Jonathan Hartley wrote regarding Re: Classes as namespaces?: Hey everyone. By coincidence, only yesterday I was wondering about using classes as a way of labeling a block of code, ie. an lightweight alternative to defining a function that would only

Re: Classes as namespaces?

2010-03-27 Thread J. Clifford Dyer
On Fri, Mar 26, 2010 at 02:49:02PM +, kj wrote regarding Classes as namespaces?: What's the word on using classes as namespaces? E.g. class _cfg(object): spam = 1 jambon = 3 huevos = 2 breakfast = (_cfg.spam, _cfg.jambon, _cfg.huevos) Granted, this is not the

Re: Another Screwy Problem

2010-01-08 Thread J. Clifford Dyer
Victor Subervi wrote: Hi; I have this line of code: sql = 'select Name, Price from %sPackages where ID=%s;' % (store, pid) which prints to this: select Name, Price from productsPackages where ID=1; which when I enter it into the MySQL interpreter gives me this: mysql select Name, Price

Re: Another Screwy Problem

2010-01-08 Thread J. Clifford Dyer
On Fri, Jan 08, 2010 at 03:32:34PM -0400, Victor Subervi wrote regarding Another Screwy Problem: Date: Fri, 8 Jan 2010 15:32:34 -0400 From: Victor Subervi victorsube...@gmail.com To: python-list python-list@python.org Subject: Another Screwy Problem Hi; I have this line of code:

Re: count

2009-07-08 Thread J. Clifford Dyer
On Wed, 2009-07-08 at 14:45 -0700, Paul Rubin wrote: a...@pythoncraft.com (Aahz) writes: Avoid that len(tuple(g)), use something like the following, it's lazy and saves some memory. The question is whether it saves time, have you tested it? len(tuple(xrange(1))) ... hmm.

Re: Paramiko help - processing multiple commands

2009-06-25 Thread J. Clifford Dyer
On Wed, 2009-06-24 at 15:22 -0700, Frank Ruiz wrote: Greetings, I am trying to process multiple commands using paramiko. I have searched other threads, and I think my use case is a little different. I am trying to login to a storage node that has a special shell, and as such I cant execute

Re: reseting an iterator

2009-05-22 Thread J. Clifford Dyer
On Fri, 2009-05-22 at 10:54 -0700, Jan wrote: This produces an error because by definition of for-loops it is executed the same way as: temp_iterator = iter(y) # temp_iterator is y while True: try: print(next(temp_iterator)) # temp_iterator does not support __next__()

Re: unicode bit me

2009-05-09 Thread J. Clifford Dyer
You're still not asking questions in a way that we can answer them. Define Doesn't work. Define a. On Sat, 2009-05-09 at 00:04 -0700, anuraguni...@yahoo.com wrote: also not sure why (python 2.5) print a # works print unicode(a) # works print [a] # works print unicode([a]) # doesn't works

RE: Wing vs Netbeans IDE?

2009-05-07 Thread J. Clifford Dyer
On Thu, 2009-05-07 at 10:49 -0700, Benjamin J. Racine wrote: I'd love to see an updated shootout between these three, as I cannot for the life of me seem to be able to settle down with one of them. Things I don't like: Wing's lack of integrated mercurial/svn support. Wing *does* have

Re: Web validation

2009-04-07 Thread J. Clifford Dyer
On Tue, 2009-04-07 at 08:44 +1000, r-w wrote: If no internet connection: if have files: run anyway, with warning else: ERROR else: if error getting hash/files: if have files: run anyway, with warning else:

Re: extract Infobox contents

2009-04-07 Thread J. Clifford Dyer
On Mon, 2009-04-06 at 23:41 +0100, Rhodri James wrote: On Mon, 06 Apr 2009 23:12:14 +0100, Anish Chapagain anishchapag...@gmail.com wrote: Hi, I was trying to extract wikipedia Infobox contents which is in format like given below, from the opened URL page in Python. {{ Infobox

Re: Eval Problem

2009-04-06 Thread J. Clifford Dyer
On Mon, 2009-04-06 at 15:11 -0400, Victor Subervi wrote: Hi: I have this code: x = 1 while x = bitties: file = open(p + str(x) + .txt) for line in file: print line print eval(bits[x - 1]) x += 1 which throws this error: [Mon Apr 06 12:07:29 2009] [error] [client

Re: Characters aren't displayed correctly

2009-03-27 Thread J. Clifford Dyer
On Mon, 2009-03-02 at 06:16 -0800, Hussein B wrote: On Mar 2, 4:03 pm, J. Clifford Dyer j...@sdf.lonestar.org wrote: On Mon, 2009-03-02 at 00:33 -0800, Hussein B wrote: On Mar 1, 11:27 pm, J. Clifford Dyer j...@sdf.lonestar.org wrote: On Sun, 2009-03-01 at 09:51 -0500, Philip Semanchuk

Re: Characters aren't displayed correctly

2009-03-02 Thread J. Clifford Dyer
On Mon, 2009-03-02 at 00:33 -0800, Hussein B wrote: On Mar 1, 11:27 pm, J. Clifford Dyer j...@sdf.lonestar.org wrote: On Sun, 2009-03-01 at 09:51 -0500, Philip Semanchuk wrote: On Mar 1, 2009, at 8:31 AM, Hussein B wrote: Hey, I'm retrieving records from MySQL database

Re: Characters aren't displayed correctly

2009-03-01 Thread J. Clifford Dyer
On Sun, 2009-03-01 at 09:51 -0500, Philip Semanchuk wrote: On Mar 1, 2009, at 8:31 AM, Hussein B wrote: Hey, I'm retrieving records from MySQL database that contains non english characters. Then I create a String that contains HTML markup and column values from the previous result

Re: XML Parsing

2009-02-25 Thread J. Clifford Dyer
Probably because you responded an hour after the question was posted, and in the dead of night. Newsgroups often move slower than that. But now we have posted a solution like that, so all's well in the world. :) Cheers, Cliff On Wed, 2009-02-25 at 08:20 +, hrishy wrote: Hi Lie I am

Re: PHP like documentation?

2009-02-15 Thread J. Clifford Dyer
On Sun, 2009-02-15 at 09:54 -0800, Pavan Mishra wrote: I was wondering if I can use python documentation source (reStructuredText) and restructure it along the lines of PHP documentation. Allowing users to add comments, improving search etc. I was thinking if it would be useful. --

Re: v = json.loads({'test':'test'})

2009-01-25 Thread J. Clifford Dyer
Please include all relevant information in the *body* of your message, not just in the subject. It's a pain having to piece a question back together between the subject. On Sun, 2009-01-25 at 13:12 -0800, gert wrote: raise ValueError(errmsg(Expecting property name, s, end))

Re: Skull Socks (was Re: Convention vs. fascism)

2009-01-16 Thread J. Clifford Dyer
On Fri, 2009-01-16 at 16:41 -0500, Steve Holden wrote: Steven D'Aprano wrote: On Fri, 16 Jan 2009 11:01:18 -0500, J. Cliff Dyer wrote: On Fri, 2009-01-16 at 08:57 +, Steven D'Aprano wrote: On Fri, 16 Jan 2009 10:03:28 +0200, Hendrik van Rooyen wrote: Oh come on you lot - you are

Re: Creating new instances of subclasses.

2009-01-12 Thread J. Clifford Dyer
On Fri, 2009-01-09 at 10:46 -0800, Dennis Lee Bieber wrote: On Wed, 07 Jan 2009 11:38:29 -0500, J. Cliff Dyer j...@unc.edu declaimed the following in comp.lang.python: I want to be able to create an object of a certain subclass, depending on the argument given to the class constructor.

Re: Exec inside a class method to call other class methods?

2008-12-25 Thread J. Clifford Dyer
On Thu, 25 Dec 2008 13:22:15 -0500 Matthew Dubins matt.dub...@sympatico.ca wrote: Hello all, I have made a python script to upload contact information from an excel worksheet to an online database. One part of the program that really tripped me up was when I wanted to call specific class

Re: the official way of printing unicode strings

2008-12-14 Thread J. Clifford Dyer
On Sun, 2008-12-14 at 11:16 +0100, Piotr Sobolewski wrote: Marc 'BlackJack' Rintsch wrote: I'd make that first line: sys.stdout = codecs.getwriter('utf-8')(sys.stdout) Why is it even more cumbersome to execute that line *once* instead encoding at every ``print`` statement? Oh,

Re: var or inout parm?

2008-12-10 Thread J. Clifford Dyer
On Mon, 2008-12-08 at 00:57 -0800, Chris Rebert wrote: On Mon, Dec 8, 2008 at 12:26 AM, Bruno Desthuilliers [EMAIL PROTECTED] wrote: Colin J. Williams a écrit : [EMAIL PROTECTED] wrote: How can I make a var parm, where the called function can modify the value of the parameter in the

Re: Improving interpreter startup speed

2008-10-29 Thread J. Clifford Dyer
Maybe Ruby is the right language for your need. Just sayin'. On Sun, 2008-10-26 at 13:19 +, Pedro Borges wrote: The scripts i need to run but be executed with no apparent delay specially when the text transforms are simple. On Oct 26, 2008, at 11:13 AM, James Mills wrote: On

Re: indentation

2008-10-20 Thread J. Clifford Dyer
On Mon, 2008-10-20 at 13:29 +, Steven D'Aprano wrote: On Mon, 20 Oct 2008 11:01:19 +0200, Bruno Desthuilliers wrote: Steven D'Aprano a écrit : On Sun, 19 Oct 2008 19:03:29 +0200, Bruno Desthuilliers wrote: Steven D'Aprano a écrit : (snip) You can use tabs, or spaces. If you

Re: Case-insensitive string compare?

2008-09-05 Thread J. Clifford Dyer
On Thu, 2008-09-04 at 18:48 -0500, Robert Dailey wrote: Thanks everyone for your help. I'm not opposed to using [key.lower() for key in stage_map] at all, I was just curious to see if there were any cleaner alternatives. It looks like that is what I'll be using. I'm not familiar with how

Re: Hexadecimal: how to convert 'ED6F3C01' to \xED\x6F\x3C\x01 in python coding?

2008-05-24 Thread J. Clifford Dyer
On Sat, 2008-05-24 at 15:36 -0700, zxo102 wrote: Hi, how to change the hexadecimal 'ED6F3C01' (or 'ED 6F 3C 01') to \xED\x6F\x3C\x01 in python coding? When I take 'ED6F3C01' as a string and insert '\x' into it, I just got the error information : invalid \x escape. Thanks. ouyang A

Re: Hexadecimal: how to convert 'ED6F3C01' to \xED\x6F\x3C\x01 in python coding?

2008-05-24 Thread J. Clifford Dyer
On Sat, 2008-05-24 at 15:59 -0700, zxo102 wrote: But this is not \xED\x6F\x3C\x01. I need it for struct.unpack('f',\xED\x6F\x3C\x01) to calculate the decimal value (IEEE 754). Any other suggestions? ouyang In fact it is exactly the same string. The repr of a string always substitutes

[EMAIL PROTECTED]: Re: Compress a string]

2008-05-18 Thread J. Clifford Dyer
On Sun, May 18, 2008 at 07:06:10PM +0100, Matt Porter wrote regarding Compress a string: Hi guys, I'm trying to compress a string. E.g: BBBC - ABC The code I have so far feels like it could be made clearer and more succinct, but a solution is currently escaping me. def

Re: Python and Flaming Thunder

2008-05-14 Thread J. Clifford Dyer
On Tue, 2008-05-13 at 10:33 -0700, Dave Parker wrote: You sound like a commercial. Get Flaming Thunder for only $19.95! It slices, it dices! And while programs and libraries written in assembly may be twice as fast as programs and libraries written in C, ... It's a myth that they're

Re: Backslash frowned upon?

2008-05-13 Thread J. Clifford Dyer
On Tue, 2008-05-13 at 03:25 -0700, [EMAIL PROTECTED] wrote: Why is the \ backslash character frowned upon? Can I still use it in Python 3.0 to achieve the same thing it was designed to do? -- http://mail.python.org/mailman/listinfo/python-list Many people think it looks ugly, but it still

Re: Best way to delimit a list?

2008-05-13 Thread J. Clifford Dyer
On Tue, 2008-05-13 at 03:28 -0700, [EMAIL PROTECTED] wrote: Hi - I have a list returned from popen/readlines, and am wondering how to go about iterating over each item which was returned (rather than currently having the whole lot returned). so far: f=os.open(./get_hostnames).readlines

Re: Am I missing something with Python not having interfaces?

2008-05-08 Thread J. Clifford Dyer
On Thu, 2008-05-08 at 09:12 +0200, Daniel Marcel Eichler wrote: Am Mittwoch 07 Mai 2008 21:48:56 schrieben Sie: That's the point. Interfaces garantee that a duck is a duck, an not only a chicken that quack. Which, in spite of your rhetorical flourish, is the exact opposite of duck

Re: Custom Classes?

2008-05-02 Thread J. Clifford Dyer
On Thu, 2008-05-01 at 17:31 -0500, Victor Subervi wrote: On Wed, Apr 30, 2008 at 12:35 PM, J. Cliff Dyer [EMAIL PROTECTED] wrote: Post working code, and I'll answer your actual question. Good grief! The code is *not* double spaced! Take a look. Click to the end of the first line and

Re: Unicode chr(150) en dash

2008-04-18 Thread J. Clifford Dyer
On Fri, 2008-04-18 at 10:28 +0100, [EMAIL PROTECTED] wrote: On Thu, 17 Apr 2008 20:57:21 -0700 (PDT) hdante [EMAIL PROTECTED] wrote: Don't use old 8-bit encodings. Use UTF-8. Yes, I'll try. But is a problem when I only want to read, not that I'm trying to write or create the content.

Re: Unicode chr(150) en dash

2008-04-18 Thread J. Clifford Dyer
On Fri, 2008-04-18 at 07:27 -0400, J. Clifford Dyer wrote: On Fri, 2008-04-18 at 10:28 +0100, [EMAIL PROTECTED] wrote: On Thu, 17 Apr 2008 20:57:21 -0700 (PDT) hdante [EMAIL PROTECTED] wrote: Don't use old 8-bit encodings. Use UTF-8. Yes, I'll try. But is a problem when I only

Re: Pycon disappointment

2008-03-17 Thread J. Clifford Dyer
I just want to step in and offer my 2¢. This is my first PyCon, and I agree that a lot of the Lightning talks seemed pretty useless. Overall though, I had a great experience at this conference. I learned a lot; I met a lot of cool people; and I got really excited about new ideas to bring back

Re: How about adding rational fraction to Python?

2008-02-26 Thread J. Clifford Dyer
On Tue, 2008-02-26 at 14:08 -0800, Jeff Schwab wrote: J. Cliff Dyer wrote: On Tue, 2008-02-26 at 13:51 -0500, D'Arcy J.M. Cain wrote: On Tue, 26 Feb 2008 13:39:38 -0500 J. Cliff Dyer [EMAIL PROTECTED] wrote: a = 2 * 2 b = 20 * 20 type(a) type 'int' type(b) type

Re: Question from a python newbie

2007-12-13 Thread J. Clifford Dyer
On Thu, Dec 13, 2007 at 04:57:04PM +0100, Remco Gerlich wrote regarding Re: Question from a python newbie: On Dec 13, 2007 4:39 PM, Russell [EMAIL PROTECTED] wrote: I've been learning Python slowly for a few months, coming from a C/C+ +, C#, Java, PHP background. I ran

Re: psycopg

2007-12-12 Thread J. Clifford Dyer
On Wed, Dec 12, 2007 at 09:08:44AM -0500, Calvin Spealman wrote regarding Re: psycopg: Don't do that, for a number of reasons. String concatenation is really never a good idea and formatting your own query strings is exactly what leads to things like sql injection. Let the db

Re: Is a real C-Python possible?

2007-12-12 Thread J. Clifford Dyer
On Wed, Dec 12, 2007 at 06:36:49AM -0800, sturlamolden wrote regarding Re: Is a real C-Python possible?: On 12 Des, 12:56, George Sakkis [EMAIL PROTECTED] wrote: Ah, the 'make' statement.. I liked (and still do) that PEP, I think it would have an impact comparable to the decorator syntax

Re: Is anyone happy with csv module?

2007-12-12 Thread J. Clifford Dyer
On Wed, Dec 12, 2007 at 10:08:38AM -0600, [EMAIL PROTECTED] wrote regarding Re: Is anyone happy with csv module?: FWIW, CSV is a much more generic format for spreadsheets than XLS. For example, I deal almost exclusively in CSV files for simialr situations as the OP because I also work with

Re: Is anyone happy with csv module?

2007-12-12 Thread J. Clifford Dyer
On Wed, Dec 12, 2007 at 11:02:04AM -0600, [EMAIL PROTECTED] wrote regarding Re: Is anyone happy with csv module?: J. Clifford Dyer [EMAIL PROTECTED] wrote: But the software you are dealing with probably doesn't actually need spreadsheets. It just needs digital ledgers. I saw someone

Re: Dumb newbie back in shell

2007-12-11 Thread J. Clifford Dyer
The code you just posted doesn't compile successfully. However, in your code, you probably have char_ptr defined at the module level, and you're confused because you didn't declare it as global. Am I right? My crystal ball has a smudge on it, but I think I can still see okay. You can still

Re: Dumb newbie back in shell

2007-12-11 Thread J. Clifford Dyer
/pipermail/python-list List-Post: mailto:python-list@python.org List-Help: mailto:[EMAIL PROTECTED] List-Subscribe: http://mail.python.org/mailman/listinfo/python-list, mailto:[EMAIL PROTECTED] Errors-To: [EMAIL PROTECTED] On Dec 11, 2007 8:23 AM, J. Clifford Dyer [EMAIL PROTECTED] wrote

eval raising SyntaxError (was No Subject)

2007-12-11 Thread J. Clifford Dyer
On Tue, 2007-12-11 at 16:55 -0800, katie smith wrote: I tried your suggestions and all that came up was the error Traceback (most recent call last): File C:\Python25\empire\Empire Strategy.pyw, line 1788, in module NewMap1= eval (NewMap1, {}, {}) File string, line 1 Tropical

Re: File to dict

2007-12-07 Thread J. Clifford Dyer
On Fri, 2007-12-07 at 03:31 -0800, [EMAIL PROTECTED] wrote: Hello everyone, I have written this small utility function for transforming legacy file to Python dict: def lookupdmo(domain): lines = open('/etc/virtual/domainowners','r').readlines() lines = [

Re: Why did no one tell me about import antigravity?

2007-12-05 Thread J. Clifford Dyer
On Wed, 2007-12-05 at 10:08 +, Adrian Cherry wrote: Ant [EMAIL PROTECTED] wrote in news:52f0eca3-e807-4890-b21d- [EMAIL PROTECTED]: Python on xkcd: http://xkcd.com/353/ Another good comic from xkcd, I'm surprised by the muted response on here. Don't forget to check out the

Re: C/C++ on UNIX Developer required in Woodmead, Johannesburg

2007-12-01 Thread J. Clifford Dyer
Please don't. This job is not even vaguely python related. On Sat, 2007-12-01 at 18:42 +0100, James Matthews wrote: Please post in the Python Wiki under the jobs On Dec 1, 2007 9:38 AM, arnold [EMAIL PROTECTED] wrote: We seek the following sort of experience / skill for developer

Re: Python is not a good name, should rename to Athon

2007-12-01 Thread J. Clifford Dyer
On Sat, 2007-12-01 at 12:10 -0800, Russ P. wrote: On Dec 1, 2:10 am, Bjoern Schliessmann usenet- [EMAIL PROTECTED] wrote: Russ P. wrote: I agree that Python is not a good name for a programming language, Why not? Think about proposing its use to someone who has never heard of it

Re: Oh no, my code is being published ... help!

2007-11-30 Thread J. Clifford Dyer
On Fri, Nov 30, 2007 at 12:25:25PM -0200, Eduardo O. Padoan wrote regarding Re: Oh no, my code is being published ... help!: On Nov 30, 2007 11:36 AM, Hrvoje Niksic [EMAIL PROTECTED] wrote: Eduardo O. Padoan [EMAIL PROTECTED] writes: No, writing this way will confound the 2to3 tool.

Re: How to Teach Python Variables

2007-11-28 Thread J. Clifford Dyer
On Wed, Nov 28, 2007 at 11:23:42AM -0600, Chris Mellon wrote regarding Re: How to Teach Python Variables: On Nov 28, 2007 10:57 AM, hdante [EMAIL PROTECTED] wrote: On Nov 28, 2:12 pm, Chris Mellon [EMAIL PROTECTED] wrote: Right. Python variables are pointers, except for all the ways

Re: Bit Operations

2007-11-28 Thread J. Clifford Dyer
On Wed, Nov 28, 2007 at 09:07:56PM +0100, Gianmaria Iaculo - NVENTA wrote regarding Bit Operations: Hi there, I'm so new to python (coming from .net so excuse me for the stupid question) and i'm tring to do a very simple thing,with bytes. My problem is this: i've a byte that naturally

Re: Bit Operations

2007-11-28 Thread J. Clifford Dyer
On Wed, Nov 28, 2007 at 10:05:40PM +0100, Gianmaria Iaculo - NVENTA wrote regarding Re: Bit Operations: Txs all, i wont to respond to who asked why i needed it: I'm using python on GSM modules and the informations i have to move goes along GPRS/UMTS connections so it's beatiful for me to

Re: Best ways of managing text encodings in source/regexes?

2007-11-27 Thread J. Clifford Dyer
On Tue, Nov 27, 2007 at 01:30:15AM +0200, tinker barbet wrote regarding Re: Best ways of managing text encodings in source/regexes?: Hi Thanks for your responses, as I said on the reply I posted I thought later it was a bit long so I'm grateful you held out! I should have said (but see

Re: Need to call functions/class_methods etc using string ref :How

2007-11-26 Thread J. Clifford Dyer
On Mon, Nov 26, 2007 at 04:07:03PM +0530, Ravi Kumar wrote regarding Need to call functions/class_methods etc using string ref :How: Hi, First of all, since this is my first mail to Python-List, I want to say Hello world! After that; I am stuck in a project. Actually I am

Re: How to write Regular Expression for recursive matching?

2007-11-26 Thread J. Clifford Dyer
On Mon, Nov 26, 2007 at 06:04:54PM +0100, Diez B. Roggisch wrote regarding Re: How to write Regular Expression for recursive matching?: lisong wrote: Hi All, I have problem to split a string like this: 'abc.defg.hij.klmnop' and I want to get all substrings with only one '.'

Re: basic if stuff- testing ranges

2007-11-25 Thread J. Clifford Dyer
On Sun, 2007-11-25 at 20:49 +0200, Donn Ingle wrote: Sheesh, I've been going spare trying to find how to do this short-hand: if 0 x 20: print within smartAssAnswer if 0 x: print within /smartAssAnswer -- http://mail.python.org/mailman/listinfo/python-list

Re: the annoying, verbose self

2007-11-22 Thread J. Clifford Dyer
On Thu, Nov 22, 2007 at 10:13:46AM +0100, A.T.Hofkamp wrote regarding Re: the annoying, verbose self: On 2007-11-22, Steven D'Aprano [EMAIL PROTECTED] wrote: On Wed, 21 Nov 2007 15:51:56 -0800, braver wrote: Is there any trick to get rid of having to type the annoying, character-eating

Re: why it is invalid syntax?

2007-11-22 Thread J. Clifford Dyer
On Thu, Nov 22, 2007 at 06:47:33AM +, Marc 'BlackJack' Rintsch wrote regarding Re: why it is invalid syntax?: It's quite unreadable and if this would be allowed you would have to introduce a special rule to forbid ``else``, ``except`` and ``finally`` because it can lead to ambiguities.

Re: eof

2007-11-22 Thread J. Clifford Dyer
On Thu, Nov 22, 2007 at 06:53:59AM -0800, braver wrote regarding Re: eof: Language comparisons are sometimes good. They are best when they are free of FUD. So why Python's IO cannot yield f.eof() as easily as Ruby's can? :) Because that's not how you compare languages. You compare

Re: eof

2007-11-22 Thread J. Clifford Dyer
On Thu, Nov 22, 2007 at 07:17:41AM -0800, braver wrote regarding Re: eof: On Nov 22, 6:08 pm, J. Clifford Dyer [EMAIL PROTECTED] wrote: So why Python's IO cannot yield f.eof() as easily as Ruby's can? :) Because that's not how you compare languages. You compare languages

Re: How to import xplt, pylab?

2007-11-22 Thread J. Clifford Dyer
On Thu, Nov 22, 2007 at 02:00:00PM -0800, Caren Balea wrote regarding How to import xplt, pylab?: Hello, I'm newbie to python. So far, I'm a bit disappointed. It's awful to set Python up to work. It's not working!!! Ok, calm down. Here are my settings: I'm using Windows XP machine

Re: Python strings question (vertical stack)

2007-11-20 Thread J. Clifford Dyer
On Tue, Nov 20, 2007 at 11:40:59AM -0800, Farshid Lashkari wrote regarding Re: Python strings question (vertical stack): dmitrey wrote: Hi all, I have some strings, let it be string1, string2, string3. So how could String= string1 string2 string3 be obtained?

Re: Writing Error in program

2007-11-20 Thread J. Clifford Dyer
On Tue, Nov 20, 2007 at 01:02:38PM -0800, [EMAIL PROTECTED] wrote regarding Writing Error in program: I have a code that writes to 2 seperate files. I keep getting a list index out of range error. The strange part is that when checking the files that I'm writing too, the script has already

Re: [regex] Basic rewriting

2007-11-20 Thread J. Clifford Dyer
On Wed, 2007-11-21 at 03:24 +0100, Gilles Ganault wrote: Hello I've been reading tutorials on regexes in Python, but I still don't get it: #!/usr/bin/python #myscript.py 0123456789 import sys,re #Turn 0123456789 into 01.23.45.67.89 p =

Re: Python strings question (vertical stack)

2007-11-20 Thread J. Clifford Dyer
On Tue, 2007-11-20 at 13:59 -0800, John Machin wrote: On Nov 21, 7:15 am, Farshid Lashkari [EMAIL PROTECTED] wrote: J. Clifford Dyer wrote: I think you mean '\n'.join([string1,string2,string3]) You actually do want the \ to do its thing in this case. Yeah, my brain must still

Re: overriding methods - two questions

2007-11-19 Thread J. Clifford Dyer
On Mon, Nov 19, 2007 at 01:41:46PM +0100, Bruno Desthuilliers wrote regarding Re: overriding methods - two questions: Steven D'Aprano a ?crit : On Fri, 16 Nov 2007 18:28:59 +0100, Bruno Desthuilliers wrote: Question 1: Given that the user of the API can choose to override foo() or

[EMAIL PROTECTED]: Re: overriding methods - two questions]

2007-11-19 Thread J. Clifford Dyer
On Mon, Nov 19, 2007 at 04:33:39PM +0100, Bruno Desthuilliers wrote regarding Re: overriding methods - two questions: J. Clifford Dyer a ?crit : On Mon, Nov 19, 2007 at 01:41:46PM +0100, Bruno Desthuilliers wrote regarding Re: overriding methods - two questions: Steven D'Aprano a ?crit

Re: implement random selection in Python

2007-11-17 Thread J. Clifford Dyer
On Fri, 2007-11-16 at 16:47 -0800, Bruza wrote: I think I need to explain on the probability part: the prob is a relative likelihood that the object will be included in the output list. So, in my example input of items = [('Mary',30), ('John', 10), ('Tom', 45), ('Jane', 15)] So, for any

Re: Fwd: Sorting Countries by Region

2007-11-17 Thread J. Clifford Dyer
On Sat, 2007-11-17 at 03:34 -0800, [EMAIL PROTECTED] wrote: #This seems to not work today and I don't know why #for country in countries_list: #if country not in REGIONS_COUNTRIES['European Union'] or not in REGIONS_COUNTRIES['North America']: #print %s is not in the expected

Re: sorting contacts alphabetically, sorted by surname

2007-11-16 Thread J. Clifford Dyer
On Fri, Nov 16, 2007 at 12:31:19PM +, Marie Hughes wrote regarding sorting contacts alphabetically, sorted by surname: HI I have to write a program that contains a text file in the following format: AcademicPositionRoom Ext. Email

Re: Printing user input?

2007-11-15 Thread J. Clifford Dyer
On Thu, Nov 15, 2007 at 09:03:26AM -0800, Mohammed_M wrote regarding Printing user input?: Hi, I'm v.new to Python, so please don't be too harsh :) I get a NameError with the code below - All I want to do is store some input taken from the user in a variable called name, then print name

Re: Creating Installer or Executable in Python

2007-11-14 Thread J. Clifford Dyer
On Wed, Nov 14, 2007 at 03:34:14PM +0100, Laszlo Nagy wrote regarding Re: Creating Installer or Executable in Python: DanielJohnson wrote: I have a small project which has around 10 .py files and I run this project using command line arguments. I have to distribute this project to

Re: why no automatic conversion in string concatenation?

2007-11-13 Thread J. Clifford Dyer
On Tue, Nov 13, 2007 at 07:15:06AM -0800, Michael Pelz Sherman wrote regarding why no automatic conversion in string concatenation?: As a Java PHP developer, I find it kind of annoying that I have to explicitly convert non-string variables to strings when concatenating them,

Re: regular expressions

2007-11-06 Thread J. Clifford Dyer
On Tue, Nov 06, 2007 at 08:49:33AM -0800, [EMAIL PROTECTED] wrote regarding regular expressions: hi i am looking for pattern in regular expreesion that replaces anything starting with and betweeen http:// until / like http://www.start.com/startservice/yellow/ fdhttp://helo/abcd will be

Re: python newbie

2007-11-02 Thread J. Clifford Dyer
On Fri, Nov 02, 2007 at 11:13:00AM -0400, Jim Hendricks wrote regarding Re: python newbie: BartlebyScrivener wrote: On Nov 2, 8:51 am, Jim Hendricks [EMAIL PROTECTED] wrote: New to python, programming in 15 or so langs for 24 years. Couple of questions the tuts I've looked at don't

Re: shouldn't 'string'.find('ugh') return 0, not -1 ?

2007-10-31 Thread J. Clifford Dyer
On Wed, Oct 31, 2007 at 03:55:49PM +0100, jelle feringa wrote regarding Re: shouldn't 'string'.find('ugh') return 0, not -1 ?: There is a subtle point though. If the substring is not found '_'.find(' '), will return -1 Semanticly, I was expecting the that if the substring was

Re: Iteration for Factorials

2007-10-30 Thread J. Clifford Dyer
On Tue, Oct 30, 2007 at 01:09:38PM +0100, Boris Borcic wrote regarding Re: Iteration for Factorials: Py-Fun wrote: I'm stuck trying to write a function that generates a factorial of a number using iteration and not recursion. Any simple ideas would be appreciated. fact = lambda n

Re: Iteration for Factorials

2007-10-30 Thread J. Clifford Dyer
On Tue, Oct 30, 2007 at 01:09:38PM +0100, Boris Borcic wrote regarding Re: Iteration for Factorials: Py-Fun wrote: I'm stuck trying to write a function that generates a factorial of a number using iteration and not recursion. Any simple ideas would be appreciated. fact = lambda n

Re: Iteration for Factorials

2007-10-30 Thread J. Clifford Dyer
On Tue, Oct 30, 2007 at 11:37:57AM -0700, [EMAIL PROTECTED] wrote regarding Re: Iteration for Factorials: On Oct 30, 10:25 am, J. Clifford Dyer [EMAIL PROTECTED] wrote: On Tue, Oct 30, 2007 at 01:09:38PM +0100, Boris Borcic wrote regarding Re: Iteration for Factorials: Py-Fun

Re: Parsing xml file in python

2007-10-30 Thread J. Clifford Dyer
On Tue, Oct 30, 2007 at 11:45:17AM -0700, [EMAIL PROTECTED] wrote regarding Re: Parsing xml file in python: Top-posting corrected On Oct 30, 12:32 pm, Diez B. Roggisch [EMAIL PROTECTED] wrote: [EMAIL PROTECTED] schrieb: I am a newbie in python I am trying to parse a xml

Re: two file into a single file

2007-10-29 Thread J. Clifford Dyer
You will need to use the open() builtin for each input file, and again for the output file. Documentation is available in the python tutorial here: http://docs.python.org/tut/node9.html#SECTION00920 You should read also the whole tutorial, and work with it until you understand

Re: two files into an alternate list

2007-10-29 Thread J. Clifford Dyer
That depends: What do you want when you have these two files: file 1: a b c file 2: 1 2 3 4 5 Options: *['a',1,'b',2,'c',3,None,4,None,5] *['a',1,'b',2,'c',3,4,5] *['a',1,'b',2,'c',3] *Throw an exception And what if file 1 has more lines than file 2? Cheers, Cliff 1 On Mon, Oct 29, 2007 at

Re: Built-in functions and keyword arguments

2007-10-29 Thread J. Clifford Dyer
On Mon, Oct 29, 2007 at 02:27:50PM +, Duncan Booth wrote regarding Re: Built-in functions and keyword arguments: Bruno Desthuilliers [EMAIL PROTECTED] wrote: In the second case, the name of the argument *is* 'object'. Which is not the case for the builtin len (which, fwiw, has

Re: Built-in functions and keyword arguments

2007-10-29 Thread J. Clifford Dyer
On Mon, Oct 29, 2007 at 06:45:22PM +, Duncan Booth wrote regarding Re: Built-in functions and keyword arguments: J. Clifford Dyer [EMAIL PROTECTED] wrote: I think you are being a little bit unfair here: help(len) says: len(...) len(object) - integer Return

Re: tuples within tuples

2007-10-26 Thread J. Clifford Dyer
On Fri, Oct 26, 2007 at 06:59:51AM -0700, [EMAIL PROTECTED] wrote regarding Re: tuples within tuples: Resolve *what*? The problem isn't clear yet; at least to me. Above you say what you get. What exactly do you want? Examples please. Sorry for my poor english, but I meant: how

Re: Better writing in python

2007-10-24 Thread J. Clifford Dyer
On Wed, Oct 24, 2007 at 12:09:40PM -, Alexandre Badez wrote regarding Better writing in python: lMandatory = [] lOptional = [] for arg in cls.dArguments: if arg is True: lMandatory.append(arg) else: lOptional.append(arg) return (lMandatory, lOptional) I think there is

Re: How can i protect text format ?

2007-10-23 Thread J. Clifford Dyer
On Tue, Oct 23, 2007 at 06:30:18AM -0700, Abandoned wrote regarding How can i protect text format ?: Hi.. I want to do a forum with python but i have a problem.. I have a textarea and i write: line 1 hi line 2 how r u And then i save to this database ( colomn data type is text) And

Re: New module for method level access modifiers

2007-10-23 Thread J. Clifford Dyer
On Tue, Oct 23, 2007 at 08:54:52PM +0200, Bruno Desthuilliers wrote regarding Re: New module for method level access modifiers: TimeHorse a ?crit : I have started work on a new module that would allow the decoration of class methods to restrict access based on calling context.

Re: Appending a list's elements to another list using a list comprehension

2007-10-18 Thread J. Clifford Dyer
On Thu, Oct 18, 2007 at 11:57:10AM -, Paul Hankin wrote regarding Re: Appending a list's elements to another list using a list comprehension: Not to me: I can never remember which of a.append and a.extend is which. Falling back to a = a + b is exactly what you want. For instance: a =

Re: Problem with MySQL cursor

2007-10-11 Thread J. Clifford Dyer
On Thu, Oct 11, 2007 at 03:14:30PM +0200, Florian Lindner wrote regarding Problem with MySQL cursor: Traceback (most recent call last): File manage.py, line 90, in ? addDomain(domainName) File manage.py, line 27, in addDomain executeSQL(sql, DOMAIN_TABLE, DOMAIN_FIELD,

Re: why did MIT drop scheme for python in intro to computing?

2007-10-09 Thread J. Clifford Dyer
On Tue, Oct 09, 2007 at 06:28:00AM -0500, Harold Ancell wrote regarding Re: why did MIT drop scheme for python in intro to computing?: On Tue, 09 Oct 2007 03:28:53 -, [EMAIL PROTECTED] wrote: On Oct 8, 1:23 pm, [EMAIL PROTECTED] (Brian Harvey) wrote: Kjetil S. Matheussen [EMAIL

Re: pytz has so many timezones!

2007-10-09 Thread J. Clifford Dyer
On Tue, Oct 09, 2007 at 11:21:41AM -0700, [EMAIL PROTECTED] wrote regarding Re: pytz has so many timezones!: The Earth says. It takes 24 hours to revolve. Why aren't they separated by 30minutes, or 20, or 10? Or 2 hours? Why isn't an hour defined to be 30 minutes? Or why don't we

Re: pytz has so many timezones!

2007-10-08 Thread J. Clifford Dyer
On Mon, Oct 08, 2007 at 10:41:03AM -0700, [EMAIL PROTECTED] wrote regarding Re: pytz has so many timezones!: On Oct 8, 2:32 am, Sanjay [EMAIL PROTECTED] wrote: Hi All, I am using pytz.common_timezones to populate the timezone combo box of some user registration form. But as it has so

Re: pytz has so many timezones!

2007-10-08 Thread J. Clifford Dyer
On Mon, Oct 08, 2007 at 01:12:32PM -0700, [EMAIL PROTECTED] wrote regarding Re: pytz has so many timezones!: [ I wrote ] Reducing them to a single time zone will result in aberrant functionality in one or more locales. I would hardly think that's an issue on the user registration form

Re: pytz has so many timezones!

2007-10-08 Thread J. Clifford Dyer
On Mon, Oct 08, 2007 at 01:13:24PM -0700, [EMAIL PROTECTED] wrote regarding Re: pytz has so many timezones!: On Oct 8, 1:03 pm, Carsten Haese [EMAIL PROTECTED] wrote: On Mon, 2007-10-08 at 10:41 -0700, [EMAIL PROTECTED] wrote: For example, Windows has seperate listings for Central

Re: remove list elements..

2007-10-05 Thread J. Clifford Dyer
On Fri, Oct 05, 2007 at 07:27:39AM -0700, Abandoned wrote regarding remove list elements..: Hi.. I have a problem.. list1=[11, 223, 334, 4223...] 1 million element list2=[22,223,4223,2355...] 500.000 element I want to difference list1 to list2 but order very importent.. My result must

Re: Python Magazine: Issue 1 Free!

2007-10-05 Thread J. Clifford Dyer
On Fri, Oct 05, 2007 at 04:11:07PM -, Grant Edwards wrote regarding Re: Python Magazine: Issue 1 Free!: On 2007-10-05, Steve Holden [EMAIL PROTECTED] wrote: I've just been told by the editors at Python Magazine that the first issue is out. The first issue is issue number 10?

Re: The Modernization of Emacs: terminology buffer and keybinding

2007-10-04 Thread J. Clifford Dyer
On Thu, Oct 04, 2007 at 04:49:50PM +0200, Wildemar Wildenburger wrote regarding Re: The Modernization of Emacs: terminology buffer and keybinding: Steve Holden wrote: Lawrence D'Oliveiro wrote: In message [EMAIL PROTECTED], Steve Holden wrote: Lawrence D'Oliveiro wrote: In

  1   2   >