Re: http error 301 for urlopen

2010-11-07 Thread John Nagle
On 11/7/2010 5:51 PM, D'Arcy J.M. Cain wrote: On Sun, 7 Nov 2010 19:30:23 -0600 Wenhuan Yu wrote: I tried to open a link with urlopen: import urllib2 alink = " http://feeds.nytimes.com/click.phdo?i=ff074d9e3895247a31e8e5efa5253183"; f = urllib2.urlopen(alink) print f.read() and got the follow

Re: subclassing str

2010-11-07 Thread not1xor1 (Alessandro)
Il 07/11/2010 07:41, Chris Rebert wrote: You could subclass UserString instead of str; all of UserString's methods seem to ensure that instances of the subclass rather than just plain strs or UserStrings are returned. See http://docs.python.org/library/userdict.html#UserString.UserString I'll

Re: Making ActivePython and Python co-exist on Windows

2010-11-07 Thread CWC
On Nov 7, 12:34 pm, Benjamin Kaplan wrote: > ActivePython is the same thing as the "normal" Python. They just > bundle the standard Python 3.1.2 distribution with a couple of extra > packages in a convenient installer for you. Thanks, Ben! Based on your response, I decided to go ahead and instal

Re: functions, list, default parameters

2010-11-07 Thread alex23
m...@distorted.org.uk (Mark Wooding) wrote: > And the advantage of all of this typing over ['missing'] is what, > precisely? No chance of the sentinel object being accidentally mutated would be the big one for me, but clarity of intent would be a close second. -- http://mail.python.org/mailman/l

Re: http error 301 for urlopen

2010-11-07 Thread Nobody
On Sun, 07 Nov 2010 20:51:50 -0500, D'Arcy J.M. Cain wrote: >> urllib2.HTTPError: HTTP Error 301: The HTTP server returned a redirect error >> that would lead to an infinite loop. >> The last 30x error message was: >> Moved Permanently >> >> I can open the link in browser. Any way to get solve th

Re: Compare source code

2010-11-07 Thread Roy Smith
In article , Grant Edwards wrote: > It's getting really hard to find high-DPI displays on laptops any > more. 1600x1200 used to be available on 16" laptop displays, and that > looked great. Even my old 15" thinkpad at 1400x1050 wasn't bad. My 15" MacBook Pro is 1680 x 1050. -- http://mail.py

Re: http error 301 for urlopen

2010-11-07 Thread D'Arcy J.M. Cain
On Sun, 7 Nov 2010 19:30:23 -0600 Wenhuan Yu wrote: > I tried to open a link with urlopen: > > import urllib2 > alink = " > http://feeds.nytimes.com/click.phdo?i=ff074d9e3895247a31e8e5efa5253183"; > f = urllib2.urlopen(alink) > print f.read() > > and got the followinig error: > > urllib2.HTTPEr

Re: Cross compiling (i386 from amd64) with distutils

2010-11-07 Thread Jason
On Nov 8, 8:55 am, Jason wrote: > Do you know if virtualenv allows installing a Python environment with > a different architecture than that of the system Python install? I > suspect not, but maybe there's an option I don't know about. Found a better solution, which is to just compile Python from

http error 301 for urlopen

2010-11-07 Thread Wenhuan Yu
I tried to open a link with urlopen: import urllib2 alink = " http://feeds.nytimes.com/click.phdo?i=ff074d9e3895247a31e8e5efa5253183"; f = urllib2.urlopen(alink) print f.read() and got the followinig error: urllib2.HTTPError: HTTP Error 301: The HTTP server returned a redirect error tha t would

Re: ANN: PyQt v4.8.1 Released

2010-11-07 Thread Robert Kern
On 2010-11-07 18:53 , Lawrence D'Oliveiro wrote: In message, Robert Kern wrote: Everyone here knew exactly what he meant. But if you don’t banana the right tomato, everybody could be grapefruit, right? You know what I mean. And as I reiterated in the part that you snipped, he is not using

Re: Compare source code

2010-11-07 Thread Grant Edwards
On 2010-11-07, Steve Holden wrote: > On 11/7/2010 10:46 AM, Grant Edwards wrote: >> On 2010-11-07, Steve Holden wrote: >>> On 11/7/2010 8:23 AM, Grant Edwards wrote: >>> [...] (I bought 4:3 monitors before they got replaced by cheap 16:8 screens) >>> >>> I think you'll find the new aspe

Re: Cross compiling (i386 from amd64) with distutils

2010-11-07 Thread Jason
On Nov 8, 8:30 am, "Martin v. Loewis" wrote: > At a minimum, you should be using the target's python binary. distutils > has close-to-none cross-compiling support. Do you know if virtualenv allows installing a Python environment with a different architecture than that of the system Python install

Re: ANN: PyQt v4.8.1 Released

2010-11-07 Thread Lawrence D'Oliveiro
In message , Robert Kern wrote: > Everyone here knew exactly what he meant. But if you don’t banana the right tomato, everybody could be grapefruit, right? You know what I mean. -- http://mail.python.org/mailman/listinfo/python-list

Re: Silly newbie question - Caret character (^)

2010-11-07 Thread Lawrence D'Oliveiro
In message , Emile van Sebille wrote: > On 11/7/2010 2:26 AM Lawrence D'Oliveiro said... >> In message, Nobody wrote: >> >>> A reference manual tells you how to use the language. A specification >>> tells you how to implement it. >> >> Speaking as someone who has read more reference >> manuals/sp

Re: Cross compiling (i386 from amd64) with distutils

2010-11-07 Thread Martin v. Loewis
> So is it possible to get distutils to cross compile something like > this, and > if so, what am I missing? Or am I using the wrong tool for the job? At a minimum, you should be using the target's python binary. distutils has close-to-none cross-compiling support. You can solve some of the proble

Cross compiling (i386 from amd64) with distutils

2010-11-07 Thread Jason
My situation is this: I have a Diamond Systems single-board computer with a matching GPIO board. DS have a library for controlling the GPIO board... but it's a static library (libdscud-6.02.a) with an accompanying header (dscud.h). I'd like to create a Python extension to use the device. The archi

Re: Silly newbie question - Carrot character (^)

2010-11-07 Thread Philip Semanchuk
On Nov 6, 2010, at 10:45 AM, D'Arcy J.M. Cain wrote: > On Sat, 6 Nov 2010 10:22:47 -0400 > Philip Semanchuk wrote: >>> The tutorial isn't meant as an exhaustive lesson on every single Python >>> feature. >> >> I agree, and I don't expect otherwise. My point was that if the >> tutorial doesn't

Re: *** FBI gets a warm welcome in Chicago for their EXCELLENT performance - cheers to NEW CONS ***

2010-11-07 Thread small Pox
On Nov 2, 10:03 am, t...@sevak.isi.edu (Thomas A. Russ) wrote: > silver light writes: > > *** FBI gets a warm welcome in Chicago for their EXCELLENT performance > > - cheers to NEW CONS *** > > Oh geez.  Just when we've beaten back the infix hordes, someone comes up > and suggests replacing CONS w

Re: *** FBI gets a warm welcome in Chicago for their EXCELLENTperformance - cheers to NEW CONS ***

2010-11-07 Thread small Pox
*** FBI gets a warm welcome in Chicago for their EXCELLENT performance - cheers to NEW CONS *** http://www.youtube.com/watch?v=eq2ZvSd-z0M&feature=player_embedded&related http://www.youtube.com/watch?v=eq2ZvSd-z0M&feature=player_embedded&related http://www.youtube.com/watch?v=eq2ZvSd-z0M&feature

Re: { '0':'c->c->a' ,'1':'a->b->a' .........}

2010-11-07 Thread Peter Otten
chris wrote: > have anybody a hint , how i get a dict from non unique id's and their > different related values. > > Thanks for advance > Chris > > ###random data # > a=range(10)*3 > def seqelem(): > i=random.randint(0,2) > elem=['a','b','c'][i] > return elem > > s=[seqelem() for t i

Re: { '0':'c->c->a' ,'1':'a->b->a' .........}

2010-11-07 Thread Arnaud Delobelle
chris writes: > Hi, > > have anybody a hint , how i get a dict from non unique id's and their > different related values. > > Thanks for advance > Chris > > ###random data # > a=range(10)*3 > def seqelem(): > i=random.randint(0,2) > elem=['a','b','c'][i] > return elem > > s=[seqelem()

Re: { '0':'c->c->a' ,'1':'a->b->a' .........}

2010-11-07 Thread John Ladasky
Hi Chris, I may have time to look at the rest of your code later. For now I just want to comment on one line: On Nov 7, 12:24 pm, chris wrote: >     elem=['a','b','c'][i] The string type, just like the list type, is a sequence type. So strings have all the standard sequence methods. You coul

Re: Making ActivePython and Python co-exist on Windows

2010-11-07 Thread Benjamin Kaplan
On Sun, Nov 7, 2010 at 2:25 PM, CWC wrote: > I'm new to Python.  Is it possible to make ActivePython 3.12 and > Python 3.12 co-exist on Windows?  I've got an app which requires the > former, but I want to stay with the latter, since I'm interested in > getting into development.  The main area of c

{ '0':'c->c->a' ,'1':'a->b->a' .........}

2010-11-07 Thread chris
Hi, have anybody a hint , how i get a dict from non unique id's and their different related values. Thanks for advance Chris ###random data # a=range(10)*3 def seqelem(): i=random.randint(0,2) elem=['a','b','c'][i] return elem s=[seqelem() for t in range(30)] print zip(a,s) ## fav

Re: Compare source code

2010-11-07 Thread Seebs
On 2010-11-07, Ethan Furman wrote: > Seebs wrote: >> On 2010-11-05, Ethan Furman wrote: >>> The verifiable benefit for me is ease of use, ease of thought, ease of >>> typing... I realize these are not benefits for everyone, but they are >>> for some -- and I would venture a guess that the ease

Making ActivePython and Python co-exist on Windows

2010-11-07 Thread CWC
I'm new to Python. Is it possible to make ActivePython 3.12 and Python 3.12 co-exist on Windows? I've got an app which requires the former, but I want to stay with the latter, since I'm interested in getting into development. The main area of collision appears to be the Registry. -- http://mail

Re: A question about yield

2010-11-07 Thread Chris Rebert
On Sun, Nov 7, 2010 at 9:56 AM, chad wrote: > On Nov 7, 9:47 am, Chris Rebert wrote: >> On Sun, Nov 7, 2010 at 9:34 AM, chad wrote: >> >> > #!/usr/local/bin/python >> >> > import sys >> >> > def construct_set(data): >> >    for line in data: >> >        lines = line.splitlines() >> >        for

Re: Compare source code

2010-11-07 Thread Seebs
On 2010-11-07, Mark Wooding wrote: > I've no idea how people manage with these ridiculous widescreen monitors. Side space used for Other Stuff. It takes some reworking of the layout, but overall I sorta like it now. -s -- Copyright 2010, all wrongs reversed. Peter Seebach / usenet-nos...@seeb

Re: A question about yield

2010-11-07 Thread chad
On Nov 7, 9:47 am, Chris Rebert wrote: > On Sun, Nov 7, 2010 at 9:34 AM, chad wrote: > > > > > > > #!/usr/local/bin/python > > > import sys > > > def construct_set(data): > >    for line in data: > >        lines = line.splitlines() > >        for curline in lines: > >            if curline.stri

Re: Silly newbie question - Carrot character (^)

2010-11-07 Thread Seebs
On 2010-11-07, Roy Smith wrote: > Well, maybe I was being a little sarcastic. The real point was that if > you make it hard for people to do the right thing (i.e. look up the > details in the reference manual), you should not be surprised if they do > the wrong thing (i.e. find some way to mak

Re: Compare source code

2010-11-07 Thread Seebs
On 2010-11-07, Grant Edwards wrote: > On 2010-11-07, Lawrence D'Oliveiro wrote: >> In message <87sjzige0r@benfinney.id.au>, Ben Finney wrote: >>> The more general answer is: the block is explicitly ended where the >>> indentation ends. >> That's implicit, not explicit. > If you can _see_ it

Re: A question about yield

2010-11-07 Thread Chris Rebert
On Sun, Nov 7, 2010 at 9:34 AM, chad wrote: > #!/usr/local/bin/python > > import sys > > def construct_set(data): >    for line in data: >        lines = line.splitlines() >        for curline in lines: >            if curline.strip(): >                key = curline.split(' ') >                va

Re: A question about yield

2010-11-07 Thread chad
On Nov 7, 9:34 am, chad wrote: > I have an input file named 'freq' which contains the following data > > 123 0 > > 133 3 > 146 1 > 200 0 > 233 10 > 400 2 > > Now I've attempted to write a script that would take a number from the > standard input and then > have the program return the number in the

A question about yield

2010-11-07 Thread chad
I have an input file named 'freq' which contains the following data 123 0 133 3 146 1 200 0 233 10 400 2 Now I've attempted to write a script that would take a number from the standard input and then have the program return the number in the input file that is closest to that input file. #!/us

Re: python test frameworks

2010-11-07 Thread rustom
On Nov 7, 7:09 pm, Kev Dwyer wrote: > On Sun, 07 Nov 2010 10:56:46 +0530, Rustom Mody wrote: > > There are a large number of test frameworks in/for python.  Apart from > > what comes builtin with python there seems to be nose, staf, qmtest etc > > etc. > > > Is there any central place where these

Re: ANN: PyQt v4.8.1 Released

2010-11-07 Thread Robert Kern
On 2010-11-07 08:39 , Дамјан Георгиевски wrote: Given the context, "PyQt is available under the GPL and a commercial license," the commercial license Phil is talking about is not the GPL. Which is a wrong interpretation of “commercial”. But he is not interpreting either “commercial” or GPL.

Re: Compare source code

2010-11-07 Thread Steve Holden
On 11/7/2010 10:46 AM, Grant Edwards wrote: > On 2010-11-07, Steve Holden wrote: >> On 11/7/2010 8:23 AM, Grant Edwards wrote: >> [...] >>> (I bought 4:3 monitors before they got replaced by cheap 16:8 >>> screens) >> >> I think you'll find the new aspect ration is 16:9. > "aspect ration". Sheesh

Re: Compare source code

2010-11-07 Thread Ethan Furman
Lawrence D'Oliveiro wrote: In message , Tim Harig wrote: >> I personally prefer tabs as it lets *me* decide how far the apparent indentations are in the code. But they don’t. Other people can have different settings, and they will see different indentations for your code That's exactly the

Re: Compare source code

2010-11-07 Thread Ethan Furman
Seebs wrote: On 2010-11-05, Ethan Furman wrote: The verifiable benefit for me is ease of use, ease of thought, ease of typing... I realize these are not benefits for everyone, but they are for some -- and I would venture a guess that the ease of thought benefit is one of the primary reasons P

Re: Compare source code

2010-11-07 Thread Grant Edwards
On 2010-11-07, Steve Holden wrote: > On 11/7/2010 8:23 AM, Grant Edwards wrote: > [...] >> (I bought 4:3 monitors before they got replaced by cheap 16:8 >> screens) > > I think you'll find the new aspect ration is 16:9. I knew that. My keyboard didn't. I recently bought a close-out Lenovo T500

Re: Silly newbie question - Caret character (^)

2010-11-07 Thread Emile van Sebille
On 11/7/2010 2:26 AM Lawrence D'Oliveiro said... In message, Nobody wrote: A reference manual tells you how to use the language. A specification tells you how to implement it. Speaking as someone who has read more reference manuals/specifications/whatever you want to call them than I can coun

Re: Compare source code

2010-11-07 Thread Tim Chase
On 11/07/10 08:26, Steve Holden wrote: On 11/7/2010 8:23 AM, Grant Edwards wrote: [...] (I bought 4:3 monitors before they got replaced by cheap 16:8 screens) I think you'll find the new aspect ration is 16:9. Unless that's why they're cheap... dual-16x9-widescreen-in-portrait-mode-is-a-won

Re: Compare source code

2010-11-07 Thread Roy Smith
In article <87oca1b8ba.fsf@metalzone.distorted.org.uk>, m...@distorted.org.uk (Mark Wooding) wrote: > Vertical space is a limiting factor on how much code one can see at a > time. Yup. Over three decades of programming, my personal upper bound for how long a function should be has always b

Re: ANN: PyQt v4.8.1 Released

2010-11-07 Thread Дамјан Георгиевски
>> Given the context, "PyQt is available under the GPL and a commercial >> license," the commercial license Phil is talking about is not the >> GPL. > > Which is a wrong interpretation of “commercial”. But he is not interpreting either “commercial” or GPL. What he says is: here's the code for fr

Re: Compare source code

2010-11-07 Thread Steve Holden
On 11/7/2010 8:23 AM, Grant Edwards wrote: [...] > (I bought 4:3 monitors before they got replaced by cheap 16:8 > screens) I think you'll find the new aspect ration is 16:9. regards Steve -- Steve Holden +1 571 484 6266 +1 800 494 3119 PyCon 2011 Atlanta March 9-17 http://us.

Re: python test frameworks

2010-11-07 Thread Kev Dwyer
On Sun, 07 Nov 2010 10:56:46 +0530, Rustom Mody wrote: > There are a large number of test frameworks in/for python. Apart from > what comes builtin with python there seems to be nose, staf, qmtest etc > etc. > > Is there any central place where these are listed with short > descriptions? 'Test f

Re: Allowing comments after the line continuation backslash

2010-11-07 Thread Mark Wooding
Lawrence D'Oliveiro writes: > Not surprising, since the above list has become completely divorced from its > original purpose. Anybody remember what that was? It was supposed to be used > in a loop, as follows: > > for \ > Description, Attr, ColorList \ > in \ > ( >

Re: Silly newbie question - Carrot character (^)

2010-11-07 Thread Mark Wooding
Nobody writes: > You're taking "how" too literally, so let me rephrase that: > > A reference manual tells you what you need to know in order to use > the language. A specification tells you what you need to know in > order to implement it. I still don't see those as being different. A lan

Re: Compare source code

2010-11-07 Thread Grant Edwards
On 2010-11-07, Lawrence D'Oliveiro wrote: > In message <87sjzige0r@benfinney.id.au>, Ben Finney wrote: > >> Seebs writes: >> >>> On 2010-11-03, Steven D'Aprano >>> wrote: >>> Python does explicitly mark blocks. It does it by changes in indentation. An indent is an explicit start-b

Re: Compare source code

2010-11-07 Thread Grant Edwards
On 2010-11-07, Mark Wooding wrote: > Lawrence D'Oliveiro writes: > >> I would never do that. "Conserving vertical space" seems a stupid >> reason for doing it. > > Vertical space is a limiting factor on how much code one can see at a > time. And one study I read shoed that how much code one can

Re: Deditor 0.2.2

2010-11-07 Thread Kruptein
I also uploaded a video with sound because there were a lot of people that asked that. link: http://www.youtube.com/watch?v=zidKSPWBGxU -- http://mail.python.org/mailman/listinfo/python-list

Re: Compare source code

2010-11-07 Thread Mark Wooding
Lawrence D'Oliveiro writes: > I would never do that. “Conserving vertical space” seems a stupid reason for > doing it. Vertical space is a limiting factor on how much code one can see at a time. I use old-fashioned CRT monitors with 4x3 aspect ratios and dizzyingly high resolution; I usually w

Re: Silly newbie question - Carrot character (^)

2010-11-07 Thread Roy Smith
In article , Seebs wrote: > On 2010-11-07, Roy Smith wrote: > > Any self-respecting C++ programmer would have given > > up the scavenger hunt by now. Just kept throwing typecasts at your code > > until it compiles, and move on. > > That does not sound like a self-respecting programmer of an

Re: cms 4 static pages?

2010-11-07 Thread Lawrence D'Oliveiro
In message , Guido Stepken wrote: > a not database driven What do you mean by “database”? Even flat files can be “databases”. -- http://mail.python.org/mailman/listinfo/python-list

Re: Compare source code

2010-11-07 Thread Lawrence D'Oliveiro
In message <87sjzige0r@benfinney.id.au>, Ben Finney wrote: > Seebs writes: > >> On 2010-11-03, Steven D'Aprano >> wrote: >> >>> Python does explicitly mark blocks. It does it by changes in >>> indentation. An indent is an explicit start-block. An outdent is an >>> explicit end- block. There

Re: Compare source code

2010-11-07 Thread Lawrence D'Oliveiro
In message <8jftftfel...@mid.individual.net>, Neil Cerutti wrote: > The handsome ':' terminator of if/elif/if statements allows us to > omit a newline, conserving vertical space. This improves the > readability of certain constructs. > > if x: print(x) > elif y: print(y) > else: print() I would

Re: Compare source code

2010-11-07 Thread Lawrence D'Oliveiro
In message , Grant Edwards wrote: > But without the colon, how are people who write programming editors > going to know when to increase the indentation level as I enter code? I hate editors (or editing modes) that think they know when to change indentation level on me. Hate, hate, hate. -- htt

Re: Compare source code

2010-11-07 Thread Lawrence D'Oliveiro
In message , Tim Harig wrote: > I agree with Seebs, Python is the only language I know that promotes > the use of spaces over tabs; and there are equally picky syntaxs (ie, > Makefiles) that mandate the use of tabs. That’s widely conceded to be a misfeature of Make. > I personally prefer tabs as

Re: Silly newbie question - Caret character (^)

2010-11-07 Thread Lawrence D'Oliveiro
In message , Nobody wrote: > A reference manual tells you how to use the language. A specification > tells you how to implement it. Speaking as someone who has read more reference manuals/specifications/whatever you want to call them than I can count, I have never come across any such distincti

Re: execute shell script from python, needs sys.argv

2010-11-07 Thread Lawrence D'Oliveiro
In message <1vmbd65uaj2snq1v0vo49ktn0lsc2o5...@4ax.com>, Tim Roberts wrote: > I KNOW that we're still working on syntax here, and that it's too early > for optimization, but it bothers me to see "cat" as the first thing in a > pipeline. An anti-UUOC instinct. Very good. :) -- http://mail.python.

Re: Popen Question

2010-11-07 Thread moogyd
Hi, Thanks everyone for the replies - it is now clearer. Steven -- http://mail.python.org/mailman/listinfo/python-list

Re: Allowing comments after the line continuation backslash

2010-11-07 Thread Steven D'Aprano
On Sun, 07 Nov 2010 19:33:52 +1300, Lawrence D'Oliveiro wrote: > for \ > Description, Attr, ColorList \ > in \ > ( > ("normal", "image", MainWindow.ColorsNormalList), > ("highlighted", "highlight", > MainWindow.ColorsHighlightedList), ("s