Le jeudi 30 janvier 2014 04:27:54 UTC+1, Chris Angelico a écrit :
> On Thu, Jan 30, 2014 at 1:40 PM, MRAB wrote:
>
> >> How cruel... I suspect the smack at 0degC is much more painful
>
> >> than one
>
> >> at room temperature
>
> >>
>
> > It's the 21st century; you should be making u
On 1/29/2014 11:16 PM, Ben Finney wrote:
Terry Reedy 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 not. What i
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
On 30.01.2014 04:27, Chris Angelico wrote:
> On Thu, Jan 30, 2014 at 1:40 PM, MRAB wrote:
>>> How cruel... I suspect the smack at 0degC is much more painful
>>> than one
>>> at room temperature
>>>
>> It's the 21st century; you should be making use of Unicode: 0°C.
>
> I started to read
On Thu, Jan 30, 2014 at 8:49 PM, Christian Heimes wrote:
> On 30.01.2014 04:27, Chris Angelico wrote:
>> On Thu, Jan 30, 2014 at 1:40 PM, MRAB wrote:
How cruel... I suspect the smack at 0degC is much more painful
than one
at room temperature
>>> It's the 21st century;
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 wrote:
>
> >>> How cruel... I suspect the smack at 0degC is much more painful
>
> >>> than one
>
> >>> at room temperature
>
>
[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,
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
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())
f.seek(s
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/mailma
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)
--
https://mail.python.org/mailman
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 a
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 wrote:
>> How cruel... I suspect the smack at 0degC is much more painful
>> than one
>> at room temperature
>>
> It's the 21st ce
Ayushi Dalmia 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 it doesn't handle all
Jessica Ross 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
> ... fina
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
>> >>>
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
> >>
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
--
https://mail.python.org/ma
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 u
Thibault Langlois 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
>
>
On Thu, Jan 30, 2014 at 11:05 PM, Dave Angel 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 other returns. Th
On 2014-01-30 13:02, Chris Angelico wrote:
On Thu, Jan 30, 2014 at 11:05 PM, Dave Angel 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
wi
On Fri, Jan 31, 2014 at 12:11 AM, MRAB 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():
output = open("output.txt",
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
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 hav
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 disting
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 c
On Thursday, January 30, 2014 12:49:19 PM UTC, Dave Angel wrote:
> Thibault Langlois 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 informati
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 fr
On Fri, Jan 31, 2014 at 12:34 AM, Ayushi Dalmia
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 possible to seek to a spec
On Fri, Jan 31, 2014 at 12:40 AM, Thibault Langlois
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:
print("x is between 3
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,
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 *
scriptpath=os.p
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 students.
> There are
On Fri, Jan 31, 2014 at 1:03 AM, loial 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.
> scriptpath=os.path.dirname(sys.argv[0])
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
On Thu, Jan 30, 2014 at 7:26 AM, 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 O
On Fri, Jan 31, 2014 at 1:08 AM, Roy Smith 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 just look it
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
On Thu, Jan 30, 2014 at 6:08 AM, Roy Smith 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 have the func
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 yo
On Thursday, January 30, 2014 2:08:58 PM UTC, Roy Smith wrote:
> 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
In article ,
Chris Angelico wrote:
> On Fri, Jan 31, 2014 at 1:08 AM, Roy Smith 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 fu
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 inexpe
On Fri, Jan 31, 2014 at 1:49 AM, Roy Smith wrote:
> In article ,
> Chris Angelico wrote:
>
>> On Fri, Jan 31, 2014 at 1:08 AM, Roy Smith wrote:
>> > Better than that, do what I do.
>> >
>> > 1) Assume that you don't have the full operator precedence table
>> > memorized and just parenthesize ev
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:
f.seek(some_p
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 wher
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 kno
On Thu, Jan 30, 2014 at 10:23 AM, Grant Edwards wrote:
> On 2014-01-30, Christian Heimes wrote:
>> On 30.01.2014 04:27, Chris Angelico wrote:
>>> On Thu, Jan 30, 2014 at 1:40 PM, MRAB wrote:
> How cruel... I suspect the smack at 0degC is much more painful
> than one
> at room
On 2014-01-30, Christian Heimes wrote:
> On 30.01.2014 04:27, Chris Angelico wrote:
>> On Thu, Jan 30, 2014 at 1:40 PM, MRAB wrote:
How cruel... I suspect the smack at 0degC is much more painful
than one
at room temperature
>>> It's the 21st century; you should be mak
On 2014-01-30, 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.edwardsYow! BELA LUG
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 wrote:
> I do not know how to dump the screen - it will not let me select anything
> with t
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?
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
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 :/
+
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 :/
+
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
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. The
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 wrote:
You are right. I should have given some context.
I am looking at this from the pers
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 timedelt
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"
...
On 2014-01-30, 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 timed
Ayushi Dalmia 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. Pointers
>> in th
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 "", line 1
SyntaxError: can't assign to comparison
I don't think any number of parentheses will help that :-)
--
https://mail.python.or
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:
...
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 thi
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.
On Fri, Jan 31, 2014 at 5:56 AM, Roy Smith 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 (y >=
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
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
cont
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~
--
https://mail.python.org/mailman/l
Fri, Jan 31, 2014 at 6:22 AM, Ethan Furman 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;
Rotwang 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
>> advantage of
On Fri, Jan 31, 2014 at 7:08 AM, Dave Angel 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 point%.*s'
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 "", line 1
> SyntaxError: can't assign to comparison
>
> I don't think any number of parentheses will
On Fri, Jan 31, 2014 at 7:14 AM, Jussi Piitulainen
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 "", line 1, in
> NameError: name 'x' is not defined
>
> Much better :)
See,
On Thu, Jan 30, 2014 at 1:08 PM, Dave Angel wrote:
> Rotwang 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 computer resources
> were
On Fri, Jan 31, 2014 at 7:28 AM, Ian Kelly 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 that.
ngett
On Jan 30, 2014 1:40 PM, "Chris Angelico" wrote:
>
> On Fri, Jan 31, 2014 at 7:28 AM, Ian Kelly 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, s
On Fri, Jan 31, 2014 at 8:17 AM, Ian Kelly 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 arguments
> wo
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]' for
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 so
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 a
On Fri, Jan 31, 2014 at 9:09 AM, Roy Smith 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;
On Fri, Jan 31, 2014 at 9:04 AM, CM 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 the values
in fa
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 informat
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
>
> >>> d
On Fri, Jan 31, 2014 at 9:46 AM, Marc Aymerich 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 the ALL_CAPS name
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", "copyrig
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", "copyrigh
On Fri, Jan 31, 2014 at 9:48 AM, CM 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 why
(probably s
> 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. Tha
On Thursday, January 30, 2014 5:25:31 PM UTC-5, Chris Angelico wrote:
> On Fri, Jan 31, 2014 at 9:04 AM, CM 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: ',
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
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: ', f
On Fri, Jan 31, 2014 at 10:00 AM, CM wrote:
> Essentially, if ALL the items in that list are '[omitted]', I must not
> process the list, but if even one of them is something other than
> '[omitted]', I need to process it.
Okay. The set example that I gave will work, then - as long as all
items
On 30 January 2014 20:38, Chris Angelico 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?
You're not the first person to ask that:
http://www.python.org/dev/peps/pep-0448/
If
On Fri, Jan 31, 2014 at 10:36 AM, Joshua Landau wrote:
> On 30 January 2014 20:38, Chris Angelico 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?
>
> You're not the first
On 30/01/2014 23:36, Joshua Landau wrote:
On 30 January 2014 20:38, Chris Angelico 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?
You're not the first person to ask that:
http:
Rotwang writes:
> On a vaguely-related note, does anyone know why iterable unpacking in
> calls was removed in Python 3?
This is explained in the PEP which described its removal
http://www.python.org/dev/peps/pep-3113/>, especially
http://www.python.org/dev/peps/pep-3113/#why-they-should-go>.
-
1 - 100 of 132 matches
Mail list logo