OT--Shuffling, was Re: invert or reverse a string... warning this is a rant

2006-10-19 Thread J. Clifford Dyer
Demel, Jeff wrote: > P.S. How about a string.shuffle() method that splits the string in half > into two new strings str1 and str2, and then recompiles the string by > alternating one character from each str1 and str2 as it goes? Like > shuffling cards. ;) Jeff, To my mind that would be th

Re: Default location while open an Excel file

2006-10-24 Thread J. Clifford Dyer
Try this: >>> import os >>> os.getcwd() 'C:\\Python24' I ran it from the interpreter. Dunno what it does from a script in an arbitrary location. YMMV. Cheers, Cliff -- http://mail.python.org/mailman/listinfo/python-list

Re: Simple python + html + from --> to python script

2006-10-24 Thread J. Clifford Dyer
A good starting place would be the documentation on python.org. In this case, the python library reference would have been helpful: http://docs.python.org/lib/lib.html Cheers, Cliff flit wrote: > Man > Very thanks... > I really try to find some source of good and simple and nothing.. > Man

Re: Sorting by item_in_another_list

2006-10-25 Thread J. Clifford Dyer
ZeD wrote: > Paul Rubin wrote: > >>> A = [0,1,2,3,4,5,6,7,8,9,10] >>> B = [2,3,7,8] >>> >>> desired_result = [2,3,7,8,0,1,4,5,6,9,10] >> How about: >> >> desired_result = B + sorted(x for x in A if x not in B) > > this. is. cool. > Cool, yes, but I'm not entirely sure it does what the OP want

Re: Simple python + html + from --> to python script

2006-10-25 Thread J. Clifford Dyer
udience for the docs are for "grown ups" programmers.. > I think I will do some tutorial, in baby steps... > > J. Clifford Dyer wrote: >> A good starting place would be the documentation on python.org. >> >> In this case, the python library reference would hav

Re: Sorting by item_in_another_list

2006-10-25 Thread J. Clifford Dyer
Right you are. I was a bit hasty. Many thanks. Cliff Paul McGuire wrote: > > From the original post: > > "I have two lists, A and B, such that B is a subset of A." > -- http://mail.python.org/mailman/listinfo/python-list

Re: How to Split Chinese Character with backslash representation?

2006-10-27 Thread J. Clifford Dyer
Paul McGuire wrote: > "Wijaya Edward" <[EMAIL PROTECTED]> wrote in message > news:[EMAIL PROTECTED] >> Hi all, >> >> I was trying to split a string that >> represent chinese characters below: >> >> > str = '\xc5\xeb\xc7\xd5\xbc' > fields2 = split(r'\\',str) > > There are no backslash char

Re: question about True values

2006-10-27 Thread J. Clifford Dyer
I do see how mapping to Truth/Falsehood is more natural, and I do believe that one of the great things about python is that it feels natural in so many ways, and hence makes it easy to produce code, but the one thing that Ms. Creighton points out that I can't get past is that Python, even with

Re: PROBLEM with MOD_PYTHON

2006-10-28 Thread J. Clifford Dyer
dan84 wrote: > I don't understand this error , in the (Apache) errorlog I read this > message : > > [Sat Oct 28 14:04:03 2006] [error] make_obcallback: could not import > mod_python.apache.\n > [Sat Oct 28 14:04:03 2006] [error] make_obcallback: Python path being > used "['C:Python24python

Re: question about True values

2006-10-28 Thread J. Clifford Dyer
Georg Brandl wrote: > J. Clifford Dyer wrote: > >> >>> (1 > 0) < 1 >> False >> >>> 1 > 0 < 1 >> True >> >>> 1 > (0 < 1) >> False >> >>> 10 > (0 < 1) >> True > > I hope

Re: question about True values

2006-10-28 Thread J. Clifford Dyer
Steven D'Aprano wrote: > On Sat, 28 Oct 2006 03:13:42 +0100, Steve Holden wrote: > >>> Finally, while True/False is a good mental mapping for numeric >>> comparisons, take the following: >>> >>> >>> if "Cliff is a pillar of the open source community": >>> print "thank you" >>> e

Re: create global variables?

2006-10-30 Thread J. Clifford Dyer
Alistair King wrote: > Hi, > > is there a simple way of creating global variables within a function? > > ive tried simply adding the variables in: > > def function(atom, Xaa, Xab): > Xaa = onefunction(atom) > Xab = anotherfunction(atom) > > if i can give something like: > > function('C

Re: scared about refrences...

2006-10-30 Thread J. Clifford Dyer
SpreadTooThin wrote: > Steven D'Aprano wrote: >> On Mon, 30 Oct 2006 13:10:47 -0800, SpreadTooThin wrote: >> > How do I specify or create deep copies of objects that may contain > other objects that may contain other object that may contain other > objects See the `copy` module

Re: scared about refrences...

2006-10-30 Thread J. Clifford Dyer
SpreadTooThin wrote: > J. Clifford Dyer wrote: >> SpreadTooThin wrote: >>> Steven D'Aprano wrote: >>>> On Mon, 30 Oct 2006 13:10:47 -0800, SpreadTooThin wrote: >>>> >>>> >>> I seems that some of the objects in the list don'

Re: create global variables?-the full story

2006-11-02 Thread J. Clifford Dyer
> OK... > > from the start. > > im trying to develop a simple command line application for determining > the degree of substitution (DS) on a polymer backbone from elemental > analysis, i.e., the % weights of different elements in the > monomer-substituent compound ( i want each element to give a

Re: modules and generated code

2006-11-15 Thread J. Clifford Dyer
Nigel Rantor wrote: > Peter Otten wrote: >> Nigel Rantor wrote: >> >>> Peter Otten wrote: Nigel Rantor wrote: >> > So, if I have a tool that generates python code for me (in my case, > CORBA stubs/skels) in a particular package is there a way of > placing my > own code under t

Re: case insensitive dictionary

2006-11-27 Thread J. Clifford Dyer
John Henry wrote: >print pets.keys() > > should print: > > "Cat", "Dog" If you do: Py> pets['Cat'] = 2 Py> pets['Dog'] = 3 Py> pets['DOG'] = 4 Py> pets['cat'] += 5 Py> pets.keys() What should the result be? "['Cat', 'Dog']" or "['cat', 'DOG']"? That is to say, if you use a new case in r

Re: Inheritance doesn't work

2006-12-04 Thread J. Clifford Dyer
Fredrik Lundh wrote: > John Salerno wrote: > >> How do you get that error with that code? > > $ python > import os class foo(os): > pass > > Traceback (most recent call last): > File "", line 1, in > TypeError: Error when calling the metaclass bases > module.__init

Re: tuple.index()

2006-12-19 Thread J. Clifford Dyer
Roy Smith wrote: > In article <[EMAIL PROTECTED]>, > greg <[EMAIL PROTECTED]> wrote: > >> Roy Smith wrote: >> >>> The struct does lookup by name, the tuple is inherently index based. >> I was trying to help people understand the distinction >> we're talking about by showing an example of the same

Re: tuple.index()

2006-12-19 Thread J. Clifford Dyer
James Stroud wrote: > Christoph Zwerschke wrote: >> "Inhomogenous" in some meaning of the word --> tuple > > I think that you have nailed it here. I don't think anyone on this list > is capable of giving a "concrete" (as you have put it) operational > definition of "inhomogenous". They will resort

Re: tuple.index()

2006-12-19 Thread J. Clifford Dyer
Nick Maclaren wrote: > In article <[EMAIL PROTECTED]>, > "J. Clifford Dyer" <[EMAIL PROTECTED]> writes: > |> > |> How about: "A heterogenous sequence is one in which each element plays a > |> unique role, specific to its position in the se

Re: tuple.index()

2006-12-19 Thread J. Clifford Dyer
Nick Maclaren wrote: > In article <[EMAIL PROTECTED]>, > "J. Clifford Dyer" <[EMAIL PROTECTED]> writes: > |> > |> On the contrary, I think that example fits perfectly with my definition > |> of homogenous. If there is no constraint on position, t

Re: Mod_python

2006-12-27 Thread J. Clifford Dyer
Lad wrote: > Maxim Sloyko wrote: >> Lad wrote: >>> In my web application I use Apache and mod_python. >>> I allow users to upload huge files( via HTTP FORM , using POST method) >>> I would like to store the file directly on a hard disk and not to >>> upload the WHOLE huge file into server's memory

Re: Unsubscribing from the list

2007-01-03 Thread J. Clifford Dyer
Nice move, using Perl/PHP for that. It's always fun to piss people off by apologizing. ;) Cheers, Cliff Dotan Cohen wrote: > On 03/01/07, Robert Kern <[EMAIL PROTECTED]> wrote: >> He misunderstood you (as I nearly did, too). The way you phrased >> "decided that >> there was no futher interest o

Re: Iterate through list two items at a time

2007-01-03 Thread J. Clifford Dyer
Gabriel Genellina wrote: > b=iter(a) > for x in b: >y=b.next() >print x,y > So as not to choke on odd-length lists, you could try a = [1,2,3,4,5,6,7] b = iter(a) for x in b: try: y=b.next() except StopIteration: y=None print x,y Substitute in whatever for y

Re: encoding latin1 to utf-8

2007-09-10 Thread J. Clifford Dyer
On Mon, Sep 10, 2007 at 12:25:46PM -, Harshad Modi wrote regarding encoding latin1 to utf-8: > Path: > news.xs4all.nl!newsspool.news.xs4all.nl!transit.news.xs4all.nl!newsgate.cistron.nl!xs4all!news.glorb.com!postnews.google.com!22g2000hsm.googlegroups.com!not-for-mail > > hello , > I make o

Re: Car-ac-systems

2007-09-11 Thread J. Clifford Dyer
On Tue, Sep 11, 2007 at 05:50:43PM +, Marc 'BlackJack' Rintsch wrote regarding Re: Car-ac-systems: > > On Tue, 11 Sep 2007 17:42:53 +, Zentrader wrote: > > > > > What is it about "please do not top-post" that you have difficulty > > understanding? Or do "MVP"s feel that their time is so

Re: Car-ac-systems

2007-09-11 Thread J. Clifford Dyer
On Tue, Sep 11, 2007 at 07:50:33PM +0100, John Timney (MVP) wrote regarding Re: Car-ac-systems: > > "Marc 'BlackJack' Rintsch" <[EMAIL PROTECTED]> wrote in message > news:[EMAIL PROTECTED] > > On Tue, 11 Sep 2007 17:42:53 +, Zentrader wrote: > > > >> > >> What is it about "please do not top

Re: newbie: self.member syntax seems /really/ annoying

2007-09-12 Thread J. Clifford Dyer
On Wed, Sep 12, 2007 at 07:43:51AM -0700, Charles Fox wrote regarding Re: newbie: self.member syntax seems /really/ annoying: > > Thanks guys -- yeah these two stategies (short s.varname; and explicit > rescoping, a=self.a etc) are more or less what I was using. That's > still kind of annoying t

Re: newbie: self.member syntax seems /really/ annoying

2007-09-13 Thread J. Clifford Dyer
On Thu, Sep 13, 2007 at 04:21:36PM -, Steven D'Aprano wrote regarding Re: newbie: self.member syntax seems /really/ annoying: > > It's not just a matter of taste. > > Reading comprehensibility is an objective, measurable quantity, and I > would bet that "(self.foo + self.bar) * self.baz" wo

Re: plotting pixels in python

2007-09-13 Thread J. Clifford Dyer
On Thu, Sep 13, 2007 at 06:37:43PM -, [EMAIL PROTECTED] wrote regarding Re: plotting pixels in python: > > On Sep 13, 11:22 pm, Paul McGuire <[EMAIL PROTECTED]> wrote: > > On Sep 13, 1:03 pm, [EMAIL PROTECTED] wrote: > > > > > hi to all > > > I am just a beginner of python. I want to know how

Re: Decimal formatting

2007-09-13 Thread J. Clifford Dyer
On Thu, Sep 13, 2007 at 01:50:51PM -0700, Harlin Seritt wrote regarding Decimal formatting: > > Cant believe I have to post this and get help... and can't believe I > couldnt Google it reasonably well enough... I need to take a float > variable and have it display as a string to always have two d

Re: recursion

2007-09-14 Thread J. Clifford Dyer
On Fri, Sep 14, 2007 at 01:40:17PM +0200, Gigs_ wrote regarding Re: recursion: > > what i mean is how python knows to add all thing at the end of recursion > > >>> def f(l): > if l == []: > return [] > else: > return f(l[1:]) + l[:1] > The following script does exa

Re: adodb with mysql - connection string syntax for filepath

2007-09-18 Thread J. Clifford Dyer
On Tue, Sep 18, 2007 at 09:32:45AM -0400, Steve Holden wrote regarding Re: adodb with mysql - connection string syntax for filepath: > > Mridula Ramesh wrote: > > Hi. Firstly, thank you both very much for the response! > > > > Cliff, I did some more reading up about it after you corrected me re

Re: RE Help

2007-09-21 Thread J. Clifford Dyer
On Fri, Sep 21, 2007 at 12:05:51PM -0700, [EMAIL PROTECTED] wrote regarding Re: RE Help: > > > > > x = re.compile('START(.*)END', re.DOTALL) > > You'll want to use a non-greedy match: > > x = re.compile(r"START(.*?)END", re.DOTALL) > > Otherwise the . will match END as well. The . will only c

Re: getopt with negative numbers?

2007-09-27 Thread J. Clifford Dyer
If you can access the argument list manually, you could scan it for a negative integer, and then insert a '--' argument before that, if needed, before passing it to getopt/optparse. Then you wouldn't have to worry about it on the command line. Cheers, Cliff On Thu, Sep 27, 2007 at 08:08:05PM

Re: ValueError: too many values to unpack,>>>

2007-09-27 Thread J. Clifford Dyer
On Thu, Sep 27, 2007 at 09:50:26PM +0200, Bruno Desthuilliers wrote regarding Re: ValueError: too many values to unpack,>>>: > > Shawn Minisall a ?crit : > > Fredrik Lundh wrote: > > > >> Shawn Minisall wrote: > >> > >> > >> > >>> Sorry, it looks like it's on the fourth line with the 3 values

Re: Select as dictionary...

2007-10-01 Thread J. Clifford Dyer
On Mon, Oct 01, 2007 at 06:32:07AM -0700, Besturk.Net Admin wrote regarding Select as dictionary...: > > aia.execute("SELECT id, w from list") > links=aia.fetchall() > print links > > and result > [(1, 5), (2,5)...] (2 million result) > > I want to see this result directly as a dictionary:

Re: Select as dictionary...

2007-10-01 Thread J. Clifford Dyer
On Mon, Oct 01, 2007 at 03:50:59PM +0200, Bruno Desthuilliers wrote regarding Re: Select as dictionary...: > > IIRC, postgres' db-api connector (well, at least one of them - I don't > know which one you're using) has a DictCursor. You should find all you > want to know in the relevant doc. >

Re: Select as dictionary...

2007-10-01 Thread J. Clifford Dyer
On Mon, Oct 01, 2007 at 10:12:04AM -0400, Carsten Haese wrote regarding Re: Select as dictionary...: > > On Mon, 2007-10-01 at 09:57 -0400, J. Clifford Dyer wrote: > > > > > Try this: > > > > aia.execute("SELECT id, w from list") > > links=ai

Re: problem with special built-in method __contains__,

2007-10-02 Thread J. Clifford Dyer
On Tue, Oct 02, 2007 at 11:14:38AM -, [EMAIL PROTECTED] wrote regarding problem with special built-in method __contains__,: > > if i have a dictionary name number and i want toask the list > whether a particular key already > exists. > > >>> print number > {'octal': '1234567', 'bi

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 wr

Re: RegEx question

2007-10-04 Thread J. Clifford Dyer
You *are* talking about python regular expressions, right? There are a number of different dialects. Also, there could be issues with the quoting method (are you using raw strings?) The more specific you can get, the more we can help you. Cheers, Cliff On Thu, Oct 04, 2007 at 11:54:32AM -05

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 res

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

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

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

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 > > > >

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" <

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 do

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: 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: > >

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 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. > > Spe

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 thin

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 mean

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 0

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

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: > >> &g

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

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

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:

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

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 w

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 looke

Re: Does eval has the same features as Perl's?

2007-01-22 Thread J. Clifford Dyer
The python editor won't "get exit." It will raise an exception. With or without an eval, you can catch the exception. try: x = 1/0 except ZeroDivisionError: x = "infinity" Jm lists wrote: > Hello members, > > I want to know does the "eval" in python have the same features as in > Perl

Re: Overloading assignment operator

2007-01-29 Thread J. Clifford Dyer
Steven D'Aprano wrote: > On Tue, 23 Jan 2007 18:07:55 -0800, Russ wrote: > >> Achim Domma wrote: >>> Hi, >>> >>> I want to use Python to script some formulas in my application. The user >>> should be able to write something like >>> >>> A = B * C >>> >>> where A,B,C are instances of some wrapper c

Re: Partial 1.0 - Partial classes for Python

2007-02-08 Thread J. Clifford Dyer
Martin v. Löwis wrote: > I'm happy to announce partial 1.0; a module to implement > partial classes in Python. It is available from > > http://cheeseshop.python.org/pypi/partial/1.0 > > A partial class is a fragment of a class definition; > partial classes allow to spread the definition of > a cl

Re: Vim scripting with python

2007-02-12 Thread J. Clifford Dyer
Stuart D. Gathman wrote: > On Sat, 03 Feb 2007 05:02:54 -0800, Tool69 wrote: > >> Does anyone have any advice, and more genraly how to script Vim with >> Python ? > > :py import sys > :py print sys.version > :help :py > >> I know I can put some python functions inside my vimrc file like >> this

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: 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, es

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: 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 na

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: 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, f

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 expecte

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 ov

[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: &g

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 > > """ >

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 al

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.compile('(\d

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

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, > >> cha

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 compar

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&#x

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

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" > if 0 > x: print "within" -- http://mail.python.org/mailman/listinfo/python-list

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

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 wi

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 (bu

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 f

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 na

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

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

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 develo

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 [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: 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

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 = [ [y.ls

  1   2   >