why does "python --version" write to standard error?

2014-03-06 Thread Cameron Simpson
This seems to write the python version to standard error. That seems very wrong. And at variance with the manual entry. Commentry? -- Cameron Simpson This is not a bug. It's just the way it works, and makes perfect sense. - Tom Christiansen I like that line. I hope my boss falls for it

Assertions are bad, m'kay?

2014-03-06 Thread Chris Angelico
They produce the wrong exception type, they disappear when you least expect them, and now we have another reason not to use assert. http://xkcd.com/1339/ Abusing assert for arg checking violates XKCD 1339. Write standards-compliant code! ChrisA -- https://mail.python.org/mailman/listinfo/python

Re: gdb unable to read python frame information

2014-03-06 Thread dieter
Wesley writes: > I wanna use gdb to attach my running python scripts. > Successfully import libpython in gdb, but seems all py operations failed to > read python information. > > Here is the snippet: > (gdb) python >>import libpython >>end > (gdb) py-bt > #3 (unable to read python frame informat

Re: Python programming

2014-03-06 Thread William Ray Wing
On Mar 6, 2014, at 8:24 PM, Roy Smith wrote: > In article , > Dennis Lee Bieber wrote: > >> On 06 Mar 2014 02:51:54 GMT, alb...@spenarnc.xs4all.nl (Albert van der >> Horst) declaimed the following: >> >>> In article , >>> Roy Smith wrote: In article , Grant Edwards wrote: >

Re: How security holes happen

2014-03-06 Thread Mark H. Harris
On Thursday, March 6, 2014 8:13:02 PM UTC-6, MRAB wrote: > > The Z80's architecture and instruction set is a superset of that of the > 8080; the 6502's architecture and instruction set isn't a superset of, > or even compatible with, that of the 6800 (although it can use the same > I/O, etc, chips)

Re: How security holes happen

2014-03-06 Thread MRAB
On 2014-03-07 01:53, Mark H. Harris wrote: On Thursday, March 6, 2014 6:28:58 PM UTC-6, Dennis Lee Bieber wrote: The 6502 was NOT a Motorola chip (they had the 6800). The 6502 was MOS That's funny... did you not see what I wrote back to MRAB? Here: The MOS 6502 is to the Motorola

gdb unable to read python frame information

2014-03-06 Thread Wesley
Hi guys, My env: centos 6.5 64 bit; gdb 7.1; python 2.6.6 I wanna use gdb to attach my running python scripts. Successfully import libpython in gdb, but seems all py operations failed to read python information. Here is the snippet: (gdb) python >import libpython >end (gdb) py-bt #3 (unable to

test

2014-03-06 Thread Mark H. Harris
disregard -- https://mail.python.org/mailman/listinfo/python-list

Re: How security holes happen

2014-03-06 Thread Mark H. Harris
On Thursday, March 6, 2014 6:28:58 PM UTC-6, Dennis Lee Bieber wrote: > > The 6502 was NOT a Motorola chip (they had the 6800). The 6502 was MOS That's funny... did you not see what I wrote back to MRAB? Here: The MOS 6502 is to the Motorola 6800 what the Zilog Z80 was to the Intel 8080

Re: beautiful soup get class info

2014-03-06 Thread Mark Lawrence
On 07/03/2014 01:37, teddyb...@gmail.com wrote: On Thursday, March 6, 2014 4:28:06 PM UTC-6, John Gordon wrote: In writes: soup.find_all(name="span", class="date") I have python 2.7.2 and it does not like class in the code you provided. Oh right, 'class' is a reserved word. I ima

Re: beautiful soup get class info

2014-03-06 Thread teddybubu
On Thursday, March 6, 2014 4:28:06 PM UTC-6, John Gordon wrote: > In writes: > > > > > > soup.find_all(name="span", class="date") > > > > > I have python 2.7.2 and it does not like class in the code you provided. > > > > Oh right, 'class' is a reserved word. I imagine beautifulsoup has

Re: Python programming

2014-03-06 Thread Roy Smith
In article , Dennis Lee Bieber wrote: > On 06 Mar 2014 02:51:54 GMT, alb...@spenarnc.xs4all.nl (Albert van der > Horst) declaimed the following: > > >In article , > >Roy Smith wrote: > >>In article , > >> Grant Edwards wrote: > >> > >>> On 2014-02-13, Dennis Lee Bieber wrote: > >>> > >>> >

Re: script uses up all memory

2014-03-06 Thread Marko Rauhamaa
Chris Angelico : > On Fri, Mar 7, 2014 at 10:53 AM, Marko Rauhamaa wrote: >>class MyStateMachine: >>def __init__(self): >>sm = self >> >>class IDLE: >>def ding(self): >>sm.open_door() >>sm.state = AT_DOOR(

Re: script uses up all memory

2014-03-06 Thread Chris Angelico
On Fri, Mar 7, 2014 at 10:53 AM, Marko Rauhamaa wrote: > Chris Angelico : > >> Can you give a useful example of a closure that does create a refloop? > > Just the other day, I mentioned the state pattern: > >class MyStateMachine: >def __init__(self): >sm = self > >

Call for Proposals: PyCon AU 2014 in Brisbane

2014-03-06 Thread PyCon AU
PyCon Australia 2014 is pleased to announce that its Call for Proposals is now open! The conference this year will be held on Saturday 2 and Sunday 3 August 2014 in Brisbane. We'll also be featuring a day of miniconfs on Friday 1 August. The deadline for proposal submission is Friday April 25, 20

Re: script uses up all memory

2014-03-06 Thread Marko Rauhamaa
Chris Angelico : > Can you give a useful example of a closure that does create a refloop? Just the other day, I mentioned the state pattern: class MyStateMachine: def __init__(self): sm = self class IDLE: def ding(self): sm.open_

Re: script uses up all memory

2014-03-06 Thread Chris Angelico
On Fri, Mar 7, 2014 at 10:12 AM, Marko Rauhamaa wrote: > Chris Angelico : > >> I think this thread is proof that they are to be avoided. The GC >> wasn't doing its job unless explicitly called on. The true solution is >> to break the refloop; the quick fix is to call gc.collect(). I stand >> by th

Re: script uses up all memory

2014-03-06 Thread Marko Rauhamaa
Chris Angelico : > I think this thread is proof that they are to be avoided. The GC > wasn't doing its job unless explicitly called on. The true solution is > to break the refloop; the quick fix is to call gc.collect(). I stand > by the recommendation to put an explanatory comment against the > co

Re: script uses up all memory

2014-03-06 Thread Chris Angelico
On Fri, Mar 7, 2014 at 9:34 AM, Marko Rauhamaa wrote: > Chris Angelico : > >> Not all problems need to be solved perfectly :) But at very least, I >> would put a comment against your collect() call explaining what >> happens: that self.tools is involved in a refloop. Most Python code >> shouldn't

Re: script uses up all memory

2014-03-06 Thread Chris Angelico
On Fri, Mar 7, 2014 at 9:21 AM, Larry Martell wrote: > First I added del(self.tools) before the Django call. That did not > stop the memory consumption. Then I added a call to gc.collect() after > the del and that did solve it. gc.collect() returns 0 each time, so > I'm going to declare victory an

Re: script uses up all memory

2014-03-06 Thread Marko Rauhamaa
Chris Angelico : > Not all problems need to be solved perfectly :) But at very least, I > would put a comment against your collect() call explaining what > happens: that self.tools is involved in a refloop. Most Python code > shouldn't have to call gc.collect(), so it's worth explaining why you >

Re: beautiful soup get class info

2014-03-06 Thread John Gordon
In teddyb...@gmail.com writes: > > soup.find_all(name="span", class="date") > I have python 2.7.2 and it does not like class in the code you provided. Oh right, 'class' is a reserved word. I imagine beautifulsoup has a workaround for that. > Now when I take out [ class="date"], this is retur

Re: script uses up all memory

2014-03-06 Thread Larry Martell
On Thu, Mar 6, 2014 at 5:11 PM, Chris Angelico wrote: > On Fri, Mar 7, 2014 at 8:56 AM, Larry Martell wrote: >> I figured out what is causing this. Each pass through the loop it does: >> >> self.tools = Tool.objects.filter(ip__isnull=False) >> >> And that is what is causing the memory consumption

Re: script uses up all memory

2014-03-06 Thread Chris Angelico
On Fri, Mar 7, 2014 at 9:07 AM, Larry Martell wrote: > Apparently the object returned by that call is immutable as if I look > at id(self.tools) each pass through the loop, it is different. Is > there some way I can recover that memory? Not sure what mutability has to do with that. The changing i

Re: script uses up all memory

2014-03-06 Thread Chris Angelico
On Fri, Mar 7, 2014 at 8:56 AM, Larry Martell wrote: > I figured out what is causing this. Each pass through the loop it does: > > self.tools = Tool.objects.filter(ip__isnull=False) > > And that is what is causing the memory consumption. If I move that > outside the loop and just do that once the

Re: script uses up all memory

2014-03-06 Thread Larry Martell
On Thu, Mar 6, 2014 at 4:56 PM, Larry Martell wrote: > On Wed, Mar 5, 2014 at 5:27 PM, Larry Martell wrote: >> I have a script that forks off other processes and attempts to manage >> them. Here is a stripped down version of the script: >> >> self.sleepTime = 300 >> self.procs = {

Re: script uses up all memory

2014-03-06 Thread Larry Martell
On Wed, Mar 5, 2014 at 5:27 PM, Larry Martell wrote: > I have a script that forks off other processes and attempts to manage > them. Here is a stripped down version of the script: > > self.sleepTime = 300 > self.procs = {} > self.startTimes = {} > self.cmd = ['pytho

Re: beautiful soup get class info

2014-03-06 Thread teddybubu
On Thursday, March 6, 2014 2:58:12 PM UTC-6, John Gordon wrote: > In teddy writes: > > > > > October 22, 2011 > > > > > date1 = soup.span.text > > > data=soup.find_all(date="value") > > > > Try this: > > > > soup.find_all(name="span", class="date") > > > > -- > > John Gordon

Re: beautiful soup get class info

2014-03-06 Thread John Gordon
In teddyb...@gmail.com writes: > October 22, 2011 > date1 = soup.span.text > data=soup.find_all(date="value") Try this: soup.find_all(name="span", class="date") -- John Gordon Imagine what it must be like for a real medical doctor to gor...@panix.comwatch 'House', or a real se

beautiful soup get class info

2014-03-06 Thread teddybubu
I am using beautifulsoup to get the title and date of the website. title is working fine but I am not able to pull the date. Here is the code in the url: October 22, 2011 In Python, I am using the following code: date1 = soup.span.text data=soup.find_all(date="value") Results in: [] March 5,

Re: Ternary operator associativity

2014-03-06 Thread Terry Reedy
On 3/6/2014 1:59 PM, Tim Chase wrote: On 2014-03-06 03:34, candide wrote: According to the official documentation, the ternary operator has left-to-right associativity left_to_right = (0 if 1 else 0) if 0 else 1 right_to_left = 0 if 1 else (0 if 0 else 1) I'd never want to rely on my own abi

Re: Ternary operator associativity

2014-03-06 Thread Tim Chase
On 2014-03-06 03:34, candide wrote: > According to the official documentation, the ternary operator has > left-to-right associativity > > >>> left_to_right = (0 if 1 else 0) if 0 else 1 > >>> right_to_left = 0 if 1 else (0 if 0 else 1) I'd never want to rely on my own ability to remember the lang

Re: Ternary operator associativity

2014-03-06 Thread Terry Reedy
On 3/6/2014 6:34 AM, candide wrote: According to the official documentation, the ternary operator has left-to-right associativity : The proper terms is 'conditional expression', which goes back to "The C Programming Language" (K&R). There are many unary operators, many binary operators, and t

Re: Reference

2014-03-06 Thread Mark Lawrence
On 06/03/2014 00:35, Steven D'Aprano wrote: On Thu, 06 Mar 2014 08:26:22 +1100, Chris Angelico wrote: On Thu, Mar 6, 2014 at 8:14 AM, Marko Rauhamaa wrote: When I talk about an object's memory address, I'm not referring to what might be revealed by gdb, for example. That is, I'm not talking a

Re: Origin of 'self'

2014-03-06 Thread Marko Rauhamaa
Westley Martínez : > Thankfully you don't often need to use this in C++ like you do with > self in Python. Self pity is not attractive. Marko -- https://mail.python.org/mailman/listinfo/python-list

Re: Ternary operator associativity

2014-03-06 Thread Michael Torrie
On 03/06/2014 04:34 AM, candide wrote: > According to the official documentation, the ternary operator has > left-to-right associativity : > > --- > Operators in the same box group left to right (except for comparisons, > including tests, which all have the same precedence and ch

Re: Origin of 'self'

2014-03-06 Thread Mark Lawrence
On 06/03/2014 01:56, Westley Martínez wrote: Why did C++ use this? I don't really like this. It doesn't sound right. I think it's because I have trouble saying the th sound without getting my mouth full of spit. Thankfully you don't often need to use this in C++ like you do with self in Pytho

Who Invented the Trinity?

2014-03-06 Thread BV BV
Who Invented the Trinity? 1-How the concept of the Trinity was introduced into the Christian doctrine. 2-How the injected doctrine of the trinity remained part of the beliefs of the Christians and how Islam defines God. What is the source of the Christian concept of the Trinity? The three mono

Re: Diagnose a segfault in ipython/readline

2014-03-06 Thread Fabio Zadrozny
On Thu, Mar 6, 2014 at 3:11 AM, Felix Yan wrote: > On Wednesday, March 05, 2014 20:15:31 Ned Deily wrote: > > The current > > assumption is that Python 2.7.6+, 3.3.5, and 3.4.0 have no problems with > > readline 6.3. > > Thank you. > > I just gave a try to 3.4.0b2 with readline 6.3, and still get

Re: Python programming

2014-03-06 Thread Grant Edwards
On 2014-03-06, Tim Chase wrote: > On 2014-03-06 06:17, Steven D'Aprano wrote: >> On Wed, 05 Mar 2014 20:19:56 -0800, Beowulf wrote: >> >> > Once you master one language it is easy to understand other. >> >> Depends on the languages. Learning Forth doesn't make it easier to >> learn Perl. Learn

Re: Python programming

2014-03-06 Thread Grant Edwards
On 2014-03-06, Roy Smith wrote: > In article , > Dan Sommers wrote: > >> On Wed, 05 Mar 2014 20:19:56 -0800, Beowulf wrote: >> >> > Once you master one language it is easy to understand other ... >> >> Once you master one language, the next one is hard. After that, they >> get easier. > > And

Re: Struggling to create an extension wrapping a 3rd party dll

2014-03-06 Thread Christoff Kok
On Wednesday, 5 March 2014 09:10:33 UTC+2, Christoff Kok wrote: > Hi, > > > > We are trying to wrap a 3rd party dll (written in C) to access it through > python. > > The dll has a .lib .c and a .h file with it. We are accessing the dll through > the .c file. > > > > Outisde of the extensi

Re: Working with the set of real numbers

2014-03-06 Thread Chris Angelico
On Thu, Mar 6, 2014 at 11:27 PM, Oscar Benjamin wrote: > So my loop > > while x ** 2 - y > x * eps: > x = (x + y/x) / 2 > > and Chris' loop: > > while abs(guess1-guess2) > epsilon: > guess1 = n/guess2 > guess2 = (guess1 + guess2)/2 > > and now your loop > >

Re: Python programming

2014-03-06 Thread Tim Chase
On 2014-03-06 06:17, Steven D'Aprano wrote: > On Wed, 05 Mar 2014 20:19:56 -0800, Beowulf wrote: > > > Once you master one language it is easy to understand other. > > Depends on the languages. Learning Forth doesn't make it easier to > learn Perl. Learning Pascal doesn't make Smalltalk easier.

Re: Program Python

2014-03-06 Thread Rustom Mody
On Thursday, March 6, 2014 3:11:10 AM UTC+5:30, Luciano Trespidi wrote: > I'm very grateful if anyone can helpme to find a good program to develop in > python lenguage. > Thanks > Inviato da: > Ernesto Luciano Trespidi > Email: keplero1... > Tel. 32... Hi and welcome Just a small warning in ad

Re: Working with the set of real numbers

2014-03-06 Thread Oscar Benjamin
On 5 March 2014 12:57, Dave Angel wrote: > Oscar Benjamin Wrote in message: >> On 4 March 2014 23:20, Dave Angel wrote: >>> >>> On the assumption that division by 2 is very fast, and that a >>> general multiply isn't too bad, you could improve on Newton by >>> observing that the slope is 2.

Ternary operator associativity

2014-03-06 Thread candide
According to the official documentation, the ternary operator has left-to-right associativity : --- Operators in the same box group left to right (except for comparisons, including tests, which all have the same precedence and chain from left to right -- see section Comparisons

Re: NameError: name 'pyver' is not defined

2014-03-06 Thread Pavan Rikhi
On Wed, Mar 05, 2014 at 10:53:46PM -0800, שולמית מירל wrote: > execfile(configfile,globals()) You could replace the above line in cvstop4lib.py with the following: exec(open(configfile).read(), globals()) signature.asc Description: GnuPG Digital Signature -- https://mail.python.org/mailman

Re: NameError: name 'pyver' is not defined

2014-03-06 Thread שולמית מירל
I tried first to run the script under 2.6 version, but than the "argparse" was missing. I couldn't find python 2.7 for unix download -- https://mail.python.org/mailman/listinfo/python-list

Re: NameError: name 'pyver' is not defined

2014-03-06 Thread שולמית מירל
בתאריך יום חמישי, 6 במרץ 2014 10:26:34 UTC+2, מאת Ned Deily: > In article , ?AIOE??OE?I wrote: > We have python 2.6 & 3.2 installed on Sun solaris. > When running py utility, we get the below error: > > "NameError: global name 'execfile' is not defined" > > > > p4convert-cvs.py > EXCEPTION: [

Re: NameError: name 'pyver' is not defined

2014-03-06 Thread Ned Deily
In article , Ned Deily wrote: > execfile() no long exists in Python 3 so chances are you are trying to > run a Python 3 program with Python 2. Try running the script explicitly > under Python 2: Er, "trying to run a Python 2 program with Python 3", of course. -- Ned Deily, n...@acm.org -

Re: NameError: name 'pyver' is not defined

2014-03-06 Thread Ned Deily
In article , ?AIOE??OE?I wrote: > We have python 2.6 & 3.2 installed on Sun solaris. > When running py utility, we get the below error: > > "NameError: global name 'execfile' is not defined" > > > > p4convert-cvs.py > EXCEPTION: [Errno 17] File exists: './LOGS' > Traceback (most recent call la

Re: NameError: name 'pyver' is not defined

2014-03-06 Thread Steven D'Aprano
On Wed, 05 Mar 2014 22:53:46 -0800, שולמית מירל wrote: > Hello, > > We have python 2.6 & 3.2 installed on Sun solaris. When running py > utility, we get the below error: > > "NameError: global name 'execfile' is not defined" Sounds like you are accidentally running a script intended for Python2