pytest-xdist-1.10 released (distributed testing plugin)

2014-01-30 Thread holger krekel
Hi all, also released pytest-xdist-1.11 with some little improvements and speedups regarding overheads for distributing tests (maybe 10%, not too much). Install it with: pip install -U pytest-xdist and checkout the pypi page: https://pypi.python.org/pypi/pytest-xdist best, holger

tox-1.7.0: many bug fixes and little improvements

2014-01-30 Thread holger krekel
Just released tox-1.7.0 (finally), the generic virtualenv-based test runner for Python. It contains a lot of fixes and improvements although there are some bugs remaining. While a lot of pull requests are thankfully offered i could use some more co-maintaining/reviewing to allow for some

pytest-2.5.2: fixes, plugin index, contribution guide

2014-01-30 Thread holger krekel
pytest-2.5.2: fixes, plugin page, contribution guide === pytest is a mature Python testing tool with more than a 1000 tests against itself, passing on many different interpreters and platforms. The 2.5.2 release fixes a

execnet-1.2 released: gevent/eventlet support, many improvements

2014-01-30 Thread holger krekel
Hi all, just released execnet-1.2, the tool for writing distributed zero-install python programs. The release contains lots of improvements and fixes. Most notably execnet now supports to use gevent/eventlet models on each of the initiating side and the remote side (configurable separately).

A day of free Python Django talks tutorials, Cardiff (UK)

2014-01-30 Thread D.M. Procida
Django Weekend Cardiff https://djangoweekend.org/ is completely sold out. Our open day remains open however, and you're invited to attend the numerous talks, tutorials and demonstrations in the programme. They'll all be held at Cardiff University.

Re: pytz question: GMT vs. UTC

2014-01-30 Thread wxjmfauth
Le jeudi 30 janvier 2014 04:27:54 UTC+1, Chris Angelico a écrit : On Thu, Jan 30, 2014 at 1:40 PM, MRAB pyt...@mrabarnett.plus.com wrote: How cruel... I suspect the smack at 0degC is much more painful than one at room temperature G It's the 21st century; you should be

Re: Python shell wont open IDLE or an exisiting .py files

2014-01-30 Thread Terry Reedy
On 1/29/2014 11:16 PM, Ben Finney wrote: Terry Reedy tjre...@udel.edu writes: On 1/29/2014 6:26 PM, shangonich...@sbcglobal.net wrote: If I launch the Python GUI it opens a Python Shell fine. But as soon as I try to open a file (including a new file), it closes the Shell. This I do

Re: buggy python interpretter or am I missing something here?

2014-01-30 Thread Terry Reedy
On 1/30/2014 12:13 AM, Gregory Ewing wrote: Steven D'Aprano wrote: On Mon, 27 Jan 2014 12:22:22 -0800, Rick Johnson wrote: Why do we even need an input function anyway if all it is going to do is read from stdin? That's not all it does. What else it does is print a prompt before reading

Re: pytz question: GMT vs. UTC

2014-01-30 Thread Christian Heimes
On 30.01.2014 04:27, Chris Angelico wrote: On Thu, Jan 30, 2014 at 1:40 PM, MRAB pyt...@mrabarnett.plus.com wrote: How cruel... I suspect the smack at 0degC is much more painful than one at room temperature G It's the 21st century; you should be making use of Unicode: 0°C. I

Re: pytz question: GMT vs. UTC

2014-01-30 Thread Chris Angelico
On Thu, Jan 30, 2014 at 8:49 PM, Christian Heimes christ...@python.org wrote: On 30.01.2014 04:27, Chris Angelico wrote: On Thu, Jan 30, 2014 at 1:40 PM, MRAB pyt...@mrabarnett.plus.com wrote: How cruel... I suspect the smack at 0degC is much more painful than one at room temperature

Re: pytz question: GMT vs. UTC

2014-01-30 Thread wxjmfauth
Le jeudi 30 janvier 2014 10:49:11 UTC+1, Christian Heimes a écrit : On 30.01.2014 04:27, Chris Angelico wrote: On Thu, Jan 30, 2014 at 1:40 PM, MRAB pyt...@mrabarnett.plus.com wrote: How cruel... I suspect the smack at 0degC is much more painful than one at room

Work on Call for Participation for EuroPython 2015 has started

2014-01-30 Thread M.-A. Lemburg
[Please help spread the word by forwarding to other relevant mailing lists, user groups, etc.; thanks :-)] The EuroPython Society (EPS) has started work on preparing the Call for Participation (CFP) for organizing the EuroPython 2015 conference: http://www.europython-society.org/ For 2015,

fseek In Compressed Files

2014-01-30 Thread Ayushi Dalmia
Hello, I need to randomly access a bzip2 or gzip file. How can I set the offset for a line and later retreive the line from the file using the offset. Pointers in this direction will help. -- https://mail.python.org/mailman/listinfo/python-list

Re: fseek In Compressed Files

2014-01-30 Thread Peter Otten
Ayushi Dalmia wrote: I need to randomly access a bzip2 or gzip file. How can I set the offset for a line and later retreive the line from the file using the offset. Pointers in this direction will help. with gzip.open(filename) as f: f.seek(some_pos) print(f.readline())

1 0 == True - False

2014-01-30 Thread Thibault Langlois
Hello, $ python Python 2.7.4 (default, Sep 26 2013, 03:20:26) [GCC 4.7.3] on linux2 Type help, copyright, credits or license for more information. 1 0 == True False (1 0) == True True 1 (0 == True) True What am I missing here ? T. -- https://mail.python.org/mailman/listinfo/python-list

Re: 1 0 == True - False

2014-01-30 Thread Thomas Mlynarczyk
Thibault Langlois schrieb: 1 0 == True False What am I missing here ? This, perhaps: http://www.primozic.net/nl/chaining-comparison-operators-in-python/ Greetings, Thomas -- Ce n'est pas parce qu'ils sont nombreux à avoir tort qu'ils ont raison! (Coluche) --

Re: 1 0 == True - False

2014-01-30 Thread Jussi Piitulainen
Thibault Langlois writes: Hello, $ python Python 2.7.4 (default, Sep 26 2013, 03:20:26) [GCC 4.7.3] on linux2 Type help, copyright, credits or license for more information. 1 0 == True False (1 0) == True True 1 (0 == True) True What am I missing here ? One or both of

Re: pytz question: GMT vs. UTC

2014-01-30 Thread MRAB
On 2014-01-30 08:45, wxjmfa...@gmail.com wrote: Le jeudi 30 janvier 2014 04:27:54 UTC+1, Chris Angelico a écrit : On Thu, Jan 30, 2014 at 1:40 PM, MRAB pyt...@mrabarnett.plus.com wrote: How cruel... I suspect the smack at 0degC is much more painful than one at room temperature G

Re:fseek In Compressed Files

2014-01-30 Thread Dave Angel
Ayushi Dalmia ayushidalmia2...@gmail.com Wrote in message: Hello, I need to randomly access a bzip2 or gzip file. How can I set the offset for a line and later retreive the line from the file using the offset. Pointers in this direction will help. Start with the zlib module. Note that

Re:Try-except-finally paradox

2014-01-30 Thread Dave Angel
Jessica Ross deathwea...@gmail.com Wrote in message: I found something like this in a StackOverflow discussion. def paradox(): ... try: ... raise Exception(Exception raised during try) ... except: ... print Except after try ... return True ...

Re: 1 0 == True - False

2014-01-30 Thread Peter Otten
Jussi Piitulainen wrote: Thibault Langlois writes: Hello, $ python Python 2.7.4 (default, Sep 26 2013, 03:20:26) [GCC 4.7.3] on linux2 Type help, copyright, credits or license for more information. 1 0 == True False (1 0) == True True 1 (0 == True) True What am I

Re: 1 0 == True - False

2014-01-30 Thread Jussi Piitulainen
Peter Otten writes: Jussi Piitulainen wrote: Thibault Langlois writes: Hello, $ python Python 2.7.4 (default, Sep 26 2013, 03:20:26) [GCC 4.7.3] on linux2 Type help, copyright, credits or license for more information. 1 0 == True False (1 0) == True True 1 (0

Add directory to sys.path based on variable

2014-01-30 Thread loial
I want to add a path to sys.path based upon a variable Can I do that? Hardcodeing the path works fine, but I want to set it based upon a variable. I know I can set PYTHONPATH, but just wondering if I can add a directory on the fly to sys.path using a variable --

Re: Add directory to sys.path based on variable

2014-01-30 Thread Tim Golden
On 30/01/2014 12:39, loial wrote: I want to add a path to sys.path based upon a variable Can I do that? Hardcodeing the path works fine, but I want to set it based upon a variable. I know I can set PYTHONPATH, but just wondering if I can add a directory on the fly to sys.path using a

Re:1 0 == True - False

2014-01-30 Thread Dave Angel
Thibault Langlois thibault.langl...@gmail.com Wrote in message: Hello, $ python Python 2.7.4 (default, Sep 26 2013, 03:20:26) [GCC 4.7.3] on linux2 Type help, copyright, credits or license for more information. 1 0 == True False (1 0) == True True 1 (0 == True) True What am I

Re: Try-except-finally paradox

2014-01-30 Thread Chris Angelico
On Thu, Jan 30, 2014 at 11:05 PM, Dave Angel da...@davea.name wrote: The finally has to happen before any return inside the try or the except. And once you're in the finally clause you'll finish it before resuming the except clause. Since it has a return, that will happen before the

Re: Try-except-finally paradox

2014-01-30 Thread MRAB
On 2014-01-30 13:02, Chris Angelico wrote: On Thu, Jan 30, 2014 at 11:05 PM, Dave Angel da...@davea.name wrote: The finally has to happen before any return inside the try or the except. And once you're in the finally clause you'll finish it before resuming the except clause. Since it has a

Re: Try-except-finally paradox

2014-01-30 Thread Chris Angelico
On Fri, Jan 31, 2014 at 12:11 AM, MRAB pyt...@mrabarnett.plus.com wrote: One of the reasons that the 'with' statement was added was to prevent the mistake that you've just done. ;-) What if the file can't be opened? Yeah, whoops. The open shouldn't be inside try/finally. def func():

end quote help for a newbie

2014-01-30 Thread Peter Clark
There is probably an easy solution to this – but I have not found it. Trying to terminate a literal in a print statement (from the tutorial). The literal should be enclosed in double quotes “ “ the initial double quote seems to be OK (if I use a different character it flags it) but the ending

Re: fseek In Compressed Files

2014-01-30 Thread Ayushi Dalmia
On Thursday, January 30, 2014 4:20:26 PM UTC+5:30, Ayushi Dalmia wrote: Hello, I need to randomly access a bzip2 or gzip file. How can I set the offset for a line and later retreive the line from the file using the offset. Pointers in this direction will help. This is what I have

Re: end quote help for a newbie

2014-01-30 Thread Skip Montanaro
Not sure if this is exactly what you're asking, but perhaps you want triple quotes? print now is the time for all good men ... now is the time for all good men ... print '''now is the time for all good men ...''' now is the time for all good men ... It's not easy to visually distinguish two

Re: end quote help for a newbie

2014-01-30 Thread MRAB
On 2014-01-30 13:26, Peter Clark wrote: There is probably an easy solution to this – but I have not found it. Trying to terminate a literal in a print statement (from the tutorial). The literal should be enclosed in double quotes “ “ the initial double quote seems to be OK (if I use a different

Re: 1 0 == True - False

2014-01-30 Thread Thibault Langlois
On Thursday, January 30, 2014 12:49:19 PM UTC, Dave Angel wrote: Thibault Langlois thibault.langl...@gmail.com Wrote in message: Hello, $ python Python 2.7.4 (default, Sep 26 2013, 03:20:26) [GCC 4.7.3] on linux2 Type help, copyright, credits or license for more

Convert NTP timestamp from NTP packet to System time and date format

2014-01-30 Thread Sadia Bashir
Hello everyone; I want to write NTP client which sends and receives NTP packet to NTP server and should read the value from one of the four offsets and convert it to user readable local or GMT time format, I specifically want to know which offsets should I read in order to get correct timestamp

Re: fseek In Compressed Files

2014-01-30 Thread Chris Angelico
On Fri, Jan 31, 2014 at 12:34 AM, Ayushi Dalmia ayushidalmia2...@gmail.com wrote: where temp.txt is the posting list file which is first written in a compressed format and then read later. Unless you specify otherwise, a compressed file is likely to have sub-byte boundaries. It might not be

Re: 1 0 == True - False

2014-01-30 Thread Chris Angelico
On Fri, Jan 31, 2014 at 12:40 AM, Thibault Langlois thibault.langl...@gmail.com wrote: The recommendations to student are 1) do not assume True == 1 and do not use operator chaining. Not do not use, but do not misuse. Python's operator chaining is awesome for bounds checking: if 3 x 20:

Re: Convert NTP timestamp from NTP packet to System time and date format

2014-01-30 Thread Chris Angelico
On Fri, Jan 31, 2014 at 12:34 AM, Sadia Bashir 11msccssbas...@seecs.edu.pk wrote: Hello everyone; I want to write NTP client which sends and receives NTP packet to NTP server and should read the value from one of the four offsets and convert it to user readable local or GMT time format, I

Re: Add directory to sys.path based on variable

2014-01-30 Thread loial
Ok, that works fine with the apth hard coded, but I want to do something like the code below. i.e I am trying to dynamically add a path that is relative to the path of the current executing python script. In this case the import fails. import sys import os from os.path import *

Re: 1 0 == True - False

2014-01-30 Thread Roy Smith
In article 3dcdc95d-5e30-46d3-b558-afedf9723...@googlegroups.com, Thibault Langlois thibault.langl...@gmail.com wrote: You are right. I should have given some context. I am looking at this from the perspective of the teacher that has to explain idiosyncrasies of the language to inexperienced

Re: Add directory to sys.path based on variable

2014-01-30 Thread Chris Angelico
On Fri, Jan 31, 2014 at 1:03 AM, loial jldunn2...@gmail.com wrote: In this case the import fails. import sys import os from os.path import * Not sure why you need that, since you're explicitly naming os.path.dirname. The base import os shoul cover that for you.

Re: Add directory to sys.path based on variable

2014-01-30 Thread Tim Golden
On 30/01/2014 14:03, loial wrote: Ok, that works fine with the apth hard coded, but I want to do something like the code below. i.e I am trying to dynamically add a path that is relative to the path of the current executing python script. In this case the import fails. import sys

Re: end quote help for a newbie

2014-01-30 Thread Zachary Ware
On Thu, Jan 30, 2014 at 7:26 AM, Peter Clark artomis...@yahoo.co.uk wrote: There is probably an easy solution to this – but I have not found it. Trying to terminate a literal in a print statement (from the tutorial). The literal should be enclosed in double quotes “ “ the initial double

Re: 1 0 == True - False

2014-01-30 Thread Chris Angelico
On Fri, Jan 31, 2014 at 1:08 AM, Roy Smith r...@panix.com wrote: Better than that, do what I do. 1) Assume that you don't have the full operator precedence table memorized and just parenthesize everything. Or: 1a) Assume that you don't have the full operator precedence table memorized and

Re: Add directory to sys.path based on variable

2014-01-30 Thread loial
Idiot that I am...I was not calling the script with the full path ! Thanks for your help -- https://mail.python.org/mailman/listinfo/python-list

Re: 1 0 == True - False

2014-01-30 Thread Devin Jeanpierre
On Thu, Jan 30, 2014 at 6:08 AM, Roy Smith r...@panix.com wrote: 1) Assume that you don't have the full operator precedence table memorized and just parenthesize everything. 2) In cases where the expression is so simple, you couldn't possibly be wrong, see rule #1. Also, assume you don't

Re: end quote help for a newbie

2014-01-30 Thread Steven D'Aprano
On Thu, 30 Jan 2014 13:26:16 +, Peter Clark wrote: There is probably an easy solution to this – but I have not found it. Trying to terminate a literal in a print statement (from the tutorial). I don't understand the problem. Perhaps if you show us what you have tried, and the error you

Re: 1 0 == True - False

2014-01-30 Thread Thibault Langlois
On Thursday, January 30, 2014 2:08:58 PM UTC, Roy Smith wrote: In article 3dcdc95d-5e30-46d3-b558-afedf9723...@googlegroups.com, Thibault Langlois thibault.langl...@gmail.com wrote: You are right. I should have given some context. I am looking at this from the perspective of the

Re: 1 0 == True - False

2014-01-30 Thread Roy Smith
In article mailman.6143.1391091519.18130.python-l...@python.org, Chris Angelico ros...@gmail.com wrote: On Fri, Jan 31, 2014 at 1:08 AM, Roy Smith r...@panix.com wrote: Better than that, do what I do. 1) Assume that you don't have the full operator precedence table memorized and just

Re: 1 0 == True - False

2014-01-30 Thread Jussi Piitulainen
Roy Smith writes: In article 3dcdc95d-5e30-46d3-b558-afedf9723...@googlegroups.com, Thibault Langlois wrote: You are right. I should have given some context. I am looking at this from the perspective of the teacher that has to explain idiosyncrasies of the language to inexperienced

Re: 1 0 == True - False

2014-01-30 Thread Chris Angelico
On Fri, Jan 31, 2014 at 1:49 AM, Roy Smith r...@panix.com wrote: In article mailman.6143.1391091519.18130.python-l...@python.org, Chris Angelico ros...@gmail.com wrote: On Fri, Jan 31, 2014 at 1:08 AM, Roy Smith r...@panix.com wrote: Better than that, do what I do. 1) Assume that you

Re: fseek In Compressed Files

2014-01-30 Thread Serhiy Storchaka
30.01.14 13:28, Peter Otten написав(ла): Ayushi Dalmia wrote: I need to randomly access a bzip2 or gzip file. How can I set the offset for a line and later retreive the line from the file using the offset. Pointers in this direction will help. with gzip.open(filename) as f:

Re: 1 0 == True - False

2014-01-30 Thread Steven D'Aprano
On Thu, 30 Jan 2014 09:08:58 -0500, Roy Smith wrote: 1) Assume that you don't have the full operator precedence table memorized and just parenthesize everything. Oh really? Do you actually write stuff like this? b = ((2*a) + 1) if (b = (-1)): ... I would hope not. 2) In cases where

Re: Convert NTP timestamp from NTP packet to System time and date format

2014-01-30 Thread Johannes Findeisen
On Thu, 30 Jan 2014 18:34:04 +0500 Sadia Bashir wrote: Hello everyone; I want to write NTP client which sends and receives NTP packet to NTP server and should read the value from one of the four offsets and convert it to user readable local or GMT time format, I specifically want to know

Re: pytz question: GMT vs. UTC

2014-01-30 Thread Larry Martell
On Thu, Jan 30, 2014 at 10:23 AM, Grant Edwards invalid@invalid.invalid wrote: On 2014-01-30, Christian Heimes christ...@python.org wrote: On 30.01.2014 04:27, Chris Angelico wrote: On Thu, Jan 30, 2014 at 1:40 PM, MRAB pyt...@mrabarnett.plus.com wrote: How cruel... I suspect the smack

Re: pytz question: GMT vs. UTC

2014-01-30 Thread Grant Edwards
On 2014-01-30, Christian Heimes christ...@python.org wrote: On 30.01.2014 04:27, Chris Angelico wrote: On Thu, Jan 30, 2014 at 1:40 PM, MRAB pyt...@mrabarnett.plus.com wrote: How cruel... I suspect the smack at 0degC is much more painful than one at room temperature G It's the 21st

Re: pytz question: GMT vs. UTC

2014-01-30 Thread Grant Edwards
On 2014-01-30, wxjmfa...@gmail.com wxjmfa...@gmail.com wrote: The temperature unit is the Kelvin, not the Degree Kelvin. One writes: 0 K, 275.15 K And remember to say Kelvins not Kelvin when speaking about temperatures other than 1 K. -- Grant Edwards grant.b.edwards

Re: end quote help for a newbie

2014-01-30 Thread Zachary Ware
Please reply to the list, rather than to me directly. You can use Reply to List if you have that option, or Reply to All to make sure you include the list. On Thu, Jan 30, 2014 at 8:52 AM, Peter Clark artomis...@yahoo.co.uk wrote: I do not know how to dump the screen - it will not let me select

Re: 1 0 == True - False

2014-01-30 Thread Rustom Mody
On Thursday, January 30, 2014 8:39:03 PM UTC+5:30, Steven D'Aprano wrote: On Thu, 30 Jan 2014 09:08:58 -0500, Roy Smith wrote: 1) Assume that you don't have the full operator precedence table memorized and just parenthesize everything. Oh really? Do you actually write stuff like this? b

Re: fseek In Compressed Files

2014-01-30 Thread Ayushi Dalmia
On Thursday, January 30, 2014 4:20:26 PM UTC+5:30, Ayushi Dalmia wrote: Hello, I need to randomly access a bzip2 or gzip file. How can I set the offset for a line and later retreive the line from the file using the offset. Pointers in this direction will help. We are not allowed to

[ANN] Last news from Python FOSDEM 2014

2014-01-30 Thread Stéphane Wirtel
Python @ FOSDEM 2014 Hi all, Last news about the Python devroom at FOSDEM 2014 [1] Schedule There is a last change in the schedule, PyPy: a fast Python Virtual Machine will replace Web Scraping 101 in Python. Yasoob can't be present in Belgium :/

[ANN] Last news from Python FOSDEM 2014

2014-01-30 Thread Stéphane Wirtel
Python @ FOSDEM 2014 Hi all, Last news about the Python devroom at FOSDEM 2014 [1] Schedule There is a last change in the schedule, PyPy: a fast Python Virtual Machine will replace Web Scraping 101 in Python. Yasoob can't be present in Belgium :/

Re: fseek In Compressed Files

2014-01-30 Thread Peter Otten
Serhiy Storchaka wrote: 30.01.14 13:28, Peter Otten написав(ла): Ayushi Dalmia wrote: I need to randomly access a bzip2 or gzip file. How can I set the offset for a line and later retreive the line from the file using the offset. Pointers in this direction will help. with

Another surprise from the datetime module

2014-01-30 Thread Roy Smith
I was astounded just now to discover that datetime.timedelta doesn't have a replace() method (at least not in Python 2.7). Is there some fundamental reason why it shouldn't, or is this just an oversight? My immediate use case was wanting to print a timedelta without the fractions of seconds.

Re: 1 0 == True - False

2014-01-30 Thread Mark Lawrence
On 30/01/2014 14:46, Thibault Langlois wrote: On Thursday, January 30, 2014 2:08:58 PM UTC, Roy Smith wrote: In article 3dcdc95d-5e30-46d3-b558-afedf9723...@googlegroups.com, Thibault Langlois thibault.langl...@gmail.com wrote: You are right. I should have given some context. I am

Re: Another surprise from the datetime module

2014-01-30 Thread Mark Lawrence
On 30/01/2014 17:32, Roy Smith wrote: I was astounded just now to discover that datetime.timedelta doesn't have a replace() method (at least not in Python 2.7). Is there some fundamental reason why it shouldn't, or is this just an oversight? My immediate use case was wanting to print a

Re: Try-except-finally paradox

2014-01-30 Thread Rotwang
On 30/01/2014 06:33, Andrew Berg wrote: On 2014.01.29 23:56, Jessica Ross wrote: I found something like this in a StackOverflow discussion. def paradox(): ... try: ... raise Exception(Exception raised during try) ... except: ... print Except after try ...

Re: Another surprise from the datetime module

2014-01-30 Thread Neil Cerutti
On 2014-01-30, Roy Smith r...@panix.com wrote: I was astounded just now to discover that datetime.timedelta doesn't have a replace() method (at least not in Python 2.7). Is there some fundamental reason why it shouldn't, or is this just an oversight? My immediate use case was wanting to

Re: fseek In Compressed Files

2014-01-30 Thread Dave Angel
Ayushi Dalmia ayushidalmia2...@gmail.com Wrote in message: On Thursday, January 30, 2014 4:20:26 PM UTC+5:30, Ayushi Dalmia wrote: Hello, I need to randomly access a bzip2 or gzip file. How can I set the offset for a line and later retreive the line from the file using the offset.

Re: 1 0 == True - False

2014-01-30 Thread Roy Smith
On Thursday, January 30, 2014 9:56:19 AM UTC-5, Jussi Piitulainen wrote: There's nothing to parenthesize in x = y z = w Hmm x = y z = w File stdin, line 1 SyntaxError: can't assign to comparison I don't think any number of parentheses will help that :-) --

Re: Try-except-finally paradox

2014-01-30 Thread Ethan Furman
On 01/30/2014 10:12 AM, Rotwang wrote: On 30/01/2014 06:33, Andrew Berg wrote: On 2014.01.29 23:56, Jessica Ross wrote: I found something like this in a StackOverflow discussion. -- def paradox(): ... try: ... raise Exception(Exception raised during try) ... except: ...

Re: 1 0 == True - False

2014-01-30 Thread Roy Smith
On Thursday, January 30, 2014 10:09:03 AM UTC-5, Steven D'Aprano wrote: On Thu, 30 Jan 2014 09:08:58 -0500, Roy Smith wrote: 1) Assume that you don't have the full operator precedence table memorized and just parenthesize everything. Oh really? Do you actually write stuff like this? b

Re: 1 0 == True - False

2014-01-30 Thread Roy Smith
On Thursday, January 30, 2014 10:09:03 AM UTC-5, Steven D'Aprano wrote: E.g. `x+1 0 and y = 5` is potentially as many as 9 distinct items to keep in short-term memory. But bracketing some terms as in `(x+1 0) and (y = 5)` can reduce that down to as few as two items. Yes,

Re: 1 0 == True - False

2014-01-30 Thread Chris Angelico
On Fri, Jan 31, 2014 at 5:56 AM, Roy Smith r...@panix.com wrote: On Thursday, January 30, 2014 10:09:03 AM UTC-5, Steven D'Aprano wrote: E.g. `x+1 0 and y = 5` is potentially as many as 9 distinct items to keep in short-term memory. But bracketing some terms as in `(x+1 0) and

Re: end quote help for a newbie

2014-01-30 Thread Peter Clark
Thank-you.  Please no-one reply to this post.  I just want to put on record my complete p-offed-ness, that having spent 10 days sorting out and hypertexting a library of documentation, I now have to start all over. Please do not respond, I am sure it is all my fault. Please do not respond - it

Re: 1 0 == True - False

2014-01-30 Thread Rotwang
On 30/01/2014 12:49, Dave Angel wrote: [...] For hysterical reasons, True and False are instances of class bool, which is derived from int. So for comparison purposes False==0 and True==1. But in my opinion, you should never take advantage of this, except when entering obfuscation

Re: 1 0 == True - False

2014-01-30 Thread Ethan Furman
On 01/30/2014 11:03 AM, Chris Angelico wrote: On Fri, Jan 31, 2014 at 5:56 AM, Roy Smith wrote: Yes, that's probably how I would write that, although, this is even simpler: (x -1) and (y = 5) Be careful; that's not the same thing. How so? -- ~Ethan~ --

Re: 1 0 == True - False

2014-01-30 Thread Chris Angelico
Fri, Jan 31, 2014 at 6:22 AM, Ethan Furman et...@stoneleaf.us wrote: On 01/30/2014 11:03 AM, Chris Angelico wrote: On Fri, Jan 31, 2014 at 5:56 AM, Roy Smith wrote: Yes, that's probably how I would write that, although, this is even simpler: (x -1) and (y = 5) Be careful; that's not

Re: 1 0 == True - False

2014-01-30 Thread Dave Angel
Rotwang sg...@hotmail.co.uk Wrote in message: On 30/01/2014 12:49, Dave Angel wrote: [...] For hysterical reasons, True and False are instances of class bool, which is derived from int. So for comparison purposes False==0 and True==1. But in my opinion, you should never take

Re: 1 0 == True - False

2014-01-30 Thread Chris Angelico
On Fri, Jan 31, 2014 at 7:08 AM, Dave Angel da...@davea.name wrote: 'You have scored %i point%s' % (score, 's'*(score != 1)) Here I'd probably do something like 'You have scored {} {}' .format (score, 'point' if score==1 else 'points') Bah, what's the fun in that? 'You have scored %i

Re: 1 0 == True - False

2014-01-30 Thread Jussi Piitulainen
Roy Smith writes: On Thursday, January 30, 2014 9:56:19 AM UTC-5, Jussi Piitulainen wrote: There's nothing to parenthesize in x = y z = w Hmm x = y z = w File stdin, line 1 SyntaxError: can't assign to comparison I don't think any number of parentheses will help that :-)

Re: 1 0 == True - False

2014-01-30 Thread Chris Angelico
On Fri, Jan 31, 2014 at 7:14 AM, Jussi Piitulainen jpiit...@ling.helsinki.fi wrote: I don't think any number of parentheses will help that :-) Er, sorry about that. Here: x = y z == w Traceback (most recent call last): File stdin, line 1, in module NameError: name 'x' is not defined

Re: 1 0 == True - False

2014-01-30 Thread Ian Kelly
On Thu, Jan 30, 2014 at 1:08 PM, Dave Angel da...@davea.name wrote: Rotwang sg...@hotmail.co.uk Wrote in message: Really? I take advantage of it quite a lot. For example, I do things like this: 'You have scored %i point%s' % (score, 's'*(score != 1)) I also did that kind of thing when

Re: 1 0 == True - False

2014-01-30 Thread Chris Angelico
On Fri, Jan 31, 2014 at 7:28 AM, Ian Kelly ian.g.ke...@gmail.com wrote: Of course if you're at all concerned about i18n then the proper way to do it would be: ngettext(You have scored %d point, You have scored %d points, score) % score Ugh, so much duplication! We can totally do better than

Re: 1 0 == True - False

2014-01-30 Thread Ian Kelly
On Jan 30, 2014 1:40 PM, Chris Angelico ros...@gmail.com wrote: On Fri, Jan 31, 2014 at 7:28 AM, Ian Kelly ian.g.ke...@gmail.com wrote: Of course if you're at all concerned about i18n then the proper way to do it would be: ngettext(You have scored %d point, You have scored %d points,

Re: 1 0 == True - False

2014-01-30 Thread Chris Angelico
On Fri, Jan 31, 2014 at 8:17 AM, Ian Kelly ian.g.ke...@gmail.com wrote: Why is tuple unpacking limited to the last argument? Is it just for the parallel with the function definition, where anything following it is keyword-only? Lack of a convincing use case, and the position of the following

Statement evals as False in my IDE and True elsewhere

2014-01-30 Thread CM
This is puzzling. (Using Python 2.5, WinXP, Boa Constructor 0.6.1 definitely running the code through Python 2.5) If I run these lines in my program, through my IDE (Boa Constructor), fake_data = ['n/a', 'n/a', 'n/a', 'n/a', '[omitted]', '12'] fake_result = not all(i == '[omitted]'

Re: 1 0 == True - False

2014-01-30 Thread Roy Smith
On Thursday, January 30, 2014 10:09:03 AM UTC-5, Steven D'Aprano wrote: `(x+1 0) and (y = 5)` Me: this is even simpler: (x -1) and (y = 5) On Thursday, January 30, 2014 2:03:42 PM UTC-5, Chris Angelico wrote: Be careful; that's not the same thing. In what way? I'm assuming x is some

Re: Statement evals as False in my IDE and True elsewhere

2014-01-30 Thread Peter Otten
CM wrote: This is puzzling. (Using Python 2.5, WinXP, Boa Constructor 0.6.1 definitely running the code through Python 2.5) If I run these lines in my program, through my IDE (Boa Constructor), fake_data = ['n/a', 'n/a', 'n/a', 'n/a', '[omitted]', '12'] fake_result = not all(i

Re: 1 0 == True - False

2014-01-30 Thread Chris Angelico
On Fri, Jan 31, 2014 at 9:09 AM, Roy Smith r...@panix.com wrote: On Thursday, January 30, 2014 10:09:03 AM UTC-5, Steven D'Aprano wrote: `(x+1 0) and (y = 5)` Me: this is even simpler: (x -1) and (y = 5) On Thursday, January 30, 2014 2:03:42 PM UTC-5, Chris Angelico wrote: Be careful;

Re: Statement evals as False in my IDE and True elsewhere

2014-01-30 Thread Chris Angelico
On Fri, Jan 31, 2014 at 9:04 AM, CM cmpyt...@gmail.com wrote: fake_data = ['n/a', 'n/a', 'n/a', 'n/a', '[omitted]', '12'] fake_result = not all(i == '[omitted]' for i in fake_data) print 'This is fake result: ', fake_result Trying to get my head around this. You want to see if all

Why this throws an UnboundLocalError ?

2014-01-30 Thread Marc Aymerich
Dear all, I have a very simple module glic3@e4200:# cat globalstate.py GLOBAL = 0 def update(): GLOBAL += 1 however it doesn't work!! glic3@e4200:# python Python 2.7.3 (default, Aug 1 2012, 05:14:39) [GCC 4.6.3] on linux2 Type help, copyright, credits or license for more information.

Re: Statement evals as False in my IDE and True elsewhere

2014-01-30 Thread CM
On Thursday, January 30, 2014 5:14:57 PM UTC-5, Peter Otten wrote: Hint: def demo(): ... fake_data = ['n/a', 'n/a', 'n/a', 'n/a', '[omitted]', '12'] ... fake_result = not all(i == '[omitted]' for i in fake_data) ... print 'This is fake result: ', fake_result demo() This

Re: Why this throws an UnboundLocalError ?

2014-01-30 Thread Chris Angelico
On Fri, Jan 31, 2014 at 9:46 AM, Marc Aymerich glicer...@gmail.com wrote: GLOBAL = 0 def update(): GLOBAL += 1 If you assign to a name, Python makes it local, unless you explicitly tell it that you want it to be global: def update(): global GLOBAL GLOBAL += 1 But be aware that

Re: Why this throws an UnboundLocalError ?

2014-01-30 Thread Mark Lawrence
On 30/01/2014 22:46, Marc Aymerich wrote: Dear all, I have a very simple module glic3@e4200:# cat globalstate.py GLOBAL = 0 def update(): GLOBAL += 1 however it doesn't work!! glic3@e4200:# python Python 2.7.3 (default, Aug 1 2012, 05:14:39) [GCC 4.6.3] on linux2 Type help,

Re: Why this throws an UnboundLocalError ?

2014-01-30 Thread Ned Batchelder
On 1/30/14 5:46 PM, Marc Aymerich wrote: Dear all, I have a very simple module glic3@e4200:# cat globalstate.py GLOBAL = 0 def update(): GLOBAL += 1 however it doesn't work!! glic3@e4200:# python Python 2.7.3 (default, Aug 1 2012, 05:14:39) [GCC 4.6.3] on linux2 Type help, copyright,

Re: Statement evals as False in my IDE and True elsewhere

2014-01-30 Thread Chris Angelico
On Fri, Jan 31, 2014 at 9:48 AM, CM cmpyt...@gmail.com wrote: builtin_all = __builtins__.all but I got the error: AttributeError: 'dict' object has no attribute 'all' Try using square brackets notation instead. Apparently your __builtins__ is a dictionary, not a module, though I don't know

Re: Statement evals as False in my IDE and True elsewhere

2014-01-30 Thread CM
Try using square brackets notation instead. Apparently your __builtins__ is a dictionary, not a module, though I don't know why (probably something to do with numpy, which I've never actually used). But try this: builtin_all = __builtins__[all] It might work. Yes, it does. Thanks! Che

Re: Statement evals as False in my IDE and True elsewhere

2014-01-30 Thread CM
On Thursday, January 30, 2014 5:25:31 PM UTC-5, Chris Angelico wrote: On Fri, Jan 31, 2014 at 9:04 AM, CM cmpyt...@gmail.com wrote: fake_data = ['n/a', 'n/a', 'n/a', 'n/a', '[omitted]', '12'] fake_result = not all(i == '[omitted]' for i in fake_data) print 'This is fake

HOW EVOLUTIONISTS MISUSE SCIENCE

2014-01-30 Thread CHAIRMAN THRINAXODON OF THE COMMUNIST PARTY OF CANADA
http://www.talkorigins.org/ Vs http://www.trueorigin.org/ WHICH ONE'S TRUE? This one!: http://www.trueorigin.org/ -- Thrinaxodon, The Ultimate Defender of USENET -- https://mail.python.org/mailman/listinfo/python-list

Re: Statement evals as False in my IDE and True elsewhere

2014-01-30 Thread Peter Otten
CM wrote: On Thursday, January 30, 2014 5:14:57 PM UTC-5, Peter Otten wrote: Hint: def demo(): ... fake_data = ['n/a', 'n/a', 'n/a', 'n/a', '[omitted]', '12'] ... fake_result = not all(i == '[omitted]' for i in fake_data) ... print 'This is fake result: ', fake_result

  1   2   >