Re: Python 3 minor irritation

2010-02-04 Thread David Monaghan
On Thu, 04 Feb 2010 00:39:01 +, David Monaghan wrote: >I have a small program which reads files from the directory in which it >resides. It's written in Python 3 and when run through IDLE or PythonWin >works fine. If I double-click the file, it works fine in Python 2.6, but in >3 it fails bec

Re: Your beloved python features

2010-02-04 Thread George Sakkis
On Feb 5, 2:45 am, "Bruce C. Baker" wrote: > "Terry Reedy" wrote in message > > news:mailman.1929.1265328905.28905.python-l...@python.org... > > > Iterators, and in particular, generators. > > A killer feature. > > > Terry Jan Reedy +1, iterators/generators is among Python's best features for m

Re: Your beloved python features

2010-02-04 Thread Paul Rubin
Julian writes: > I want to design a poster for an open source conference, the local > usergroup will have a table there, and in the past years there were > some people that came to the python-table just to ask "why should I > use python?". - Very easy to learn, at least for the not-too-hairy frag

Re: Your beloved python features

2010-02-04 Thread Xavier Ho
Personally, I love the fact that I can type in 2**25 in the intepreter without crashing my machine. ;) Cheers, -Xav -- http://mail.python.org/mailman/listinfo/python-list

Re: Your beloved python features

2010-02-04 Thread Arnaud Delobelle
On 4 Feb, 23:03, Julian wrote: > Hello, > > I've asked this question at stackoverflow a few weeks ago, and to make > it clear: this should NOT be a copy of the stackoverflow-thread > "hidden features of Python". > > I want to design a poster for an open source conference, the local > usergroup wil

Re: Common area of circles

2010-02-04 Thread John Nagle
Chris Rebert wrote: On Thu, Feb 4, 2010 at 2:39 AM, Shashwat Anand wrote: Given 'n' circles and the co-ordinates of their center, and the radius of all being equal i.e. 'one', How can I take out the intersection of their area. How is this at all specific to Python? This also sounds suspiciou

Re: Passing command line argument to program from within IDLE?

2010-02-04 Thread John Bokma
Tim Chase writes: > Gabriel Genellina wrote: >> En Thu, 04 Feb 2010 20:46:52 -0300, John Bokma >> >>> Oops, that should've been Steve, my apologies. >> >> See http://bugs.python.org/issue5680 > > Am I the only one that expected that issue to be about too many Steves > (and perhaps too many Tim

Re: Passing command line argument to program from within IDLE?

2010-02-04 Thread Steven D'Aprano
On Thu, 04 Feb 2010 19:36:19 -0600, Tim Chase wrote: > Gabriel Genellina wrote: >> En Thu, 04 Feb 2010 20:46:52 -0300, John Bokma >>> Oops, that should've been Steve, my apologies. >> >> See http://bugs.python.org/issue5680 > > > Am I the only one that expected that issue to be about too many

ANN: ActivePython 2.6.4.10 is now available

2010-02-04 Thread Sridhar Ratnakumar
I'm happy to announce that ActivePython 2.6.4.10 is now available for download from: http://www.activestate.com/activepython/ This is a minor release with several updates and fixes. Changes in 2.6.4.10 --- - PyPM is now included in 64-bit Windows and Linux builds - Include

Re: Passing parameters in URL

2010-02-04 Thread Alan Harris-Reid
Many thanks to all those who replied to my question and clearing-up the differences between GET and POST. I think I know what to do now - if not, I'll be back :-) Regards, Alan -- http://mail.python.org/mailman/listinfo/python-list

Re: equivalent of Ruby's Pathname?

2010-02-04 Thread Sean DiZazzo
On Feb 3, 6:08 pm, alex23 wrote: > On Feb 4, 8:47 am, Phlip wrote: > > > Yes, calling os.path.walk() and os.path.join() all the time on raw > > strings is fun, but I seem to recall from my Ruby days a class called > > Pathname, which presented an object that behaved like a string at > > need, and

Re: Your beloved python features

2010-02-04 Thread Sean DiZazzo
On Feb 4, 3:03 pm, Julian wrote: > Hello, > > I've asked this question at stackoverflow a few weeks ago, and to make > it clear: this should NOT be a copy of the stackoverflow-thread > "hidden features of Python". > > I want to design a poster for an open source conference, the local > usergroup w

Re: merge stdin, stdout?

2010-02-04 Thread exarkun
On 01:56 am, jonny.lowe.12...@gmail.com wrote: Hi everyone, Is there an easy way to merge stdin and stdout? For instance suppose I have script that prompts for a number and prints the number. If you execute this with redirection from a file say input.txt with 42 in the file, then executing ./my

Re: Problem with __init__.py in Python3.1

2010-02-04 Thread Hidura
Thanks i middle resolve the problem, and i going to read the PEP-366 i've been read the 328, i will kept informed of the progresses. Thanks again for the help [?] On Thu, Feb 4, 2010 at 6:47 PM, Ben Finney > wrote: > "Gabriel Genellina" writes: > > > If you directly run a script from inside a

Re: python admin abuse complaint

2010-02-04 Thread Steve Holden
Stephen Thorne wrote: > On Feb 5, 9:02 am, Steve Holden wrote: >>> • The list of ban'd person's names, the reason for banning, and the >>> name of admin who ban'd them, should be public. (irc already provides >>> means for this that allows admins to annotate in the ban list.) In >>> particular, if

Exiting a Program Running in Idle, Various Choices

2010-02-04 Thread W. eWatson
I I have a very simple program running in Python, with say the last line print "bye". it finishes leaving the script showing >>> in the shell window. The program proceeds linearly to the bottom line. Suppose now I have instead a few lines of MatPlotLib code (MPL) like this at the end: ... S

Re: python admin abuse complaint

2010-02-04 Thread Stephen Thorne
On Feb 5, 9:02 am, Steve Holden wrote: > > • The list of ban'd person's names, the reason for banning, and the > > name of admin who ban'd them, should be public. (irc already provides > > means for this that allows admins to annotate in the ban list.) In > > particular, if you are going to ban so

merge stdin, stdout?

2010-02-04 Thread jonny lowe
Hi everyone, Is there an easy way to merge stdin and stdout? For instance suppose I have script that prompts for a number and prints the number. If you execute this with redirection from a file say input.txt with 42 in the file, then executing ./myscript < input.txt > output.txt the output.txt m

Re: Passing command line argument to program from within IDLE?

2010-02-04 Thread Tim Chase
Gabriel Genellina wrote: En Thu, 04 Feb 2010 20:46:52 -0300, John Bokma Oops, that should've been Steve, my apologies. See http://bugs.python.org/issue5680 Am I the only one that expected that issue to be about too many Steves (and perhaps too many Tims) on c.l.p? :-) -tkc -- http:/

Re: python admin abuse complaint

2010-02-04 Thread Stephen Thorne
On Feb 5, 8:26 am, Xah Lee wrote: > I appreciate that you taking this more seriously than normal > newsgroups postings. In fact, for this complaint, the response you > made is all i asked for. > > I am taking this as seriously as all the articles you have posted to usenet. Stephen. -- http://m

Re: xmlrpc slow in windows 7 if hostnames are used

2010-02-04 Thread Gabriel Genellina
En Thu, 04 Feb 2010 19:34:20 -0300, News123 escribió: I wrote a small xmlrpc client on Windows 7 with python 2.6 srv = xmlrpclib.Server('http://localhost:80') I was able to perform about 1 rpc call per second After changing to srv = xmlrpclib.Server('http://127.0.0.1:80') I was able to per

Re: Python 3 minor irritation

2010-02-04 Thread Gib Bogle
Gabriel Genellina wrote: Sorry, I should have removed that line. This is just my setup; a normal Python install doesn't create that registry entry. It allows Desktop Search (or Windows Search, or whatever it is called nowadays; the F3 key) to search inside .py files (default behavior is to jus

Re: Passing command line argument to program from within IDLE?

2010-02-04 Thread Steve Holden
Gabriel Genellina wrote: > En Thu, 04 Feb 2010 20:46:52 -0300, John Bokma > escribió: >> John Bokma writes: > >> On 2/4/2010 3:55 PM, Alan Biddle wrote: >>> Just finishing my first Python (2.6 on Win XP) program, which is >>> working fine. My "Duh?" question is about how to run it

Re: Wrap a function

2010-02-04 Thread Aahz
In article , Dennis Lee Bieber wrote: >On 3 Feb 2010 08:38:47 -0800, a...@pythoncraft.com (Aahz) declaimed the >following in gmane.comp.python.general: >> In article , >> Dennis Lee Bieber wrote: >>> >>> I shall blaspheme, and suggest that maybe the language you want to >>>use is REXX (ooRE

Re: Your beloved python features

2010-02-04 Thread Terry Reedy
Iterators, and in particular, generators. A killer feature. Terry Jan Reedy -- http://mail.python.org/mailman/listinfo/python-list

Re: Passing command line argument to program from within IDLE?

2010-02-04 Thread Terry Reedy
On 2/4/2010 6:29 PM, Steve Holden wrote: Steven D'Aprano wrote: On Thu, 04 Feb 2010 16:28:17 -0500, Steve Holden wrote: Terry Reedy wrote: On 2/4/2010 3:55 PM, Alan Biddle wrote: Just finishing my first Python (2.6 on Win XP) program, which is working fine. My "Duh?" question is about how

Re: Code snippet: dualmethod descriptor

2010-02-04 Thread Steven D'Aprano
On Thu, 04 Feb 2010 00:09:02 -0300, Gabriel Genellina wrote: > En Sat, 30 Jan 2010 03:06:18 -0300, Steven D'Aprano > escribió: > >> class dualmethod(object): [...] > Seems useful! > Perhaps a better place to post it would be > , at least it's >

Re: Passing command line argument to program from within IDLE?

2010-02-04 Thread Gabriel Genellina
En Thu, 04 Feb 2010 20:46:52 -0300, John Bokma escribió: John Bokma writes: On 2/4/2010 3:55 PM, Alan Biddle wrote: Just finishing my first Python (2.6 on Win XP) program, which is working fine. My "Duh?" question is about how to run it from within IDLE and pass it command line arguments

Re: Python 3 minor irritation

2010-02-04 Thread Gabriel Genellina
En Thu, 04 Feb 2010 17:50:29 -0300, Gib Bogle escribió: Gabriel Genellina wrote: Also, from the command line, execute: D:\temp>reg query HKCR\.py ! REG.EXE VERSION 3.0 HKEY_CLASSES_ROOT\.py REG_SZ Python.File Content TypeREG_SZ text/plain HKEY_CLASSES_ROOT\.py\

Re: Passing command line argument to program from within IDLE?

2010-02-04 Thread John Bokma
John Bokma writes: > Steven D'Aprano writes: > >> On Thu, 04 Feb 2010 16:28:17 -0500, Steve Holden wrote: >> >>> Terry Reedy wrote: On 2/4/2010 3:55 PM, Alan Biddle wrote: > Just finishing my first Python (2.6 on Win XP) program, which is > working fine. My "Duh?" question is abou

Re: Passing command line argument to program from within IDLE?

2010-02-04 Thread John Bokma
Steven D'Aprano writes: > On Thu, 04 Feb 2010 16:28:17 -0500, Steve Holden wrote: > >> Terry Reedy wrote: >>> On 2/4/2010 3:55 PM, Alan Biddle wrote: Just finishing my first Python (2.6 on Win XP) program, which is working fine. My "Duh?" question is about how to run it from within >>

Re: Your beloved python features

2010-02-04 Thread Paul Rubin
Julian writes: > I want to design a poster for an open source conference, the local > usergroup will have a table there, and in the past years there were > some people that came to the python-table just to ask "why should I > use python?". It's terrible, but all the alternatives are even worse. ;

Re: Passing command line argument to program from within IDLE?

2010-02-04 Thread Steve Holden
Steven D'Aprano wrote: > On Thu, 04 Feb 2010 16:28:17 -0500, Steve Holden wrote: > >> Terry Reedy wrote: >>> On 2/4/2010 3:55 PM, Alan Biddle wrote: Just finishing my first Python (2.6 on Win XP) program, which is working fine. My "Duh?" question is about how to run it from within

Re: Your beloved python features

2010-02-04 Thread R Fritz
My favorite feature is its readability. It's as near to pseudo-code as any language we have, and that's valuable in open source projects or when I return to code to modify it. -- http://mail.python.org/mailman/listinfo/python-list

Re: Passing command line argument to program from within IDLE?

2010-02-04 Thread Steven D'Aprano
On Thu, 04 Feb 2010 16:28:17 -0500, Steve Holden wrote: > Terry Reedy wrote: >> On 2/4/2010 3:55 PM, Alan Biddle wrote: >>> Just finishing my first Python (2.6 on Win XP) program, which is >>> working fine. My "Duh?" question is about how to run it from within >>> IDLE and pass it command line a

Your beloved python features

2010-02-04 Thread Julian
Hello, I've asked this question at stackoverflow a few weeks ago, and to make it clear: this should NOT be a copy of the stackoverflow-thread "hidden features of Python". I want to design a poster for an open source conference, the local usergroup will have a table there, and in the past years th

Re: python admin abuse complaint

2010-02-04 Thread Steve Holden
Xah Lee wrote: > 2010-02-04 > > Hi Steve, > > thank you for the reply. > > I appreciate that you taking this more seriously than normal > newsgroups postings. In fact, for this complaint, the response you > made is all i asked for. > OK, in that case I won't trouble anyone else about it. > I h

Re: PyQt4 designer custom properties - combo box style

2010-02-04 Thread David Boddie
On Tuesday 02 February 2010 22:25, Andrew wrote: > I am creating custom widgets for the PyQt4 Designer. I can create > custom properties, but I'm looking for how to create a custom property > that has a combo box drop down. I've seen them in the example widgets > and tried following them, but they

Pixel control

2010-02-04 Thread joao abrantes
Hello everyone. For example i am using a screen resolution of 800x600 is it possible to make python control the color of the pixels? For example paint the pixel (100,200) in red! And it would stay red when i am seeing a webpage, a movie, playing a game... etc.. Regards, João Abrantes. -- http://ma

Re: Python and Ruby

2010-02-04 Thread Robert Kern
On 2010-02-04 14:55 PM, Jonathan Gardner wrote: On Feb 3, 3:39 pm, Steve Holden wrote: Robert Kern wrote: On 2010-02-03 15:32 PM, Jonathan Gardner wrote: I can explain all of Python in an hour; I doubt anyone will understand all of Python in an hour. With all respect, talking about a sub

Re: Background Zones in Pylab Plot

2010-02-04 Thread Wanderer
On Feb 3, 10:50 pm, CM wrote: > On Feb 3, 10:49 am, Wanderer wrote: > > > I would like to add background zones in pylab plots. Colored sections > > of the background that the curves pass through. Is this possible? My > > google searches don't turn up anything but maybe my search terms > > aren't

Re: Problem with __init__.py in Python3.1

2010-02-04 Thread Ben Finney
"Gabriel Genellina" writes: > If you directly run a script from inside a package, Python does not > know that it belongs to a package, and treats it as a simple, lonely > script. In that case, relative imports won't work. Which I consider to be a bug. Fortunately, it's already addressed in PEP 3

xmlrpc slow in windows 7 if hostnames are used

2010-02-04 Thread News123
Hi, I wrote a small xmlrpc client on Windows 7 with python 2.6 srv = xmlrpclib.Server('http://localhost:80') I was able to perform about 1 rpc call per second After changing to srv = xmlrpclib.Server('http://127.0.0.1:80') I was able to perform about 10 to 16 rpc calls per second. So it seem

Re: python admin abuse complaint

2010-02-04 Thread Xah Lee
2010-02-04 Hi Steve, thank you for the reply. I appreciate that you taking this more seriously than normal newsgroups postings. In fact, for this complaint, the response you made is all i asked for. I have a lot things to say about the various political struggle that one sees everyday in just a

Re: Passing command line argument to program from within IDLE?

2010-02-04 Thread Steve Holden
Terry Reedy wrote: > On 2/4/2010 3:55 PM, Alan Biddle wrote: >> Just finishing my first Python (2.6 on Win XP) program, which is >> working fine. My "Duh?" question is about how to run it from within >> IDLE and pass it command line arguments. No problem using sys.argv >> from a Windows command

Re: YAML

2010-02-04 Thread John Bokma
Steven D'Aprano writes: > However, be aware that neither marshal nor pickle guarantees to be safe > against malicious data either. The docs for both warn against using them > on untrusted data. YAML or JSON *might* be safer, I haven't looked. Regarding malicious data, from the Loading YAML sec

Re: Passing command line argument to program from within IDLE?

2010-02-04 Thread Terry Reedy
On 2/4/2010 3:55 PM, Alan Biddle wrote: Just finishing my first Python (2.6 on Win XP) program, which is working fine. My "Duh?" question is about how to run it from within IDLE and pass it command line arguments. No problem using sys.argv from a Windows command line, but I have missed how you

Re: YAML (was: Python and Ruby)

2010-02-04 Thread Steven D'Aprano
On Thu, 04 Feb 2010 09:57:59 -0500, Lou Pecora wrote: > Well, that looks a bit more complicated than I would like, but maybe > it's doing more stuff than I can grok. Here's what I needed and how I > did it in Python: [...] > # Reading same list in: > instr=fp.readline() > inlist=eval(instr) > x1,

Re: Python and Ruby

2010-02-04 Thread Jonathan Gardner
On Feb 3, 3:39 pm, Steve Holden wrote: > Robert Kern wrote: > > On 2010-02-03 15:32 PM, Jonathan Gardner wrote: > > >> I can explain all of Python in an hour; I doubt anyone will understand > >> all of Python in an hour. > > > With all respect, talking about a subject without a reasonable chance o

Passing command line argument to program from within IDLE?

2010-02-04 Thread Alan Biddle
Just finishing my first Python (2.6 on Win XP) program, which is working fine. My "Duh?" question is about how to run it from within IDLE and pass it command line arguments. No problem using sys.argv from a Windows command line, but I have missed how you can do that from within IDLE, which compl

Re: Python 3 minor irritation

2010-02-04 Thread Gib Bogle
Gabriel Genellina wrote: But the associated program might change the current directory - that's not the case with the default associations created by the Python installer, but one should verify this. To the OP: please create this small test script import os print("curdir=", os.getcwd()) print(

Re: Python and Ruby

2010-02-04 Thread John Bokma
Marius Gedminas writes: > On Feb 4, 1:03 am, John Bokma wrote: >> Jonathan Gardner writes: >> > I can explain all of Python in an hour; >> >> OK, in that case I would say give it a go. Put it on YouTube, or write a >> blog post about it (or post it here). I am sure you will help a lot of >> peo

Re: how to run part of my python code as root

2010-02-04 Thread sjdevn...@yahoo.com
On Feb 4, 2:05 pm, Tomas Pelka wrote: > -BEGIN PGP SIGNED MESSAGE- > Hash: SHA1 > > Hey, > > is there possibility how to run part of my code (function for example) > as superuser. > > Or only way how to do this is create a wrapper and run is with Popen > through sudo (but I have to configu

Re: Selenium/SauceLabs OpenSpace at Pycon

2010-02-04 Thread Paul Rubin
a...@pythoncraft.com (Aahz) writes: > Raymond Hettinger wrote: >>For those who are interested, the Sauce Labs team, >>http://saucelabs.com/about/team, is hosting two free tutorial open >>space sessions at Pycon in Atlanta. > > Congrats on the new job! Yes, cool! I don't recognize several of the

Re: Problem with __init__.py in Python3.1

2010-02-04 Thread Gabriel Genellina
En Thu, 04 Feb 2010 12:40:41 -0300, Hidura escribió: Thanks, I read it and try to put my code in the correct form, but now give me another error, inside the Writer Package says: "ValueError: Attempted relative import in non-package", if somebody knows a clue of how fix it i will glad to re

Re: Common area of circles

2010-02-04 Thread Shashwat Anand
maximum number of circles = 10**6 runtime <= 5 sec center of circles , -1000<=xi,yi<=1000 (float) [for int it was easier] intersection is there and the area will be non-zero (it can always be checked if intersection is taking place and if no, then area = 0.00) This was a programming contest pro

how to run part of my python code as root

2010-02-04 Thread Tomas Pelka
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 Hey, is there possibility how to run part of my code (function for example) as superuser. Or only way how to do this is create a wrapper and run is with Popen through sudo (but I have to configure sudo to run "whole" python as root). Thanks for advi

Re: Common area of circles

2010-02-04 Thread Mark Dickinson
On 2/4/2010 7:05 AM, Shashwat Anand wrote: > I want to calculate areas. > like for two circles (0, 0) and (0, 1) : the output is '1.228370' > > similarly my aim is to take 'n' co-ordinates, all of radius '1' and > calculate the area common to all. > The best I got was monte-carlo methods which is i

Re: Selenium/SauceLabs OpenSpace at Pycon

2010-02-04 Thread Raymond Hettinger
> >For those who are interested, the Sauce Labs team, > >http://saucelabs.com/about/team, is hosting two free tutorial open > >space sessions at Pycon in Atlanta. [Aahz] > Congrats on the new job! Thanks. I'm really enjoying working with Jim Baker and Frank Wierzbicki. Raymond -- http://mail

Re: Passing parameters in URL

2010-02-04 Thread Diez B. Roggisch
Am 04.02.10 18:22, schrieb John Bokma: "Diez B. Roggisch" writes: Am 04.02.10 01:42, schrieb John Bokma: [..] Maybe you should think about what happens if someone posts: http://example.com/item_delete?id=123";> to a popular forum... And the difference to posting from urrlib2 import op

Re: YAML

2010-02-04 Thread John Bokma
Lou Pecora writes: > In article <87eil1ddjp.fsf...@castleamber.com>, > John Bokma wrote: > >> Lou Pecora writes: >> >> > That's a pretty accurate description of how I transitioned to Python >> > from C and Fortran. >> >> Not C, but C++ (but there are also C implementations): YAML, see: >> h

Re: Python and Ruby

2010-02-04 Thread John Bokma
Marius Gedminas writes: > On Feb 4, 1:03 am, John Bokma wrote: >> Jonathan Gardner writes: >> > I can explain all of Python in an hour; >> >> OK, in that case I would say give it a go. Put it on YouTube, or write a >> blog post about it (or post it here). I am sure you will help a lot of >> peo

Re: Common area of circles

2010-02-04 Thread Dave Angel
Shashwat Anand wrote: I want to calculate areas. like for two circles (0, 0) and (0, 1) : the output is '1.228370' similarly my aim is to take 'n' co-ordinates, all of radius '1' and calculate the area common to all. The best I got was monte-carlo methods which is inefficient. Is there any other

Re: Common area of circles

2010-02-04 Thread Gerard Flanagan
Gary Herron wrote: Gerard Flanagan wrote: A brute force approach - create a grid of small squares and calculate which squares are in all circles. I don't know whether it is any better than monte-carlo: That's just what the monte-carlo method is -- except the full family of monte-carlo met

Re: Passing parameters in URL

2010-02-04 Thread John Bokma
"Diez B. Roggisch" writes: > Am 04.02.10 01:42, schrieb John Bokma: [..] >> Maybe you should think about what happens if someone posts: >> http://example.com/item_delete?id=123";> to a popular forum... > > And the difference to posting > > from urrlib2 import open > from urllib import encode >

Re: read a process output with subprocess.Popen

2010-02-04 Thread Nobody
On Thu, 04 Feb 2010 04:28:20 -0800, Ashok Prabhu wrote: > I m trying a read the output of a process which is running > continuously with subprocess.Popen. However the readline() method > hangs for the process to finish. Please let me know if the following > code can be made to work with subprocess

Re: Refreshing of urllib.urlopen()

2010-02-04 Thread Nobody
On Wed, 03 Feb 2010 21:33:08 -0600, Michael Gruenstaeudl wrote: > I am fairly new to Python and need advice on the urllib.urlopen() > function. The website I am trying to open automatically refreshes > after 5 seconds and remains stable thereafter. With > urllib.urlopen().read() I can only r

Re: Common area of circles

2010-02-04 Thread Gary Herron
Gerard Flanagan wrote: On 2/4/2010 7:05 AM, Shashwat Anand wrote: I want to calculate areas. like for two circles (0, 0) and (0, 1) : the output is '1.228370' similarly my aim is to take 'n' co-ordinates, all of radius '1' and calculate the area common

Re: Repeat an exception

2010-02-04 Thread Stephen Hansen
On Thu, Feb 4, 2010 at 4:59 AM, Jean-Michel Pichavant < jeanmic...@sequans.com> wrote: > What the hell is this 'for else' loop !! :D First time I see this statement > for years. > I'd never thought I'd still learn something that basic. > Its one of the least used constructs in Python, I think, an

Re: Repeat an exception

2010-02-04 Thread MRAB
Jean-Michel Pichavant wrote: MRAB wrote: In other words: for attempt in range(2): try: spanish_field = translate(english_field, lang_to='es', lang_from='en') break except TranslationError: pass else: # Didn't break out of the loop, therefore not successful.

Re: Common area of circles

2010-02-04 Thread Gerard Flanagan
On 2/4/2010 7:05 AM, Shashwat Anand wrote: I want to calculate areas. like for two circles (0, 0) and (0, 1) : the output is '1.228370' similarly my aim is to take 'n' co-ordinates, all of radius '1' and calculate the area common to all. The best I g

Re: Problem with __init__.py in Python3.1

2010-02-04 Thread Hidura
Thanks, I read it and try to put my code in the correct form, but now give me another error, inside the Writer Package says: "ValueError: Attempted relative import in non-package", if somebody knows a clue of how fix it i will glad to read opinions. [?] On Thu, Feb 4, 2010 at 2:11 AM, Gabriel Gene

Re: Python and Ruby

2010-02-04 Thread Lou Pecora
In article <7x8wb9j4r2@ruckus.brouhaha.com>, Paul Rubin wrote: > Lou Pecora writes: > > after much noodling around and reading it hit me that I could just put > > all that output of different types of variables into a list, hit it > > with a repr() function to get a string version, and writ

Re: YAML (was: Python and Ruby)

2010-02-04 Thread Lou Pecora
In article <87eil1ddjp.fsf...@castleamber.com>, John Bokma wrote: > Lou Pecora writes: > > > That's a pretty accurate description of how I transitioned to Python > > from C and Fortran. > > Not C, but C++ (but there are also C implementations): YAML, see: > http://code.google.com/p/yaml-cpp/

Re: Common area of circles

2010-02-04 Thread Shashwat Anand
thanks, all of you On Thu, Feb 4, 2010 at 7:31 PM, Terry Reedy wrote: > On 2/4/2010 7:05 AM, Shashwat Anand wrote: > >> I want to calculate areas. >> like for two circles (0, 0) and (0, 1) : the output is '1.228370' >> >> similarly my aim is to take 'n' co-ordinates, all of radius '1' and >> cal

Re: Common area of circles

2010-02-04 Thread Terry Reedy
On 2/4/2010 7:05 AM, Shashwat Anand wrote: I want to calculate areas. like for two circles (0, 0) and (0, 1) : the output is '1.228370' similarly my aim is to take 'n' co-ordinates, all of radius '1' and calculate the area common to all. The best I got was monte-carlo methods which is inefficien

Re: Common area of circles

2010-02-04 Thread Xavier Ho
It's an interesting problem. Never thought it was this difficult. I can't account for all geometrical enumerations, but assuming all 4 circles intersect, here's the solution for this particular senario. It's probably not going to be useful to you since you're working on geometrical approximations n

Re: Building a multiline string

2010-02-04 Thread Marco Mariani
On 02/04/2010 12:34 PM, lallous wrote: > Now should I be using method 2 or 3 in production code? Another way... depending on what you are using the string for, of course. If it's an HTML/XML/SQL/whatever piece of code: from textwrap import dedent sql = dedent(""" > ... SEL

Re: Repeat an exception

2010-02-04 Thread Jean-Michel Pichavant
MRAB wrote: In other words: for attempt in range(2): try: spanish_field = translate(english_field, lang_to='es', lang_from='en') break except TranslationError: pass else: # Didn't break out of the loop, therefore not successful. print "Translation failed

Re: Building a multiline string

2010-02-04 Thread Steve Holden
lallous wrote: > Hello > > Maybe that's already documented, but it seems the parser accepts to > build a long string w/o really using the first method: > > # Method1 > x = "line1" + \ # cannot use comments! > "line2"+ \ > "line3" > > and instead using a list with one element like this: > > # Me

Re: Python and Ruby

2010-02-04 Thread Marius Gedminas
On Feb 4, 1:03 am, John Bokma wrote: > Jonathan Gardner writes: > > I can explain all of Python in an hour; > > OK, in that case I would say give it a go. Put it on YouTube, or write a > blog post about it (or post it here). I am sure you will help a lot of > people that way. Someone already did

read a process output with subprocess.Popen

2010-02-04 Thread Ashok Prabhu
Hi, I m trying a read the output of a process which is running continuously with subprocess.Popen. However the readline() method hangs for the process to finish. Please let me know if the following code can be made to work with subprocess.Popen with threads or queues. I tried a lot of methods but

Re: Common area of circles

2010-02-04 Thread Shashwat Anand
I needed 6 decimal places of accuracy, so first way of solution will not work for my case. However, your second strategy seems promising. Working on it. Thanks :D ~l0nwlf On Thu, Feb 4, 2010 at 5:49 PM, Bearophile wrote: > Shashwat Anand: > > > Given 'n' circles and the co-ordinates of their cen

Re: Common area of circles

2010-02-04 Thread Bearophile
Shashwat Anand: > > Given 'n' circles and the co-ordinates of their center, and the radius of > > all being equal i.e. 'one', How can I take out the intersection of their > > area. I can see two possible solutions, both approximate. In both solutions you first look if there are a pair of circles t

Re: Building a multiline string

2010-02-04 Thread Ulrich Eckhardt
Just for the record: Neither of the below methods actually produce a multiline string. They only spread a string containing one line over multiple lines of source code. lallous wrote: > Maybe that's already documented, but it seems the parser accepts to > build a long string w/o really using the f

Re: Passing parameters in URL

2010-02-04 Thread Steve Holden
Paul Rubin wrote: > "Diez B. Roggisch" writes: >>> But it would be outrageous for the shop owner to record the >>> conversations of patrons. >> Which is the exact thing that happens when you use an email-provider >> with IMAP. Or google wave. Or groups. Or facebook. Or twitter. Which I >> wouldn't

Re: Common area of circles

2010-02-04 Thread Shashwat Anand
I want to calculate areas. like for two circles (0, 0) and (0, 1) : the output is '1.228370' similarly my aim is to take 'n' co-ordinates, all of radius '1' and calculate the area common to all. The best I got was monte-carlo methods which is inefficient. Is there any other approach possible. On

Re: How to guard against bugs like this one?

2010-02-04 Thread Steve Holden
Tim Golden wrote: > On 03/02/2010 16:17, kj wrote: >> Boy, that was dumb of me. The above apology was meant for Stephen >> Hansen, not Steve Holden. I guess this is now a meta-apology... >> (Sheesh.) > > You see? That's what I like about the Python community: > people even apologise for apologis

Re: Common area of circles

2010-02-04 Thread Xavier Ho
I'm not sure what you're after. Are you after how to calculate the area? Or are you trying to graph it? Or an analytical solution? What do you mean by "take out the intersection"? -Xav On Thu, Feb 4, 2010 at 9:47 PM, Shashwat Anand wrote: > I wanted some general suggestion/tips only > > > On Th

Re: Common area of circles

2010-02-04 Thread Shashwat Anand
I wanted some general suggestion/tips only On Thu, Feb 4, 2010 at 5:11 PM, Chris Rebert wrote: > On Thu, Feb 4, 2010 at 2:39 AM, Shashwat Anand > wrote: > > Given 'n' circles and the co-ordinates of their center, and the radius of > > all being equal i.e. 'one', How can I take out the intersect

Re: Common area of circles

2010-02-04 Thread Chris Rebert
On Thu, Feb 4, 2010 at 2:39 AM, Shashwat Anand wrote: > Given 'n' circles and the co-ordinates of their center, and the radius of > all being equal i.e. 'one', How can I take out the intersection of their > area. How is this at all specific to Python? This also sounds suspiciously like homework,

Building a multiline string

2010-02-04 Thread lallous
Hello Maybe that's already documented, but it seems the parser accepts to build a long string w/o really using the first method: # Method1 x = "line1" + \ # cannot use comments! "line2"+ \ "line3" and instead using a list with one element like this: # Method2 x = [ "line1" # can use comments "l

learn Sql Server 2000 2005 2008

2010-02-04 Thread groups_ads12
www.sqlserver.learn.net.in sql server sql server 2005 sql server 2008

Re: Overcoming python performance penalty for multicore CPU

2010-02-04 Thread Anh Hai Trinh
On Feb 4, 10:46 am, John Nagle wrote: > >     There's enough intercommunication between the threads working on > a single site that it's a pain to do them as subprocesses. And I > definitely don't want to launch subprocesses for each page; the > Python load time would be worse than the actual work

Common area of circles

2010-02-04 Thread Shashwat Anand
Given 'n' circles and the co-ordinates of their center, and the radius of all being equal i.e. 'one', How can I take out the intersection of their area. hope the picture makes it clear http://imagebin.us/images/p5qeo7hgc3547pnyrb6.gif -- http://mail.python.org/mailman/listinfo/python-list

Re: Passing parameters in URL

2010-02-04 Thread Bruno Desthuilliers
Paul Rubin a écrit : Bruno Desthuilliers writes: The buttons are in the form of a link with href='/item_edit?id=123', ...At least use "POST" requests for anything that Create/Update/Delete resources. There's also the issue that a user can change "123" to "125" and possibly mess with someone

Re: Dreaming of new generation IDE

2010-02-04 Thread Vladimir Ignatov
> http://sourceforge.net/mailarchive/message.php?msg_name=9c768dc61001121642t5bd1a7ddmd1fe9e088e1d9...@mail.gmail.com Thanks a lot! That is a great reference (a must read for everybody interested). Reading just this: "Internally at Google we have a language-neutral representation shared by all our

Re: Passing parameters in URL

2010-02-04 Thread Paul Rubin
Bruno Desthuilliers writes: >> The buttons are in the form of a link with href='/item_edit?id=123', > ...At least use "POST" requests for anything that Create/Update/Delete > resources. There's also the issue that a user can change "123" to "125" and possibly mess with someone else's resource, un

Re: Passing parameters in URL

2010-02-04 Thread Paul Rubin
"Diez B. Roggisch" writes: > Your web-based chat uses HTTP, no P2P-protocol, and thus the service > provider *can* log conversations. I don't say he should, I don't say I > want that, I don't say there are now laws that prevent them from doing > so, all I say is he *can*. Sure, my complaint is th

Re: Passing parameters in URL

2010-02-04 Thread Bruno Desthuilliers
Alan Harris-Reid a écrit : I have a web-page where each row in a grid has edit/delete buttons to enable the user to maintain a selected record on another page. The buttons are in the form of a link with href='/item_edit?id=123', but this string appears in the URL and gives clues as to how to b

  1   2   >