Re: PyEval_GetLocals and unreferenced variables

2014-12-02 Thread Kasper Peeters
> > def fun(): > >cfun_that_creates_q_in_local_scope() > >def fun2(): > >cfun_that_wants_to_see_if_q_is_available() > > > > So the Python side actually doesn't see 'q' directly at all. > > I think you will need to elaborate. Ok, here goes (and thanks for listening)

ANN: eGenix mxODBC Connect 2.1.2 - Python Database Interface

2014-12-02 Thread eGenix Team: M.-A. Lemburg
ANNOUNCING eGenix.com mxODBC Connect Python Database Interface Version 2.1.2 mxODBC Connect is our commercially supported client-server product for

Re: How about some syntactic sugar for " __name__ == '__main__' "?

2014-12-02 Thread Ethan Furman
On 12/01/2014 05:15 PM, Chris Angelico wrote: > On Tue, Dec 2, 2014 at 11:45 AM, Ethan Furman wrote: >> >> Put the above somewhere in your path (e.g. /usr/local/bin), make it >> executable, and then instead of shebanging your >> scripts with `/usr/local/bin/python` you can use `/usr/local/bin/py_m

2nd call for notes about Eric IDE

2014-12-02 Thread Pietro Moras
In view of next edition of the Eric IDE Technical Report (forecast: 3rd quarter '15) and notably with reference to the innovative Eric ver. no. 6, we'll welcome your testimony of experiences and use of specific Eric IDE's features; such as: – Special features of your choice, as: SQL Brows

Re: PyEval_GetLocals and unreferenced variables

2014-12-02 Thread Ned Batchelder
On 12/2/14 4:35 AM, Kasper Peeters wrote: def fun(): cfun_that_creates_q_in_local_scope() def fun2(): cfun_that_wants_to_see_if_q_is_available() So the Python side actually doesn't see 'q' directly at all. I think you will need to elaborate. Ok, here goes (an

Re: Cherrypy - prevent browser "prefetch"?

2014-12-02 Thread random832
On Mon, Dec 1, 2014, at 15:28, Israel Brewster wrote: > For example, I have a URL on my Cherrypy app that updates some local > caches. It is accessed at http:///admin/updatecaches So if I > start typing http:///a, for example, safari may auto-fill the > "dmin/updatecaches", and trigger a cache refr

Re: Cherrypy - prevent browser "prefetch"?

2014-12-02 Thread Israel Brewster
> On Dec 2, 2014, at 4:33 AM, random...@fastmail.us wrote: > > On Mon, Dec 1, 2014, at 15:28, Israel Brewster wrote: >> For example, I have a URL on my Cherrypy app that updates some local >> caches. It is accessed at http:///admin/updatecaches So if I >> start typing http:///a, for example, safa

Proposed new conditional operator: "or else"

2014-12-02 Thread Roy Smith
In the process of refactoring some code, I serendipitously created what I think is an essential new bit of Python syntax. The “or else” statement. I ended up with: sites_string = args.sites or else self.config['sites'] which, of course, is a syntax error today, but it got me thinking

Re: Proposed new conditional operator: "or else"

2014-12-02 Thread Zachary Ware
On Tue, Dec 2, 2014 at 11:18 AM, Roy Smith wrote: > Wouldn’t it be neat to write: > >foo == 42 or else > > and have that be an synonym for: > > assert foo == 42 > > :-) Never going to happen, but I like it! Perhaps raise IntimidationError instead of AssertionError when it fails? -- Zac

Re: Proposed new conditional operator: "or else"

2014-12-02 Thread Ethan Furman
On 12/02/2014 09:41 AM, Zachary Ware wrote: > On Tue, Dec 2, 2014 at 11:18 AM, Roy Smith wrote: >> >> Wouldn’t it be neat to write: >> >>foo == 42 or else >> >> and have that be an synonym for: >> >> assert foo == 42 > > Never going to happen, but I like it! Perhaps raise IntimidationErro

Re: Proposed new conditional operator: "or else"

2014-12-02 Thread Chris Angelico
On Wed, Dec 3, 2014 at 4:41 AM, Zachary Ware wrote: > On Tue, Dec 2, 2014 at 11:18 AM, Roy Smith wrote: >> Wouldn’t it be neat to write: >> >>foo == 42 or else >> >> and have that be an synonym for: >> >> assert foo == 42 >> >> :-) > > Never going to happen, but I like it! Perhaps raise

Re: Proposed new conditional operator: "or else"

2014-12-02 Thread Tim Chase
On 2014-12-02 11:41, Zachary Ware wrote: > On Tue, Dec 2, 2014 at 11:18 AM, Roy Smith wrote: > > Wouldn’t it be neat to write: > > > >foo == 42 or else > > > > and have that be an synonym for: > > > > assert foo == 42 > > > > :-) > > Never going to happen, but I like it! Perhaps raise >

Re: Proposed new conditional operator: "or else"

2014-12-02 Thread Marko Rauhamaa
Tim Chase : >> >foo == 42 or else > > In light of the parallel thread discussing the "assert" statement and > the perils of trusting it to be present even though it can be > optimized away, this "or else" could be (in the altered words of Don > Corleone), "I'm gonna make an assertion he can't

Re: i have to create this patch in python but wasnt having any luck i was wondering if anyone had a solution?

2014-12-02 Thread Joel Goldstick
On Mon, Dec 1, 2014 at 2:28 PM, python help required <19aada...@gmail.com> wrote: > def penultimatePatch(): > > win = GraphWin("Patch1",(100), 100) > amountOfCircles = 5 > > #Filled Red Circles > fillCircle = Circle(Point(20,20)+100/amountOfCircles) > fillCircle.draw(win) >

Re: Cherrypy - prevent browser "prefetch"?

2014-12-02 Thread Nobody
On Mon, 01 Dec 2014 11:28:42 -0900, Israel Brewster wrote: > I'm running to a problem, specifically from > Safari on the Mac, where I start to type a URL, and Safari auto-fills the > rest of a random URL matching what I started to type, and simultaneously > sends a request for that URL to my serve

Re: How about some syntactic sugar for " __name__ == '__main__' "?

2014-12-02 Thread Cameron Simpson
On 02Dec2014 02:17, Ethan Furman wrote: On 12/01/2014 05:15 PM, Chris Angelico wrote: On Tue, Dec 2, 2014 at 11:45 AM, Ethan Furman wrote: Put the above somewhere in your path (e.g. /usr/local/bin), make it executable, and then instead of shebanging your scripts with `/usr/local/bin/python`

Re: Proposed new conditional operator: "or else"

2014-12-02 Thread Andrea D'Amore
On 2014-12-02 17:41:06 +, Zachary Ware said: foo == 42 or else Never going to happen, but I like it! Perhaps raise IntimidationError instead of AssertionError when it fails? That should probably be a DONTPANICError in large, friendly terminal font letters. -- Andrea -- https://mail

Re: Cherrypy - prevent browser "prefetch"?

2014-12-02 Thread John Gordon
In Nobody writes: > On Mon, 01 Dec 2014 11:28:42 -0900, Israel Brewster wrote: > > I'm running to a problem, specifically from > > Safari on the Mac, where I start to type a URL, and Safari auto-fills the > > rest of a random URL matching what I started to type, and simultaneously > > sends a

Parsing XML Using XPATH for Python

2014-12-02 Thread Uzoma Ojemeni
I am new to Python - a few days old - and I would appreciate some help. I want write a python code to parse the below XML as below:- ServingCell--NeighbourCell L41_NBR3347_1--L41_NBR3347_2 L41_NBR3347_1--L41_NBR3347_3 L41_NBR3347_1--L41_NBR3349_1 L41_NBR3347_1-

Re: Cherrypy - prevent browser "prefetch"?

2014-12-02 Thread random832
On Tue, Dec 2, 2014, at 10:59, Israel Brewster wrote: > Primary because they aren’t forms, they are links. And links are, by > definition, GET’s. That said, as I mentioned in earlier replies, if using > a form for a simple link is the Right Way to do things like this, then I > can change it. As I

UK Python Training Day

2014-12-02 Thread Steve Holden
Are you interested in Python training for yourself or others? Can you get to London on 9 December, 2014? If so I would very much like to meet you, and have reserved a venue in Westminster with refreshments and lunch. Starting in 2015 I plan to do more training in Europe (initially in the UK) and

Re: python 2.7 and unicode (one more time)

2014-12-02 Thread Simon Evans
Hi Peter Otten re: There is no assignment soup_atag = whatever but there is one to atag. The whole session should when you omit the offending line > atag = soup_atag.a or insert soup_atag = soup before it. -

Re: Parsing XML Using XPATH for Python

2014-12-02 Thread John Gordon
In Uzoma Ojemeni writes: > I am new to Python - a few days old - and I would appreciate some help. > I want write a python code to parse the below XML as below:- > ServingCell--NeighbourCell > L41_NBR3347_1--L41_NBR3347_2 > L41_NBR3347_1--L41_NBR3347_3 > L41_NBR3347_1-

Python 2.x vs 3.x survey - new owner?

2014-12-02 Thread Dan Stromberg
Last year in late December, I did a brief, 9 question survey of 2.x vs 3.x usage. I like the think the results were interesting, but I don't have the spare cash to do it again this year. I probably shouldn't have done it last year. ^_^ Is anyone interested in taking over the survey? It's on Su

Re: Proposed new conditional operator: "or else"

2014-12-02 Thread Sturla Molden
Zachary Ware wrote: > On Tue, Dec 2, 2014 at 11:18 AM, Roy Smith wrote: >> Wouldn’t it be neat to write: >> >>foo == 42 or else >> >> and have that be an synonym for: >> >> assert foo == 42 >> >> :-) > > Never going to happen, but I like it! Perhaps raise IntimidationError > instead

Re: Proposed new conditional operator: "or else"

2014-12-02 Thread Roy Smith
In article , Chris Angelico wrote: > On Wed, Dec 3, 2014 at 4:41 AM, Zachary Ware > wrote: > > On Tue, Dec 2, 2014 at 11:18 AM, Roy Smith wrote: > >> Wouldn’t it be neat to write: > >> > >>foo == 42 or else > >> > >> and have that be an synonym for: > >> > >> assert foo == 42 > >> >

Re: Proposed new conditional operator: "or else"

2014-12-02 Thread Michael Torrie
On 12/02/2014 10:18 AM, Roy Smith wrote: > In the process of refactoring some code, I serendipitously created what I > think is an essential new bit of Python syntax. The “or else” statement. I > ended up with: > > sites_string = args.sites or else self.config['sites'] But isn't that

Python handles globals badly.

2014-12-02 Thread Skybuck Flying
Excuse is: "bad programming style". I don't need snot telling me how to program after 20 years of programming experience. This is so far the only thing pissing me off in python. Now I have to declare "global" in front of these variables every where I want to use em: ShipAbilityDistributeSh

Re: Python handles globals badly.

2014-12-02 Thread Chris Angelico
On Wed, Dec 3, 2014 at 1:27 PM, Skybuck Flying wrote: > I don't need snot telling me how to program after 20 years of programming > experience. > > This is so far the only thing pissing me off in python. > > Now I have to declare "global" in front of these variables every where I > want to use em:

RE: Python handles globals badly.

2014-12-02 Thread Clayton Kirkwood
You're still young, enjoy your youth while you can. >-Original Message- >From: Python-list [mailto:python-list- >bounces+crk=godblessthe...@python.org] On Behalf Of Skybuck Flying >Sent: Tuesday, December 02, 2014 6:28 PM >To: python-list@python.org >Subject: Python handles globals badly.

Re: Python handles globals badly.

2014-12-02 Thread Michael Torrie
On 12/02/2014 07:27 PM, Skybuck Flying wrote: > Excuse is: "bad programming style". > > I don't need snot telling me how to program after 20 years of programming > experience. > > This is so far the only thing pissing me off in python. > > Now I have to declare "global" in front of these variab

Re: Python handles globals badly.

2014-12-02 Thread Ben Finney
"Skybuck Flying" writes: > I don't need snot telling me how to program after 20 years of > programming experience. If you've already determined what advice you do or do not need, then you're welcome to solve your problems by yourself. We'll be here when you decide it's time to humble yourself t

Re: Python handles globals badly.

2014-12-02 Thread Skybuck Flying
Meanwhile... I modified my code, and added these globals in front of it. It didn't take too long to do. But it did add something like 300 "unnecessary" lines of code, which is what kinda annoys me. I'd like to keep my code compact. Anyway I double checked to make sure other routines had glo

Re: Python handles globals badly.

2014-12-02 Thread Skybuck Flying
Some issues I'd like to address to you: 1. Structured programming requires more programming time. 2. Structured programming implies structure which might be less flexible. 3. Python objects require "self" keyword to be used everywhere, and other akwardness wich leads to more typing/programming/w

Re: Python handles globals badly.

2014-12-02 Thread Chris Angelico
On Wed, Dec 3, 2014 at 3:17 PM, Skybuck Flying wrote: > I hope python one day gets rid of it; > > 1. To stop the confusion. > 2. To stop the doubt. > 3. To stop the wasted lines. > 4. To program with more confidence. > 5. To stop to have to inspect what's going on if one wants to know for sure. >

Re: Python handles globals badly.

2014-12-02 Thread Chris Angelico
On Wed, Dec 3, 2014 at 3:32 PM, Skybuck Flying wrote: > Though I do hope to see a programming language some day, that is aimed at > more mature programmers that know what they are doing. > > Instead of a language aimed at noobs :) a noob language which forbids > certain styles of programming becau

Re: Python handles globals badly.

2014-12-02 Thread Dave Angel
On 12/02/2014 11:32 PM, Skybuck Flying wrote: Some issues I'd like to address to you: 1. Structured programming requires more programming time. 2. Structured programming implies structure which might be less flexible. 3. Python objects require "self" keyword to be used everywhere, and other akwa

Re: html page mail link to webmail program

2014-12-02 Thread Cameron Simpson
On 11Nov2014 17:35, Ethan Furman wrote: Okay, the explicit Python question: Clicking on a mail link in a web browser can start an external program. I would like that external program to be a Python script that: opens a new tab in the currently running browser (or a new default browser windo

Re: Python handles globals badly.

2014-12-02 Thread Michael Torrie
On 12/02/2014 09:32 PM, Skybuck Flying wrote: > Some issues I'd like to address to you: > > 1. Structured programming requires more programming time. > 2. Structured programming implies structure which might be less flexible. > 3. Python objects require "self" keyword to be used everywhere, and ot

Re: PyEval_GetLocals and unreferenced variables

2014-12-02 Thread Gregory Ewing
Kasper Peeters wrote: I could in principle decide to make these settings a proper Python object, and ask the user to create one and pass it along at every C-function call. I would make the C functions methods of the object holding the settings. Your nested function example would then look somet

Re: PyEval_GetLocals and unreferenced variables

2014-12-02 Thread Gregory Ewing
Ned Batchelder wrote: I would use thread locals for this: https://docs.python.org/2/library/threading.html#threading.local You could get dynamic scoping that way, but the OP seems to want lexical scoping. -- Greg -- https://mail.python.org/mailman/listinfo/python-list

Re: Need Help

2014-12-02 Thread Miki Tebeka
Greetings, > I'm a beginner of python, I just want your help. We'll gladly do it, however you need to invest some time and write better questions :) See http://www.catb.org/esr/faqs/smart-questions.html > How can I get the Failure values from the Console in to a txt or a csv file? We need more i

Re: Cherrypy - prevent browser "prefetch"?

2014-12-02 Thread Gregory Ewing
Israel Brewster wrote: Primary because they aren’t forms, they are links. And links are, by definition, GET’s. That said, as I mentioned in earlier replies, if using a form for a simple link is the Right Way to do things like this, then I can change it. I'd look at it another way and say that a

Re: Python handles globals badly.

2014-12-02 Thread Marko Rauhamaa
> On 12/02/2014 09:32 PM, Skybuck Flying wrote: >> Some issues I'd like to address to you: >> >> 1. Structured programming requires more programming time. >> 2. Structured programming implies structure which might be less flexible. >> 3. Python objects require "self" keyword to be used everywhere

Re: Parsing XML Using XPATH for Python

2014-12-02 Thread dieter
Uzoma Ojemeni writes: ... One easy option would be to use the "XPath" support in the "lxml" package -- provided you have not problem with the installation of external libraries ("libxml2" and "libxslt") and C-extensions ("lxml"). -- https://mail.python.org/mailman/listinfo/python-list

Re: Python handles globals badly.

2014-12-02 Thread Joel Goldstick
troll On Wed, Dec 3, 2014 at 1:52 AM, Marko Rauhamaa wrote: > >> On 12/02/2014 09:32 PM, Skybuck Flying wrote: >>> Some issues I'd like to address to you: >>> >>> 1. Structured programming requires more programming time. >>> 2. Structured programming implies structure which might be less flexible

Re: Proposed new conditional operator: "or else"

2014-12-02 Thread Sturla Molden
Dennis Lee Bieber wrote: >> foo == 42 or else >> > > Has a PERL stink to it... like: foo == 42 or die I think this statement needs to take ellipsis as well foo == 42 or else ... Sturls -- https://mail.python.org/mailman/listinfo/python-list