Re: programming

2010-09-20 Thread Xavier Ho
On 20 September 2010 16:38, Jordan Blanton wrote: > Honestly, if I knew what was being said, then yes. I posted the directions > to the project and what I've done so far but I have no idea if what I'm > doing is right at all. > > Jordan, correct me if I'm mistaken, but you didn't post the directi

Re: newbie: class and __dict__ variable.

2010-09-20 Thread mafeusek
Terry, thank You very much for Your answer. Very helpfull! > Have you seen exactly this usage? NO, i just wrote an example, but the trick is quite frequent, thus it will be easy to check out the existence of .__setattr__ in such a case. best regards, Pawel -- http://mail.python.org/mailman/list

Re: [OT] Speed-reading [was Re: Too much code - slicing]

2010-09-20 Thread Seebs
On 2010-09-20, Steven D'Aprano wrote: > I don't know about how other people speed-read, but I can assure you that > when my wife speed-reads, she's not just scanning a few words and > interpolating between them. She can give you a detailed summary of what > *actually* happened, not just a good

Re: [OT] Syntax highlighting [was Re: Too much code - slicing]

2010-09-20 Thread Seebs
On 2010-09-20, Steven D'Aprano wrote: > On Sun, 19 Sep 2010 07:36:11 +, Seebs wrote: >> No, but the syntax should be invisible. When I read English, I don't >> have to think about nouns and verbs and such unless something is very >> badly written. > That's almost certainly because you've bee

Re: programming

2010-09-20 Thread Xavier Ho
Thanks Jordan. My reply will be in Blue. I apologise if this ever gets hard to read, but it's beginning to. On 20 September 2010 16:51, Jordan Blanton wrote: > "And so he started on a module that estimated the length of a sine wave. > Here is what he wrote: " > ok. what is a module? A Python

Re: Python and unicode

2010-09-20 Thread Goran Novosel
Can't believe I missed something as simple as u'smt', and I even saw that on many occasions... Thank you. -- http://mail.python.org/mailman/listinfo/python-list

Re: programming

2010-09-20 Thread Xavier Ho
Okay, it looks like you're doing well. I'm just going through your second email now, and it seems many of my comments in the first email is irrelavent to you anymore, because you already knew how to do it. =] Let's have a look. Again, my reply is in Blue. . *And what I've attempted to do so far.

Re: newbie: class and __dict__ variable.

2010-09-20 Thread Bruno Desthuilliers
Terry Reedy a écrit : On 9/19/2010 1:37 PM, [email protected] wrote: Hallo Group Members. From time to time I see in python code following notation that (as I believe) extends namespace of MyClass. No, it does not affect MyClass, just the instance dict. class MyClass: def __init__(sel

Re: Plz comment on this code

2010-09-20 Thread Lawrence D'Oliveiro
In message , Alex Willmer wrote: > On Sep 19, 12:20 pm, Lawrence D'Oliveiro central.gen.new_zealand> wrote: >> In message >> , Alex >> >> Willmer wrote: >> > # NB Constants are by convention ALL_CAPS >> >> SAYS_WHO? > > Says PEP 8: > > Constants > >Constants are usually declared on a

Re: Learning inheritance

2010-09-20 Thread Bruno Desthuilliers
alex23 a écrit : Python only actually executes a module the first time it's imported, Beware of multithreading and modules imported under different names... There can be issues with both in some web frameowrks. -- http://mail.python.org/mailman/listinfo/python-list

Re: Learning inheritance

2010-09-20 Thread Bruno Desthuilliers
Niklasro a écrit : Good to learn what I'm doing :-) since important being able to explain choices taken farther than "doing it because it works". I understand the concept of modules may not correspond to java programming where I come from. Coming from Java - and specially if you only have exper

Re: programming

2010-09-20 Thread Xavier Ho
On 20 September 2010 17:29, Xavier Ho wrote: > Secondly, that doesn't even compile. Nor does > > xDistance=eval(input("Distance to the stop sign (in feet): ")) > Just correcting myself here. It compiles, but generates an error when you give it a number, which still fails. Cheers, Xav -- http:/

announcing pycryptopp-0.5.20

2010-09-20 Thread Zooko O'Whielacronx
Folks: pycryptopp is a Python crypto library, so it could be considered an alternative to PyCrypto. However, pycryptopp offers very few algorithms. In fact, it only offers RSA, AES, and SHA-256. So if that's all you need, then great. I just released a new version of pycryptopp. http://tahoe-lafs.

Back on topic [was [OT] Syntax highlighting]

2010-09-20 Thread Steven D'Aprano
On Mon, 20 Sep 2010 07:02:23 +, Seebs wrote: > I'm > very new to Python, so I'm not 100% sure functions are a kind of an > object, but I seem to recall they were. Yes, functions are objects. *Everything* in Python is an object (apart from statements, but they're not actually *things* in Pyth

Encode HTML CDATA name token

2010-09-20 Thread Gregor Horvath
Hi, ID and NAME tokens must begin with a letter ([A-Za-z]) and may be followed by any number of letters, digits ([0-9]), hyphens ("-"), underscores ("_"), colons (":"), and periods ("."). [1] Is there a encoder / decoder in Python that can convert arbitrary text to and from this encoding in an re

Re: newbie: class and __dict__ variable.

2010-09-20 Thread Steven D'Aprano
On Mon, 20 Sep 2010 09:27:25 +0200, Bruno Desthuilliers wrote: >> If the class has a .__setattr__ method, the first bypasses that method, > > It also bypasses object.__setattribute__ and - as a consequence - any > binding descriptor by the same name as the attribute being set. __setattribute__ ?

Re: Plz comment on this code

2010-09-20 Thread Steven D'Aprano
On Mon, 20 Sep 2010 19:33:45 +1200, Lawrence D'Oliveiro wrote: > WHAT_IF_SOMETHING_IS_INITIALLY_CONSTANT,_BUT_LATER_BECOMES_A > _CONFIG_VARIABLE,_OR_VICE_VERSA,_DOES_IT_NEED_TO_CHANGE_ITS_NAME? If you want to be compliant with PEP 8, then yes. -- Steven -- http://mail.python.org/mailman/list

Re: Encode HTML CDATA name token

2010-09-20 Thread Steven D'Aprano
On Mon, 20 Sep 2010 10:45:46 +0200, Gregor Horvath wrote: > Hi, > > ID and NAME tokens must begin with a letter ([A-Za-z]) and may be > followed by any number of letters, digits ([0-9]), hyphens ("-"), > underscores ("_"), colons (":"), and periods ("."). [1] > > Is there a encoder / decoder in

Is "python -W ignore" the default?

2010-09-20 Thread rihad
$ mkdir foo $ python Python 2.7 (r27:82500, Sep 1 2010, 22:10:47) [GCC 4.2.1 20070719 [FreeBSD]] on freebsd7 Type "help", "copyright", "credits" or "license" for more information. >>> dir() ['__builtins__', '__doc__', '__name__', '__package__'] >>> import foo Traceback (most recent call last):

Re: Down with tinyurl! (was Re: importing excel data into a python matrix?)

2010-09-20 Thread Lawrence D'Oliveiro
In message , Philip Semanchuk wrote: > Some email systems still insert hard line breaks around the 72 or 80 > column mark and as a result long URLs get broken. That’s why content transfer encodings (quoted-printable, base64) are a standard part of MIME. -- http://mail.python.org/mailman/listi

Re: Python and unicode

2010-09-20 Thread Dotan Cohen
On Mon, Sep 20, 2010 at 05:42, Steven D'Aprano wrote: >> Use the PEP 263 encoding >> declaration http://www.python.org/dev/peps/pep-0263/> to let Python >> know the encoding of the program source file. > > While PEPs are valuable, once accepted or rejected they become historical > documents. They

Re: Encode HTML CDATA name token

2010-09-20 Thread Lawrence D'Oliveiro
In message <20100920104546.3699e...@valun>, Gregor Horvath wrote: > Is there a encoder / decoder in Python that can convert arbitrary text > to and from this encoding in an readable manner? Not sure if this is already in Python, but . -- http://mail.python.o

Re: Down with tinyurl! (was Re: importing excel data into a python matrix?)

2010-09-20 Thread Tim Harig
On 2010-09-20, Seebs wrote: > On 2010-09-20, Tim Harig wrote: >> 1. Don't bother to manually paste when you can use something like urlview >> to lauch directly. > > I don't know that this would actually be better than what I currently do, > which is grab text and middle-click in another wind

Re: newbie: class and __dict__ variable.

2010-09-20 Thread Bruno Desthuilliers
Steven D'Aprano a écrit : On Mon, 20 Sep 2010 09:27:25 +0200, Bruno Desthuilliers wrote: If the class has a .__setattr__ method, the first bypasses that method, It also bypasses object.__setattribute__ and - as a consequence - any binding descriptor by the same name as the attribute being set.

Re: Down with tinyurl! (was Re: importing excel data into a python matrix?)

2010-09-20 Thread Tim Harig
On 2010-09-20, Steven D'Aprano wrote: > On Mon, 20 Sep 2010 05:46:38 +, Tim Harig wrote: > >>> I'm not particularly convinced that these are *significant* complaints >>> about URL-shorteners. But I will say, of the last couple hundred links >>> I've followed from Usenet posts, precisely zero

Re: Down with tinyurl! (was Re: importing excel data into a python matrix?)

2010-09-20 Thread Tim Harig
On 2010-09-20, Tim Harig wrote: > On 2010-09-20, Seebs wrote: >> On 2010-09-20, Tim Harig wrote: >>> If you want this behavior by default, you can easily wrap urlview >>> to automatically add the prefix. >> >> True, but since my news reading is not on the machine my web browser is >> on,

Re: Python and unicode

2010-09-20 Thread Peter Otten
Dotan Cohen wrote: > On Mon, Sep 20, 2010 at 05:42, Steven D'Aprano > wrote: >>> Use the PEP 263 encoding >>> declaration http://www.python.org/dev/peps/pep-0263/> to let Python >>> know the encoding of the program source file. >> >> While PEPs are valuable, once accepted or rejected they become

Re: Encode HTML CDATA name token

2010-09-20 Thread Gregor Horvath
Am Mon, 20 Sep 2010 21:36:46 +1200 schrieb Lawrence D'Oliveiro : > In message <20100920104546.3699e...@valun>, Gregor Horvath wrote: > > > Is there a encoder / decoder in Python that can convert arbitrary > > text to and from this encoding in an readable manner? > > Not sure if this is already i

Re: Python and unicode

2010-09-20 Thread Dotan Cohen
On Mon, Sep 20, 2010 at 12:20, Peter Otten <[email protected]> wrote: > It may work by accident, if you declare it as UTF-8, because that is also > the default in Python 3. > That does seem to be the case. Thank you for the enlightenment and information. -- Dotan Cohen http://gibberish.co.il h

Overriding dict constructor

2010-09-20 Thread Steven D'Aprano
I have a dict subclass that associates extra data with each value of the key/value items: class MyDict(dict): def __setitem__(self, key, value): super(MyDict, self).__setitem__(key, (value, "extra_data")) def __getitem__(self, key): return super(MyDict, self).__getitem__(k

Python Monitoring

2010-09-20 Thread Glazner
Hi, I'm will be writing a distributed program with parallel python and i would like to if there are any good monitoring utilities for python. I would like each remote server to post messages and to see the messages in a web-broweser or such. I googled python monitoring and found pymon but it seem

Numpy on 2.7

2010-09-20 Thread Dirk Nachbar
I am trying to install Numpy on Python 2.7 but it only looks for 2.6 folder, how can I change that? Dirk -- http://mail.python.org/mailman/listinfo/python-list

Re: Overriding dict constructor

2010-09-20 Thread Duncan Booth
Steven D'Aprano wrote: > I have a dict subclass that associates extra data with each value of the > key/value items: > > class MyDict(dict): > def __setitem__(self, key, value): > super(MyDict, self).__setitem__(key, (value, "extra_data")) > def __getitem__(self, key): >

Re: Down with tinyurl!

2010-09-20 Thread John Bokma
Tim Harig writes: > I question first whether most tinyurl links are really of such an > intransient nature that they need to be long lasting. I personally use > them most when writing paper notes. They only need to last long enough > for me, or whoever I made the note for, to get back to them.

Re: Overriding dict constructor

2010-09-20 Thread Christian Heimes
Am 20.09.2010 13:11, schrieb Steven D'Aprano: > I have a dict subclass that associates extra data with each value of the > key/value items: [...] > How can I fix this? Since the dict class is crucial to the overall performance of Python, the dict class behaves bit different than other classes. I

Re: Too much code - slicing

2010-09-20 Thread John Bokma
Seebs writes: > On 2010-09-20, John Bokma wrote: >> I didn't mean that there are spoilers in the first 70 pages, just that >> to me the excercise would spoil the book, so, I wouldn't do it. I >> consider a book like a meal, I wouldn't gobble down food, regurgitate >> it, and eat it again at a sl

Re: Overriding dict constructor

2010-09-20 Thread Steven D'Aprano
On Mon, 20 Sep 2010 11:53:48 +, Duncan Booth wrote: > I was going to suggest overriding items() (or iteritems() for Python > 2.x), but while that is another hole that your values leak out it isn't > the hole used by the dict constructor. Yes, I already override items(), keys(), values(), thei

Re: [OT] Speed-reading

2010-09-20 Thread John Bokma
Steven D'Aprano writes: > spelling or grammatical errors and clumsy writing. *Especially* the > spelling errors, they have about the same effect on her reading speed as > a tree trunk lying across a Formula 1 race track. Spelling errors are a disaster, somehow they stand out like they use Comi

Re: Numpy on 2.7

2010-09-20 Thread Pekka Niiranen
On 9/20/10 2:36 PM, Dirk Nachbar wrote: I am trying to install Numpy on Python 2.7 but it only looks for 2.6 folder, how can I change that? Dirk http://sourceforge.net/projects/numpy/files/NumPy/1.5.0/numpy-1.5.0-win32-superpack-python2.7.exe/download -- http://mail.python.org/mailman/listinfo

Encoding problem - or bug in couchdb-0.8-py2.7.egg??

2010-09-20 Thread Ian Hobson
Hi all, I have hit a problem and I don't know enough about python to diagnose things further. Trying to use couchDB from Python. This script:- # coding=utf8 import couchdb from couchdb.client import Server server = Server() dbName = 'python-tests' try: db = server.create(dbName) except cou

elementwise multiplication of 2 lists of numbers

2010-09-20 Thread harryos
hi I have 2 lists of numbers,say x=[2,4,3,1] y=[5,9,10,6] I need to create another list containing z=[2*5, 4*9, 3*10, 1*6] ie =[10,36,30,6] I did not want to use numpy or any Array types.I tried to implement this in python .I tried the following z=[] for a,b in zip(x,y): z.append(a*b) Th

Re: develop for Windows on GNU/Linux, using Python

2010-09-20 Thread Default User
On Sun, Sep 19, 2010 at 14:31, J.O. Aho wrote: > Kev Dwyer wrote: > > On Sun, 19 Sep 2010 12:55:43 -0500, Default User wrote: > > > >> Consider: > >> > >> Can someone do development of programs for use on Windows systems, but > >> developed totally on a GNU/Linux system, using standard, contempor

Re: elementwise multiplication of 2 lists of numbers

2010-09-20 Thread Bruno Desthuilliers
harryos a écrit : hi I have 2 lists of numbers,say x=[2,4,3,1] y=[5,9,10,6] I need to create another list containing z=[2*5, 4*9, 3*10, 1*6] ie =[10,36,30,6] I did not want to use numpy or any Array types.I tried to implement this in python .I tried the following z=[] for a,b in zip(x,y):

Re: elementwise multiplication of 2 lists of numbers

2010-09-20 Thread Gary Herron
On 09/20/2010 07:02 AM, harryos wrote: hi I have 2 lists of numbers,say x=[2,4,3,1] y=[5,9,10,6] I need to create another list containing z=[2*5, 4*9, 3*10, 1*6] ie =[10,36,30,6] I did not want to use numpy or any Array types.I tried to implement this in python .I tried the following z=[] for

Re: elementwise multiplication of 2 lists of numbers

2010-09-20 Thread Giacomo Boffi
harryos writes: > hi > I have 2 lists of numbers,say > x=[2,4,3,1] > y=[5,9,10,6] > I need to create another list containing > z=[2*5, 4*9, 3*10, 1*6] ie =[10,36,30,6] > > I did not want to use numpy or any Array types.I tried to implement > this in python .I tried the following > > z=[] > for a

Re: elementwise multiplication of 2 lists of numbers

2010-09-20 Thread harryos
On Sep 20, 7:28 pm, Bruno wrote: >> A list comp comes to mind, as well as using itertools.izip thanks Bruno,thanks Gary.. Should have thought of list comprehension.. Thanks for the pointer about izip harry -- http://mail.python.org/mailman/listinfo/python-list

Re: Numpy on 2.7

2010-09-20 Thread Robert Kern
On 9/20/10 6:36 AM, Dirk Nachbar wrote: I am trying to install Numpy on Python 2.7 but it only looks for 2.6 folder, how can I change that? You should ask numpy questions on the numpy mailing list: http://www.scipy.org/Mailing_Lists -- Robert Kern "I have come to believe that the whole wor

Re: How to make a web services in python ???

2010-09-20 Thread Ariel
Soap web services I think. On Fri, Sep 17, 2010 at 5:35 PM, Hidura wrote: > What kind of web-service you have in mind > > 2010/9/17, Ariel : > > Hi everybody, I need some help to find documentation about how to > implements > > web services in python, could you help me please ??? > > Regards

Re: Overriding dict constructor

2010-09-20 Thread Hrvoje Niksic
Christian Heimes writes: > Am 20.09.2010 13:11, schrieb Steven D'Aprano: >> I have a dict subclass that associates extra data with each value of the >> key/value items: > [...] >> How can I fix this? > > Since the dict class is crucial to the overall performance of Python, > the dict class behav

catching WM_TIMER message

2010-09-20 Thread Greg Miller
I'm trying to get the following code converted to Python...and am stuck if(GetMessage(&msg.NULL,NULL,NULL)) { if(msg.message == WM_TIMER) { TranslateMEssage(&msg); DispatchMessage(&msg); } } I think GetMessage is a canned C or C++ function, and I'm not sure

Re: catching WM_TIMER message

2010-09-20 Thread Tim Golden
On 20/09/2010 16:15, Greg Miller wrote: I'm trying to get the following code converted to Python...and am stuck if(GetMessage(&msg.NULL,NULL,NULL)) { if(msg.message == WM_TIMER) { TranslateMEssage(&msg); DispatchMessage(&msg); } } I think GetMessage i

Re: Down with tinyurl! (was Re: importing excel data into a python matrix?)

2010-09-20 Thread Brian Victor
Tim Harig wrote: > Posting two URLs rather defeats the purpose of using a URL shortening > service in the first place; but, if that is what you feel is effective, > then by all means, do so. You are the master of your posts and you have > the right to post them using whatever methods and formating

Re: Encoding problem - or bug in couchdb-0.8-py2.7.egg??

2010-09-20 Thread Diez B. Roggisch
Ian Hobson writes: > Hi all, > > I have hit a problem and I don't know enough about python to diagnose > things further. Trying to use couchDB from Python. This script:- > > # coding=utf8 > import couchdb > from couchdb.client import Server > server = Server() > dbName = 'python-tests' > try: >

Re: Python Monitoring

2010-09-20 Thread Diez B. Roggisch
Glazner writes: > Hi, > > I'm will be writing a distributed program with parallel python and i > would like to if there are any good monitoring utilities for python. > I would like each remote server to post messages and to see the > messages in a web-broweser or such. > > I googled python monito

Re: elementwise multiplication of 2 lists of numbers

2010-09-20 Thread Arnaud Delobelle
On Sep 20, 3:02 pm, harryos wrote: > hi > I have 2 lists of numbers,say > x=[2,4,3,1] > y=[5,9,10,6] > I need to create another list containing > z=[2*5, 4*9, 3*10, 1*6]  ie =[10,36,30,6] > > I did not want to use numpy or any Array types.I tried to implement > this in python .I tried the followin

Re: elementwise multiplication of 2 lists of numbers

2010-09-20 Thread Peter Otten
harryos wrote: > I have 2 lists of numbers,say > x=[2,4,3,1] > y=[5,9,10,6] > I need to create another list containing > z=[2*5, 4*9, 3*10, 1*6] ie =[10,36,30,6] > > I did not want to use numpy or any Array types.I tried to implement > this in python .I tried the following > > z=[] > for a,b in

Re: catching WM_TIMER message

2010-09-20 Thread Greg Miller
On Sep 20, 11:30 am, Tim Golden wrote: > On 20/09/2010 16:15, Greg Miller wrote: > > > I'm trying to get the following code converted to Python...and am > > stuck > > > if(GetMessage(&msg.NULL,NULL,NULL)) > > { > >       if(msg.message == WM_TIMER) > >       { > >            TranslateMEssage(&

Re: How to make a web services in python ???

2010-09-20 Thread Simon Brunning
On 20 September 2010 16:09, Ariel wrote: > Soap web services I think. I think the cool kids would be using , but for the fact that the cool kids all build REST () rather than SOAP these days. -- Cheers, Simon B. -- http:

Re: develop for Windows on GNU/Linux, using Python

2010-09-20 Thread Thomas Jollans
On Monday 20 September 2010, it occurred to Default User to exclaim: > On Sun, Sep 19, 2010 at 14:31, J.O. Aho wrote: > > Kev Dwyer wrote: > > > if you have C-extensions in > > > your code you'll need to compile them over Windows. If you want to > > > program against the Windows API you'll need a

Re: Down with tinyurl! (was Re: importing excel data into a python matrix?)

2010-09-20 Thread Tim Harig
On 2010-09-20, Brian Victor wrote: > Tim Harig wrote: >> Posting two URLs rather defeats the purpose of using a URL shortening >> service in the first place; but, if that is what you feel is effective, >> then by all means, do so. You are the master of your posts and you have >> the right to post

Re: hitting TAB inserts ./ in interactive mode ?

2010-09-20 Thread Nik Krumm
On Sep 18, 11:28 am, Ned Deily wrote: > In article , >  Lawrence D'Oliveiro wrote: > > > In message , Ned Deily > > wrote: > > >     try: > > >         importreadline > > >     except ImportError: > > >         print("Modulereadlinenot available.") > > >     else: > > >         import rlcompleter

Re: catching WM_TIMER message

2010-09-20 Thread Tim Golden
On 20/09/2010 5:41 PM, Greg Miller wrote: Thank you for the assist! Quick question though, using the first example is there any need to register for WM_TIMER, ( instead of registering for WM_HOTKEY ), or is extracting the "home grown Windows message loop" enough and just run with that? In shor

Re: How to make a web services in python ???

2010-09-20 Thread Ian
On 20/09/2010 16:09, Ariel wrote: Soap web services I think. On Fri, Sep 17, 2010 at 5:35 PM, Hidura > wrote: What kind of web-service you have in mind 2010/9/17, Ariel mailto:[email protected]>>: > Hi everybody, I need some help to find documentati

Re: Too much code - slicing

2010-09-20 Thread Antoon Pardon
On Sun, Sep 19, 2010 at 11:30:32PM +, Seebs wrote: > On 2010-09-19, MRAB wrote: > > On 19/09/2010 22:32, Seebs wrote: > >> On 2010-09-19, AK wrote: > >>> Because that's what 'if' and 'else' mean. > > >> My point is, I don't want the order of the clauses in if/else to change. > >> If it is so

Re: Encoding problem - or bug in couchdb-0.8-py2.7.egg??

2010-09-20 Thread Ian
Thanks Diez, Removing, rebooting and installing the latest version solved the problem. :) Your google-foo is better than mine. Google had not turned that up for me. Thanks again Regards Ian On 20/09/2010 17:00, Diez B. Roggisch wrote: Ian Hobson writes: Hi all, I have hit a probl

Re: Python Monitoring

2010-09-20 Thread Glazner
On Sep 20, 6:03 pm, [email protected] (Diez B. Roggisch) wrote: > Glazner writes: > > Hi, > > > I'm will be writing a distributed program with parallel python and i > > would like to if there are any good monitoring utilities for python. > > I would like each remote server to post messages and to see t

Re: Down with tinyurl! (was Re: importing excel data into a python matrix?)

2010-09-20 Thread Seebs
On 2010-09-20, Tim Harig wrote: > You could simply place the filter in slrn; then, any urls that you see in > your reader would already be shown with the preview prefix suitable for cut > and paste mechanisms. If you wanted, you can even have your script > download the preview and automatically c

Re: Down with tinyurl! (was Re: importing excel data into a python matrix?)

2010-09-20 Thread Terry Reedy
On 9/19/2010 11:43 PM, Steven D'Aprano wrote: On Sun, 19 Sep 2010 06:16:49 -0700, Aahz wrote: Please don't use tinyurl -- it's opaque and provides zero help to anyone who might later want to look it up (and also no accessibility if tinyurl ever goes down). At the very least, include the origin

Re: newbie: class and __dict__ variable.

2010-09-20 Thread Terry Reedy
On 9/20/2010 5:51 AM, Bruno Desthuilliers wrote: Steven D'Aprano a écrit : On Mon, 20 Sep 2010 09:27:25 +0200, Bruno Desthuilliers wrote: If the class has a .__setattr__ method, the first bypasses that method, It also bypasses object.__setattribute__ and - as a consequence - any binding descr

Re: Too much code - slicing

2010-09-20 Thread Terry Reedy
On 09/19/2010 10:32 PM, John Bokma wrote: the spoiler. Do you fast forward movies as well? I sometimes watch movies (or parts thereof) on 1.5x, especially if it has a lot of 'filler' scenes. But only when my wife is not watching, as she hates it. -- Terry Jan Reedy -- http://mail.pytho

Re: Too much code - slicing

2010-09-20 Thread Seebs
On 2010-09-20, Antoon Pardon wrote: > Not necessarily. Some of us have the impression that Guido deliberatly > chose an ugly format for the ternary operator. Guido has alwasys been > against a ternary operator but the requests kept coming. So eventually > he introduced one. But the impression is t

match pattern

2010-09-20 Thread rudikk00
Hi all, I remember perl has a match function =~/H/ --> which searches if there is "H" pattern in line. Is there a reasonable analog of it in python? thanks! Alex -- http://mail.python.org/mailman/listinfo/python-list

Re: match pattern

2010-09-20 Thread Ian Kelly
On Mon, Sep 20, 2010 at 12:58 PM, rudikk00 wrote: > Hi all, > > I remember perl has a match function =~/H/ --> which searches if there > is "H" pattern in line. Is there a reasonable analog of it in python? > Yes, have a look at the re module in the standard library. If all you're interested in

Re: Too much code - slicing

2010-09-20 Thread Ian Kelly
On Mon, Sep 20, 2010 at 11:28 AM, Antoon Pardon < [email protected]> wrote: > > Not necessarily. Some of us have the impression that Guido deliberatly > chose an ugly format for the ternary operator. Guido has alwasys been > against a ternary operator but the requests kept coming. So ev

Re: Python and unicode

2010-09-20 Thread Martin v. Loewis
Am 20.09.2010 12:57, schrieb Dotan Cohen: > On Mon, Sep 20, 2010 at 12:20, Peter Otten <[email protected]> wrote: >> It may work by accident, if you declare it as UTF-8, because that is also >> the default in Python 3. >> > > That does seem to be the case. > > Thank you for the enlightenment and i

Re: match pattern

2010-09-20 Thread Diez B. Roggisch
rudikk00 writes: > I remember perl has a match function =~/H/ --> which searches if there > is "H" pattern in line. Is there a reasonable analog of it in python? It's called a regular expression, which can be matched or searched in a string. Take a look at the module "re" in python. http://d

Re: Python Monitoring

2010-09-20 Thread Diez B. Roggisch
Glazner writes: > On Sep 20, 6:03 pm, [email protected] (Diez B. Roggisch) wrote: >> Glazner writes: >> > Hi, >> >> > I'm will be writing a distributed program with parallel python and i >> > would like to if there are any good monitoring utilities for python. >> > I would like each remote server to

Combinations or Permutations

2010-09-20 Thread Seth Leija
I need to know how to generate a list of combinations/permutations (can't remember which it is). Say I have a list of variables: [a,b,c,d,...,x,y,z] I am curious if there is an optimized way to generate this: [[a,b],[a,c],[a,d],...,[x,z],[y,z]] I currently have an iteration that does this: #li

Re: visual studio 2010 question

2010-09-20 Thread Diez B. Roggisch
David Cournapeau writes: > On Mon, Sep 20, 2010 at 3:08 PM, Ralf Haring wrote: >> >> After running into the error "Setup script exited with error: Unable >> to find vcvarsall.bat" when trying to use easy_install / setuptools a >> little digging showed that the MS compiler files in distutils only

Re: sqlalchemy: how to define association object with declarative style?

2010-09-20 Thread Chris Withers
Hi Jerry, For SQLAlchemy questions, you're better off asking on [email protected]. On 07/09/2010 10:39, Jerry Fleming wrote: class GroupUser(DeclarativeBase, Tablename, TimestampMixin): id = Column(Integer, Sequence('group_user_id_seq'), primary_key=True) user = Column(Int

Re: os.path.normcase rationale?

2010-09-20 Thread Chris Withers
On 15/09/2010 22:12, Ben Finney wrote: Chris Withers writes: I'm curious as to why, with a file called "Foo.txt" os.path.normcase('FoO.txt') will return "foo.txt" rather than "Foo.txt"? What kind of answer are you looking for? A direct answer would be: it does that because on case-insensiti

Re: os.path.normcase rationale?

2010-09-20 Thread Chris Withers
On 16/09/2010 00:14, Gregory Ewing wrote: Ben Finney wrote: it doesn't matter what the case is, so there's no need for anything more complex than all lowercase. Also doing what was suggested would require looking at what's in the file system, which would be a lot of bother to go to for no good

Re: os.path.normcase rationale?

2010-09-20 Thread Chris Withers
On 17/09/2010 03:35, Nobody wrote: os.path.normcase(path) Normalize the case of a pathname. On Unix and Mac OS X, this returns the path unchanged; on case-insensitive filesystems, it converts the path to lowercase. On Windows, it also converts forward slashes to backward slash

Re: Combinations or Permutations

2010-09-20 Thread Chris Kaynor
The itertools module (http://docs.python.org/library/itertools.html) has both permutations and combinations functionality. Chris On Mon, Sep 20, 2010 at 1:54 PM, Seth Leija wrote: > I need to know how to generate a list of combinations/permutations > (can't remember which it is). Say I have a

Re: Combinations or Permutations

2010-09-20 Thread Ian Kelly
On Mon, Sep 20, 2010 at 2:54 PM, Seth Leija wrote: > I need to know how to generate a list of combinations/permutations > (can't remember which it is). Say I have a list of variables: > > [a,b,c,d,...,x,y,z] > > I am curious if there is an optimized way to generate this: > > [[a,b],[a,c],[a,d],..

Re: Too much code - slicing

2010-09-20 Thread Mark Lawrence
On 20/09/2010 18:28, Antoon Pardon wrote: On Sun, Sep 19, 2010 at 11:30:32PM +, Seebs wrote: On 2010-09-19, MRAB wrote: On 19/09/2010 22:32, Seebs wrote: On 2010-09-19, AK wrote: Because that's what 'if' and 'else' mean. My point is, I don't want the order of the clauses in if/else

Re: Combinations or Permutations

2010-09-20 Thread Mark Lawrence
On 20/09/2010 21:54, Seth Leija wrote: I need to know how to generate a list of combinations/permutations (can't remember which it is). Say I have a list of variables: [a,b,c,d,...,x,y,z] I am curious if there is an optimized way to generate this: [[a,b],[a,c],[a,d],...,[x,z],[y,z]] I current

Re: visual studio 2010 question

2010-09-20 Thread Robert Kern
On 9/20/10 3:54 PM, Diez B. Roggisch wrote: David Cournapeau writes: On Mon, Sep 20, 2010 at 3:08 PM, Ralf Haring wrote: After running into the error "Setup script exited with error: Unable to find vcvarsall.bat" when trying to use easy_install / setuptools a little digging showed that the

Grouping pairs - suggested tools

2010-09-20 Thread Astley Le Jasper
I have a list of tuples that indicate a relationship, ie a is related to b, b is related to c etc etc. What I want to do is cluster these relationships into groups. An item will only be associated with a single cluster. Before I started, I wondered if there was any particular tool within Python I

Re: hitting TAB inserts ./ in interactive mode ?

2010-09-20 Thread Ned Deily
In article <7b7f018e-b429-448b-94c1-2a812c5f3...@h37g2000pro.googlegroups.com>, Nik Krumm wrote: > The issue isn't with readline. The readline module or rlcompleter > module are both available, and loading them has no effect on the > behavior of tab: > > >>> import readline > [Now i hit tab...]

Re: Combinations or Permutations

2010-09-20 Thread Seth Leija
On Sep 20, 3:08 pm, Mark Lawrence wrote: > On 20/09/2010 21:54, Seth Leija wrote: > > > > > > > I need to know how to generate a list of combinations/permutations > > (can't remember which it is). Say I have a list of variables: > > > [a,b,c,d,...,x,y,z] > > > I am curious if there is an optimized

Arrays and CTYPE

2010-09-20 Thread Glenn Pringle
Ok. I ran into a problem here. I have been dabbling with Python and I thought that this would be a good exercise but I got stuck. I have a DLL and one of the functions(getState) in that DLL returns an array. I'm having a hard time getting access to the contents of that array. Python 2.7 (r27:825

Re: Arrays and CTYPE

2010-09-20 Thread Chris Rebert
On Mon, Sep 20, 2010 at 3:47 PM, Glenn Pringle wrote: > Ok. I ran into a problem here. I have been dabbling with Python and I > thought that this would be a good exercise but I got stuck. > > I have a DLL and one of the functions(getState) in that DLL returns an > array. I'm having a hard time get

Re: Grouping pairs - suggested tools

2010-09-20 Thread Alf P. Steinbach /Usenet
* Astley Le Jasper, on 20.09.2010 23:42: I have a list of tuples that indicate a relationship, ie a is related to b, b is related to c etc etc. What I want to do is cluster these relationships into groups. An item will only be associated with a single cluster. Before I started, I wondered if th

Re: develop for Windows on GNU/Linux, using Python

2010-09-20 Thread CM
On Sep 20, 12:46 pm, Thomas Jollans wrote: > On Monday 20 September 2010, it occurred to Default User to exclaim: > > > > > On Sun, Sep 19, 2010 at 14:31, J.O. Aho wrote: > > > Kev Dwyer wrote: > > > > if you have C-extensions in > > > > your code you'll need to compile them over Windows.  If you

Re: Combinations or Permutations

2010-09-20 Thread Dave Angel
On 2:59 PM, Seth Leija wrote: I need to know how to generate a list of combinations/permutations (can't remember which it is). Say I have a list of variables: [a,b,c,d,...,x,y,z] I am curious if there is an optimized way to generate this: [[a,b],[a,c],[a,d],...,[x,z],[y,z]] I currently have

Customising Tk widgets

2010-09-20 Thread Peter
I am using Windoze, I suspect the appearance attributes I am asking about here are platform dependent? Using Tkinter, I would like to generate a Checkbutton that is filled in with a solid colour rather than a tick mark when selected. Could somebody provide some pointers as to how I could achieve

Re: Grouping pairs - suggested tools

2010-09-20 Thread Ian Kelly
On Mon, Sep 20, 2010 at 5:09 PM, Alf P. Steinbach /Usenet < [email protected] >wrote: > It seems to be the same problem as "equivalence sets". > > This problem was solved early on because e.g. Fortran compilers had to > construct such sets (equivalence partitions of a set). > > I th

Re: os.path.normcase rationale?

2010-09-20 Thread Steven D'Aprano
On Mon, 20 Sep 2010 19:45:37 +0100, Chris Withers wrote: > Well, no, that doesn't feel right. Normalisation of case, for me, means > "give me the case as the filesystem thinks it should be", What do you mean "the filesystem"? If I look at the available devices on my system now, I see: 2 x FAT-

Re: Too much code - slicing

2010-09-20 Thread Steven D'Aprano
On Mon, 20 Sep 2010 19:28:49 +0200, Antoon Pardon wrote: > Not necessarily. Some of us have the impression that Guido deliberatly > chose an ugly format for the ternary operator. If he did, then he must have changed his mind, because there is nothing ugly about the ternary operator we ended up w

  1   2   >