Buck Golemon wrote:
> I feel like the design of sum() is inconsistent with other language
> features of python. Often python doesn't require a specific type, only
> that the type implement certain methods.
>
> Given a class that implements __add__ why should sum() not be able to
> operate on that
Andrew Berg writes:
> On 2/23/2012 4:43 PM, Dave Angel wrote:
> > First thing I'd do is to disable tab logic in the editor. When you
> > press the tab key, there's no excuse for an editor to actually put a tab
> > in the file. It should adjust the column by adding the appropriate
> > number
Ethan Furman wrote:
> Steven D'Aprano wrote:
>> On Thu, 23 Feb 2012 16:30:09 -0800, Alex Willmer wrote:
>>
>>> This week I was slightly surprised by a behaviour that I've not
>>> considered before. I've long used
>>>
>>> for i, x in enumerate(seq):
>>># do stuff
>>>
>>> as a standard looping-
Hello,
when I have Python subtract floating point numbers it yields weird
results. Example:
4822.40 - 4785.52 = 36.87992
Why doesn't Python simply yield the correct result? It doesn't have a
problem with this:
482240 - 478552 = 3688
Can I tell Python in some way to do this differently?
Jaroslav Dobrek writes:
> when I have Python subtract floating point numbers it yields weird
> results. Example:
>
> 4822.40 - 4785.52 = 36.87992
We've had this discussion here one or two days ago...
The usual answer is: please read "What Every Computer Scientist Should
Know About Float
Il 24 febbraio 2012 02:10, Plumo ha scritto:
> that example is excellent - best use of asynchat I have seen so far.
>
> I read through the python-dev archives and found the fundamental problem is
> no one maintains asnycore / asynchat.
Well, actually I do/did.
Point with asyncore/asynchat is tha
On 2/24/2012 2:32 AM, Ben Finney wrote:
> Are you referring to novice programmers – who, by any reasonable
> definition of “novice”, don't have an opinion on the tabs-versus-spaces
> indentation debate?
>
> Or are you talking about people who are experienced enough to have an
> opinion and expect
On Fri, Feb 24, 2012 at 12:41 AM, Jaroslav Dobrek
wrote:
> Hello,
>
> when I have Python subtract floating point numbers it yields weird
> results. Example:
>
> 4822.40 - 4785.52 = 36.87992
>
> Why doesn't Python simply yield the correct result? It doesn't have a
> problem with this:
>
> 4
Thanks. It was very simple with using 'pickle'.
Thanks.
--
On Thu, Feb 23, 2012 at 4:01 PM, Jean-Michel Pichavant <
jeanmic...@sequans.com> wrote:
> Smiley 4321 wrote:
>
>> It requires concepts of 'python persistence' for the code to be designed .
>>
>> Else it simple.
>>
>> Looking for
On 23/02/2012 23:13, Manish Sharma wrote:
Hi I am new to python language. On my first day, somebody told me that
if any python script file is opened with any editor except python
editor, the file is corrupted. Some spacing or indentation is changed
and script stops working. I was opening the scri
Andrew Berg wrote:
> Yes. However, there are many editors for various platforms that handle
> the different line endings just fine. In fact, Notepad is the only
> editor I can think of off the top of my head that has an issue.
The original question was about Notepad++ which is nothing at all lik
On 2/24/2012 5:21 AM, Duncan Booth wrote:
> The original question was about Notepad++ which is nothing at all like
> Notepad.
And I did give the OP an answer about Notepad++ specifically in another
message.
--
CPython 3.2.2 | Windows NT 6.1.7601.17640
--
http://mail.python.org/mailman/listinfo/
On 02/24/2012 12:33 AM, Steven D'Aprano wrote:
If your application stops working after you carelessly mess with
components your application relies on, the right answer is usually:
"Don't do that then."
Python doesn't try to prevent people from shooting themselves in the foot.
Yes it does! A
Stefan Behnel wrote:
> I know that you just meant this as an example, but it's worth
> mentioning in this context that it's not exactly efficient to "sum up"
> lists this way because there is a lot of copying involved. Each adding
> of two lists creates a third one and copies all elements into it
xixiliguo wrote:
c = [1, 2, 3, 4, 5]
class TEST():
c = [5, 2, 3, 4, 5]
def add( self ):
c[0] = 15
a = TEST()
a.add()
print( c, a.c, TEST.c )
result :
[15, 2, 3, 4, 5] [5, 2, 3, 4, 5] [5, 2, 3, 4, 5]
why a.add() do not update c in Class TEST? but update c in main file
A
On Fri, 24 Feb 2012 03:18:18 -0600, Andrew Berg wrote:
> On 2/24/2012 2:32 AM, Ben Finney wrote:
>> Are you referring to novice programmers – who, by any reasonable
>> definition of “novice”, don't have an opinion on the tabs-versus-spaces
>> indentation debate?
>>
>> Or are you talking about peo
Python 3.2 includes turtledemo, a demonstration program for the turtle
module.
When I run it, I can load the turtle scripts, and the GUI application
says "Press the start button", but there is no start button.
Can anyone else confirm this as a bug?
http://docs.python.org/py3k/library/turtle.ht
On Feb 23, 6:30 pm, Alex Willmer wrote:
> [...]
> as a standard looping-with-index construct. In Python for loops don't
> create a scope, so the loop variables are available afterward. I've
> sometimes used this to print or return a record count e.g.
>
> for i, x in enumerate(seq):
> # do stuff
On 24 February 2012 12:25, Steven D'Aprano
wrote:
> Python 3.2 includes turtledemo, a demonstration program for the turtle
> module.
>
> When I run it, I can load the turtle scripts, and the GUI application
> says "Press the start button", but there is no start button.
>
> Can anyone else confirm
Rick Johnson wrote:
> On Feb 23, 6:30 pm, Alex Willmer wrote:
>> [...]
>> as a standard looping-with-index construct. In Python for loops don't
>> create a scope, so the loop variables are available afterward. I've
>> sometimes used this to print or return a record count e.g.
>>
>> for i, x in en
Peter Otten wrote:
> The code in the else suite executes only when the for loop is left via
> break.
Oops, the following statement is nonsense:
> A non-empty iterable is required but not sufficient.
Let me try again:
A non-empty iterable is required but not sufficient to *skip* the else-suite
In article ,
Thomas Rachel
wrote:
> Not only that, [hard and symbolic links] have slightly different
> semantics.
This is true, but only for very large values of "slightly".
Symlinks, for example, can cross file system boundaries (including NFS
mount points). Symlinks can refer to locat
On 2/24/2012 6:20 AM, Steven D'Aprano wrote:
> Opinions need to be informed to be better than useless. By definition
> newbies don't have the experience to have informed opinions.
I thought I had implied that I meant informed opinions, but apparently not.
> There are many times that we can't affo
In article ,
Antoon Pardon wrote:
> > Python doesn't try to prevent people from shooting themselves in the foot.
> >
> Yes it does! A simple example is None as a keyword to prevent
> assignments to it.
Hmmm. Just playing around with some bizarre things to do with None, and
discovered thi
On 24/02/2012 13:37, Rick Johnson wrote:
I get sick and tired of doing this!!!
if maxlength == UNLIMITED:
allow_passage()
elif len(string)> maxlength:
deny_passage()
What Python needs is some constant that can be compared to ANY numeric
type and that constant will ALWAYS be larger!
On 2012-02-24, Rick Johnson wrote:
> I get sick and tired of doing this!!!
>
> if maxlength == UNLIMITED:
> allow_passage()
> elif len(string) > maxlength:
> deny_passage()
>
> What Python needs is some constant that can be compared to ANY
> numeric type and that constant will ALWAYS be la
float('infinity') should be good enough.
--
http://mail.python.org/mailman/listinfo/python-list
On Fri, 24 Feb 2012 13:44:15 +0100, Peter Otten wrote:
for i in []:
> ... pass
> ... else:
> ... print "else"
> ...
> else
for i in [42]:
> ... pass
> ... else:
> ... print "else"
> ...
> else
for i in [42]:
> ... break
> ... else:
> ... print "else"
> ...
>>
On 24 February 2012 14:54, Steven D'Aprano
wrote:
> for...else is a very useful construct, but the name is misleading. It
> took me a long time to stop thinking that the else clause executes when
> the for loop was empty.
This is why I think we should call this construct "for / break / else"
rat
Steven D'Aprano wrote:
>> The code in the else suite executes only when the for loop is left via
>> break. A non-empty iterable is required but not sufficient.
>
> You have a typo there. As your examples show, the code in the else suite
> executes only when the for loop is NOT left via break (or
On Feb 24, 8:39 am, Miki Tebeka wrote:
> float('infinity') should be good enough.
Yes, that is the answer however the implementation is inconsistent.
py> float("inf")
inf
py> float("infinity")
inf
py> int("inf")
Traceback (most recent call last):
File "", line 1, in
int("inf")
ValueError:
Rick Johnson wrote:
> I get sick and tired of doing this!!!
>
> if maxlength == UNLIMITED:
> allow_passage()
> elif len(string) > maxlength:
> deny_passage()
>
> What Python needs is some constant that can be compared to ANY numeric
> type and that constant will ALWAYS be larger!
Easily
On Feb 24, 8:25 am, Neil Cerutti wrote:
> > What Python needs is some constant that can be compared to ANY
> > numeric type and that constant will ALWAYS be larger!
>
> What's the point of that?
>
> The only time I've naively pined for such a thing is when
> misapplying C idioms for finding a min
On Fri, 24 Feb 2012 10:21:45 -0500, Mel Wilson wrote:
> Rick Johnson wrote:
>
>> I get sick and tired of doing this!!!
>>
>> if maxlength == UNLIMITED:
>> allow_passage()
>> elif len(string) > maxlength:
>> deny_passage()
>>
>> What Python needs is some constant that can be compared to
On Feb 24, 9:21 am, Mel Wilson wrote:
> Easily fixed:
>
> [...snip code...]
Yes i could write my own implementation of INFINITY if i wanted,
although i would have returned True and False as apposed to 1 and 0
AND used the identifiers Infinity and Infinitesimal, but i digress :-
P.
However, INFI
On Feb 24, 7:55 am, Mark Lawrence wrote:
> Do you want to test for something that is larger than infinity?
Not exactly. I want to set a constant that has a value of infinity and
then do comparisons against the constant.
##
# Hypothetical 1 #
##
def confine(string
On 02/24/2012 08:34 AM, Rick Johnson wrote:
> Yes i could write my own implementation of INFINITY if i wanted,
> although i would have returned True and False as apposed to 1 and 0
> AND used the identifiers Infinity and Infinitesimal, but i digress :-
> P.
>
> However, INFINITY is something i bel
On 24/02/2012 16:23, Michael Torrie wrote:
On 02/24/2012 08:34 AM, Rick Johnson wrote:
Yes i could write my own implementation of INFINITY if i wanted,
although i would have returned True and False as apposed to 1 and 0
AND used the identifiers Infinity and Infinitesimal, but i digress :-
P.
Ho
I can sill get it to freeze and nothing is printed out from the other
except block.
Does it look like I'm doing anything wrong here?
On Thu, Feb 23, 2012 at 3:42 PM, MRAB wrote:
> On 23/02/2012 17:59, Eric Frederich wrote:
>
>> Below is some pretty simple code and the resulting output.
>> Someti
On Feb 23, 2:11 pm, Terry Reedy wrote:
> On 2/23/2012 2:34 PM, HoneyMonster wrote:
>
>
>
>
>
>
>
>
>
> > On Thu, 23 Feb 2012 14:24:23 -0500, Jerry Hill wrote:
>
> >> On Thu, Feb 23, 2012 at 2:11 PM, HoneyMonster
> >> wrote:
> >>> $ cd /usr/bin $ ls -l python*
> >>> -rwxr-xr-x 2 root root 9496 Oc
On Fri, Feb 24, 2012 at 9:25 AM, Neil Cerutti wrote:
> The only time I've naively pined for such a thing is when
> misapplying C idioms for finding a minimum value.
>
> Python provides an excellent min implementation to use instead.
min can be a little inconvenient. As soon as anything complicate
On 24/02/2012 17:00, Eric Frederich wrote:
I can sill get it to freeze and nothing is printed out from the other
except block.
Does it look like I'm doing anything wrong here?
[snip]
I don't normally use multiprocessing, so I forgot about a critical
detail. :-(
When the multiprocessing module
On Feb 22, 12:29 am, Steven D'Aprano wrote:
> On Tue, 21 Feb 2012 19:51:07 -0800, CM wrote:
> > I have an application that I was hoping to reduce a bit the size of its
> > .exe when "packaged" with py2exe. I'm removing some Python modules such
> > as Tkinter, etc., but now wonder how much I could
Your code updated to show the difference between a variable, a class
variable, and an instance variable.
c = [1, 2, 3, 4, 5]
class TEST():
c = [5, 2, 3, 4, 5] ## class variable (TEST.c)
def __init__(self):
self.c = [1, 2, 3, 4, 5] ## instance variable (a.c)
def add(self, c
On Fri, Feb 24, 2012 at 11:20 PM, Steven D'Aprano
wrote:
> Personally, I prefer tabs for theoretical reasons and spaces for
> practical ones. I think that the world would be better off if we all
> standardised on tabs instead of spaces, but since that's not going to
> happen, I can interoperate be
=== Purpose ===
A parameter in the AI Mind software serves to guide or limit the
operation of a mind-module. If a module is conducting a search of
AI memory, one parameter may govern how much of memory will be
searched, while other parameters may dictate exactly what is to
be looked for. Since it
On 2/24/2012 7:25 AM, Steven D'Aprano wrote:
Python 3.2 includes turtledemo, a demonstration program for the turtle
module.
When I run it, I can load the turtle scripts, and the GUI application
says "Press the start button", but there is no start button.
Can anyone else confirm this as a bug?
On 2/24/2012 8:23 AM, Roy Smith wrote:
In article,
Antoon Pardon wrote:
Python doesn't try to prevent people from shooting themselves in the foot.
Yes it does! A simple example is None as a keyword to prevent
assignments to it.
Hmmm. Just playing around with some bizarre things to do wi
I have a bunch of sub routines that run independently to perform various system
checks on my servers. I wanted to get an opinion on the following code I have
about 25 independent checks and I'm adding the ability to disable certain
checks that don't apply to certain hosts.
m = { 'a': 'checkDis
On Fri, 24 Feb 2012 10:08:43 -0800, David wrote:
> Your code updated to show the difference between a variable, a class
> variable, and an instance variable.
The preferred terms in Python circles are class and instance
*attributes*, not variables.
An integer variable is a variable holding an in
On Fri, Feb 24, 2012 at 2:16 PM, Rodrick Brown wrote:
> I have a bunch of sub routines that run independently to perform various
> system checks on my servers. I wanted to get an opinion on the following code
> I have about 25 independent checks and I'm adding the ability to disable
> certain c
On Sat, Feb 25, 2012 at 9:16 AM, Rodrick Brown wrote:
> m = { 'a': 'checkDisks()',
> 'b': 'checkMemSize()',
> 'c': 'checkBondInterfaces()'
> }
>
> runlist = [ c for c in m.keys() if c not in r.d ]
> for runable in runlist:
> eval(m[runable])
It's a reasonable tec
On Fri, 24 Feb 2012 09:23:08 -0700, Michael Torrie wrote:
> All this reminds me of the original cray supercomputers. They didn't
> use twos compliment for integers so they had two representations of zero
> (+0 and -0). Made programming a bit tricky.
While there is only one integer zero, I would
On 02/24/2012 09:59 AM, Mark Lawrence wrote:
> The C integer bit doesn't matter since e.g.
> >>>
> a=100
> >>> a
> 1
On Sat, Feb 25, 2012 at 10:16 AM, Michael Torrie wrote:
> Sure but that doesn't answer the question posed. How does Rick plan to
> represent an infinite integer? Obviously you've shown that with an
> infinite amount of memory we could do it quite easily. But baring that,
> how does Rick suggest
On 24/02/2012 23:16, Michael Torrie wrote:
On 02/24/2012 09:59 AM, Mark Lawrence wrote:
The C integer bit doesn't matter since e.g.
>>>
a=100
>>> a
100
On 24/02/2012 22:25, Steven D'Aprano wrote:
On Fri, 24 Feb 2012 10:08:43 -0800, David wrote:
Your code updated to show the difference between a variable, a class
variable, and an instance variable.
The preferred terms in Python circles are class and instance
*attributes*, not variables.
An i
On 24/02/2012 23:16, Michael Torrie wrote:
On 02/24/2012 09:59 AM, Mark Lawrence wrote:
The C integer bit doesn't matter since e.g.
>>>
a=100
>>> a
10
On 24/02/2012 20:41, Chris Angelico wrote:
On Fri, Feb 24, 2012 at 11:20 PM, Steven D'Aprano
wrote:
Personally, I prefer tabs for theoretical reasons and spaces for
practical ones. I think that the world would be better off if we all
standardised on tabs instead of spaces, but since that's not
On Saturday 25 Feb 2012 12:37:58 AM MRAB wrote:
> We already have arbitrarily long ints, so there could be a special
> infinite int singleton (actually, 2 of them, one positive, the other
> negative).
Seconded. Although would a wish request to bugs.python.org saying "Allow
storage of the integer i
On Sat, Feb 25, 2012 at 11:49 AM, Mark Lawrence wrote:
> Oo, thou sinner, fancy violating PEP 8 and standardising on tabs.
PEP 8 applies only to Python code, our standard is across all our
languages :) But yes, I'm a horrible sinner and I like tabs. They
separate the display (do you want tabs to
On Fri, Feb 24, 2012 at 10:32 AM, Devin Jeanpierre
wrote:
> On Fri, Feb 24, 2012 at 9:25 AM, Neil Cerutti wrote:
>> The only time I've naively pined for such a thing is when
>> misapplying C idioms for finding a minimum value.
>>
>> Python provides an excellent min implementation to use instead.
On Sat, 25 Feb 2012 00:39:39 +, Mark Lawrence wrote:
> On 24/02/2012 22:25, Steven D'Aprano wrote:
>> On Fri, 24 Feb 2012 10:08:43 -0800, David wrote:
>>
>>> Your code updated to show the difference between a variable, a class
>>> variable, and an instance variable.
>>
>> The preferred terms i
On Sat, 25 Feb 2012 06:52:09 +0530, Fayaz Yusuf Khan wrote:
> On Saturday 25 Feb 2012 12:37:58 AM MRAB wrote:
>> We already have arbitrarily long ints, so there could be a special
>> infinite int singleton (actually, 2 of them, one positive, the other
>> negative).
> Seconded. Although would a wis
On 02/24/2012 08:25 PM, Chris Angelico wrote:
On Sat, Feb 25, 2012 at 11:49 AM, Mark Lawrence wrote:
Oo, thou sinner, fancy violating PEP 8 and standardising on tabs.
PEP 8 applies only to Python code, our standard is across all our
languages :) But yes, I'm a horrible sinner and I like tabs.
Hello, attempting to build from source on Ubuntu 11.10.
Before running ./configure I had set this in Modules/Setup.dist:
SSL=/usr/lib/ssl
_ssl _ssl.c \
-DUSE_SSL -I$(SSL)/include -I$(SSL)/include/openssl \
-L$(SSL)/lib -lssl -lcrypto
$ ll /usr/lib/ssl
total 4
lrwxrwxrwx 1 root ro
66 matches
Mail list logo