Tuesday, March 30, 2010

comp.lang.python - 25 new messages in 12 topics - digest

comp.lang.python
http://groups.google.com/group/comp.lang.python?hl=en

comp.lang.python@googlegroups.com

Today's topics:

* Watch Angelina Jolie's sex scandal videos at her house - 1 messages, 1
author
http://groups.google.com/group/comp.lang.python/t/6ce3d603a5d64154?hl=en
* sum for sequences? - 6 messages, 5 authors
http://groups.google.com/group/comp.lang.python/t/139c0887a359405b?hl=en
* Help Desk Software by PerlDesk - 1 messages, 1 author
http://groups.google.com/group/comp.lang.python/t/f496f14c826cfa1d?hl=en
* PyDispatcher on sourceforge doesn't play nice with easy_install - 1 messages,
1 author
http://groups.google.com/group/comp.lang.python/t/122bcc79cac930fe?hl=en
* PyScripter Logo - 1 messages, 1 author
http://groups.google.com/group/comp.lang.python/t/d8ecb06d6293e6c9?hl=en
* "Usability, the Soul of Python" - 3 messages, 3 authors
http://groups.google.com/group/comp.lang.python/t/e70d8f60e4ec72cc?hl=en
* It's a fact not lost on the opportunity to see yourself - 1 messages, 1
author
http://groups.google.com/group/comp.lang.python/t/910a878734bbc581?hl=en
* StringChain -- a data structure for managing large sequences ofchunks of
bytes - 2 messages, 2 authors
http://groups.google.com/group/comp.lang.python/t/0289b7f3bff4d999?hl=en
* Classes as namespaces? - 1 messages, 1 author
http://groups.google.com/group/comp.lang.python/t/ddaed9721e7bbf45?hl=en
* Watch Angelina Jolie's sex scandal videos - 1 messages, 1 author
http://groups.google.com/group/comp.lang.python/t/240bec77e41a66fa?hl=en
* Binary Decimals in Python - 5 messages, 5 authors
http://groups.google.com/group/comp.lang.python/t/816a3e4b24300797?hl=en
* (a==b) ? 'Yes' : 'No' - 2 messages, 2 authors
http://groups.google.com/group/comp.lang.python/t/b985d5727945d2b4?hl=en

==============================================================================
TOPIC: Watch Angelina Jolie's sex scandal videos at her house
http://groups.google.com/group/comp.lang.python/t/6ce3d603a5d64154?hl=en
==============================================================================

== 1 of 1 ==
Date: Tues, Mar 30 2010 12:05 am
From: love guru 4 world


Watch Angelina Jolie's sex scandal videos at her house

for more details register here to start watching video now

http://moourl.com/82x99

==============================================================================
TOPIC: sum for sequences?
http://groups.google.com/group/comp.lang.python/t/139c0887a359405b?hl=en
==============================================================================

== 1 of 6 ==
Date: Mon, Mar 29 2010 11:55 pm
From: Paul Rubin


Steven D'Aprano <steven@REMOVE.THIS.cybersource.com.au> writes:
>>>> ...
>>> ...
>> ...
> "Obvious" doesn't mean you don't have to learn the tools you use....

Geez you guys, get a room ;-). You're all good programmers with too
much experience for this arguing over stuff this silly.


== 2 of 6 ==
Date: Tues, Mar 30 2010 3:10 am
From: Steven D'Aprano


On Mon, 29 Mar 2010 23:55:55 -0700, Paul Rubin wrote:

> Steven D'Aprano <steven@REMOVE.THIS.cybersource.com.au> writes:
>>>>> ...
>>>> ...
>>> ...
>> "Obvious" doesn't mean you don't have to learn the tools you use....
>
> Geez you guys, get a room ;-). You're all good programmers with too
> much experience for this arguing over stuff this silly.

Yes Mum ;)


You're right of course. I spend too much time being this guy:

http://xkcd.com/386/

and not enough this one:

http://xkcd.com/167/


--
Steven


== 3 of 6 ==
Date: Tues, Mar 30 2010 4:33 am
From: Steve Holden


Steven D'Aprano wrote:
> On Mon, 29 Mar 2010 23:55:55 -0700, Paul Rubin wrote:
>
>> Steven D'Aprano <steven@REMOVE.THIS.cybersource.com.au> writes:
>>>>>> ...
>>>>> ...
>>>> ...
>>> "Obvious" doesn't mean you don't have to learn the tools you use....
>> Geez you guys, get a room ;-). You're all good programmers with too
>> much experience for this arguing over stuff this silly.
>
> Yes Mum ;)
>
>
> You're right of course. I spend too much time being this guy:
>
> http://xkcd.com/386/
>
> and not enough this one:
>
> http://xkcd.com/167/
>
>
Yeah, it can happen to all of us. I've certainly been "that guy" too.
But Steven, surely now it's time to *show us the squirrels*

regards
Steve
--
Steve Holden +1 571 484 6266 +1 800 494 3119
See PyCon Talks from Atlanta 2010 http://pycon.blip.tv/
Holden Web LLC http://www.holdenweb.com/
UPCOMING EVENTS: http://holdenweb.eventbrite.com/


== 4 of 6 ==
Date: Tues, Mar 30 2010 4:33 am
From: Steve Holden


Steven D'Aprano wrote:
> On Mon, 29 Mar 2010 23:55:55 -0700, Paul Rubin wrote:
>
>> Steven D'Aprano <steven@REMOVE.THIS.cybersource.com.au> writes:
>>>>>> ...
>>>>> ...
>>>> ...
>>> "Obvious" doesn't mean you don't have to learn the tools you use....
>> Geez you guys, get a room ;-). You're all good programmers with too
>> much experience for this arguing over stuff this silly.
>
> Yes Mum ;)
>
>
> You're right of course. I spend too much time being this guy:
>
> http://xkcd.com/386/
>
> and not enough this one:
>
> http://xkcd.com/167/
>
>
Yeah, it can happen to all of us. I've certainly been "that guy" too.
But Steven, surely now it's time to *show us the squirrels*

regards
Steve
--
Steve Holden +1 571 484 6266 +1 800 494 3119
See PyCon Talks from Atlanta 2010 http://pycon.blip.tv/
Holden Web LLC http://www.holdenweb.com/
UPCOMING EVENTS: http://holdenweb.eventbrite.com/

== 5 of 6 ==
Date: Tues, Mar 30 2010 6:53 am
From: Mel


Patrick Maupin wrote:

> Because sum() is the obvious way to sum floats; now the existence of
> math.fsum() means there are TWO obvious ways to sum floats. Is that
> really that hard to understand? How can you misconstrue this so badly
> that you write something that can be (easily) interpreted to mean that
> you think that I think that once math.fsum() exists, sum() doesn't
> even exist any more????

floats are nasty -- as evidence the recent thread on comparing floats for
equality. People use floats when they have to. fsum exists because of
this:

mwilson@tecumseth:~$ python
Python 2.6.2 (release26-maint, Apr 19 2009, 01:56:41)
[GCC 4.3.3] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> from math import fsum
>>> a=(1.0e200, 156.0, -1.0e200)
>>> sum(a)
0.0
>>> fsum(a)
156.0


You could generalize sum, but after that, there's a case that even fsum
can't handle:


>>> ni=1.0e200+1.0j
>>> nj=1.0+1.0e200j
>>> ai=(ni, nj, 156.0+651.0j, -ni, -nj)
>>> sum(ai)
(-1+0j)
>>> fsum(ai)
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
TypeError: can't convert complex to float; use abs(z)
>>>


Mel.

== 6 of 6 ==
Date: Tues, Mar 30 2010 8:31 am
From: Patrick Maupin


On Mar 30, 8:53 am, Mel <mwil...@the-wire.com> wrote:
> floats are nasty -- as evidence the recent thread on comparing floats for
> equality.  People use floats when they have to.  fsum exists because of
> this:

...

I understand there are technical reasons for why math.fsum() exists.
I still think that whatever math.fsum() does should probably be a part
of sum().

Regards,
Pat

==============================================================================
TOPIC: Help Desk Software by PerlDesk
http://groups.google.com/group/comp.lang.python/t/f496f14c826cfa1d?hl=en
==============================================================================

== 1 of 1 ==
Date: Tues, Mar 30 2010 12:33 am
From: POOJA


Help Desk Software by PerlDesk
------------------------

http://sites.google.com/site/freehelpdesksoftware

==============================================================================
TOPIC: PyDispatcher on sourceforge doesn't play nice with easy_install
http://groups.google.com/group/comp.lang.python/t/122bcc79cac930fe?hl=en
==============================================================================

== 1 of 1 ==
Date: Tues, Mar 30 2010 1:03 am
From: Chris Withers


Hi All,

Using easy_install to get PyDispatcher results in:

Searching for PyDispatcher
Reading http://pypi.python.org/simple/PyDispatcher/
Reading http://pydispatcher.sourceforge.net
Reading https://sourceforge.net/project/showfiles.php?group_id=79755
Reading http://sourceforge.net/projects/pydispatcher/files/pydispatcher/
Best match: PyDispatcher 2.0.1
Downloading
http://sourceforge.net/projects/pydispatcher/files/pydispatcher/2.0.1/PyDispatcher-2.0.1-py2.5.egg/download
Processing download
error: Couldn't find a setup script in /tmp/easy_install-ioAdEo/download

Who's the maintainer of PyDispatcher nowadays? Would be handy if they
removed the sourceforge link from pypi.

In the meantime, the following works around the problem:

easy_install PyDispatcher -H *.python.org

cheers,

Chris


==============================================================================
TOPIC: PyScripter Logo
http://groups.google.com/group/comp.lang.python/t/d8ecb06d6293e6c9?hl=en
==============================================================================

== 1 of 1 ==
Date: Tues, Mar 30 2010 1:06 am
From: Steven D'Aprano


On Mon, 29 Mar 2010 22:47:40 -0700, Vincent MAILLE wrote:

> Where can I find a image of the snake PyScipter in high quality ?

Did you mean PyScripter (note spelling)? If so, then googling for
PyScripter brings me to the PyScripter project, which has contact
details. You should ask the project author.


--
Steven

==============================================================================
TOPIC: "Usability, the Soul of Python"
http://groups.google.com/group/comp.lang.python/t/e70d8f60e4ec72cc?hl=en
==============================================================================

== 1 of 3 ==
Date: Tues, Mar 30 2010 2:03 am
From: Jean-Michel Pichavant


John Nagle wrote:
> Jonathan Hayward wrote:
>> I've posted "Usability, the Soul of Python: An Introduction to the
>> Python Programming Language Through the Eyes of Usability", at:
>>
>> http://JonathansCorner.com/python/
>
> No, it's just a rather verbose introduction to Python, in dark brown
> type on a light brown background. One could write a good paper on this
> topic, but this isn't it.
>
>
> John Nagle
Why is it bad ?

JM


== 2 of 3 ==
Date: Tues, Mar 30 2010 4:17 am
From: Malte Dik


> Why is it bad ?
>

Not working code, examples, that are weird to read, and a lot of text :)


== 3 of 3 ==
Date: Tues, Mar 30 2010 4:40 am
From: "Alf P. Steinbach"


* Jean-Michel Pichavant:
> John Nagle wrote:
>> Jonathan Hayward wrote:
>>> I've posted "Usability, the Soul of Python: An Introduction to the
>>> Python Programming Language Through the Eyes of Usability", at:
>>>
>>> http://JonathansCorner.com/python/
>>
>> No, it's just a rather verbose introduction to Python, in dark brown
>> type on a light brown background. One could write a good paper on this
>> topic, but this isn't it.
>>
>>
>> John Nagle
> Why is it bad ?

Consider


<quote>
From a usability standpoint, the braces go with the lines to print out the
stanza rather than the for statement or the code after, so the following is best:

for(i = 99; i > 0; ++i)
{
printf("%d slabs of spam in my mail!\n", i);
printf("%d slabs of spam,\n", i);
printf("Send one to abuse and Just Hit Delete,\n");
printf("%d slabs of spam in my mail!\n\n", i + 1);
}
</quote>


This is just unsubstantiated opinion, but worse, it makes a tacit assumption
that there is "best" way to do indentation. However, most programmers fall into
that trap, and I've done it myself. In fact, when I worked as a consultant (then
in Andersen Consulting, now Accenture) I used the style above. Petter
Hesselberg, author of "Industrial Strength Windows Programming" (heh, I'm
mentioned) asked my why on Earth I did that, like, nobody does that? It was a
habit I'd picked up in Pascal, from very naïve considerations of parse nesting
levels, a kind of misguided idealism instead of more practical pragmatism, but
since I realized that that was an incredibly weak argument I instead answered by
pointing towards Charles Petzold's code in his "Programming Windows" books. And
amazingly I was allowed to continue using this awkward and impractical style.

I may or may not have been responsible for the similarly impractical compromise
convention of using three spaces per indentation level. At least, in one big
meeting the question about number of spaces was raised by the speaker, and I
replied from the benches, just in jest, "three!". And that was it (perhaps).


Cheers,

- Alf (admitting to earlier mistakes)

==============================================================================
TOPIC: It's a fact not lost on the opportunity to see yourself
http://groups.google.com/group/comp.lang.python/t/910a878734bbc581?hl=en
==============================================================================

== 1 of 1 ==
Date: Tues, Mar 30 2010 3:19 am
From: a m


http://www.google.com/url?sa=D&q=http://www.google.com/url%3Fsa%3DD%26q%3Dhttp://osamah2000.jeeran.com/daauageralmuslmeen1.htm%26usg%3DAFQjCNGQhhGz-1TGv9Y7gE8zKwHHustJCg&usg=AFQjCNH5ZzXRqkh5EGL1dsjQxcjNQCmAEQ

==============================================================================
TOPIC: StringChain -- a data structure for managing large sequences ofchunks
of bytes
http://groups.google.com/group/comp.lang.python/t/0289b7f3bff4d999?hl=en
==============================================================================

== 1 of 2 ==
Date: Tues, Mar 30 2010 4:23 am
From: Lie Ryan


On 03/29/2010 01:59 AM, Steven D'Aprano wrote:
> On Sun, 28 Mar 2010 06:48:21 +1100, Lie Ryan wrote:
>
>> On 03/22/2010 07:07 PM, Steven D'Aprano wrote:
>>> Perhaps you should have said that it was a wrapper around deque giving
>>> richer functionality, rather than giving the impression that it was a
>>> brand new data structure invented by you. People are naturally going to
>>> be more skeptical about a newly invented data structure than one based
>>> on a reliable, component like deque.
>>
>> Well, technically StringChain is not a data structure in the first
>> place. StringChain is a string;
>
> And strings are data structures, as are arrays and structs. Just because
> they're simple data structures made directly from primitives rather than
> rich, complex structures, doesn't mean they're not data structures.

Array is a way to structure data and thus a data structure; array is the
concept of structuring data using contiguous memory with elements
addressed by an index. string is just a contiguous memory reserved to
store data, or in other words: string is an array. This is what I meant
when I said string is not itself a data structure.

>> a string that is implemented using deque
>> data structure to make appending algorithmically efficient. It is not a
>> data structure, in the sense that I can't put arbitrary "thing" into the
>> data structure.
>
> Any "thing" that can be pickled or serialised can be put into a string.

Fair enough, you're right to think so but IMHO I disagree. Streams (or
perhaps 'blob' to avoid the connotation of FIFO) are the data structure
which you can put anything pickleable/serialisable into, but string (the
implementation of stream/blob using array) are just a special case of
array data structure and not a different, separate data structure than
array.

Perhaps I should not make such a bold claim as saying string is not data
structure; what I have in mind is that string is just a special case of
array and not distinctly separate data structure than array.


== 2 of 2 ==
Date: Tues, Mar 30 2010 6:46 am
From: Steve Holden


Lie Ryan wrote:
> On 03/29/2010 01:59 AM, Steven D'Aprano wrote:
>> On Sun, 28 Mar 2010 06:48:21 +1100, Lie Ryan wrote:
>>
>>> On 03/22/2010 07:07 PM, Steven D'Aprano wrote:
>>>> Perhaps you should have said that it was a wrapper around deque giving
>>>> richer functionality, rather than giving the impression that it was a
>>>> brand new data structure invented by you. People are naturally going to
>>>> be more skeptical about a newly invented data structure than one based
>>>> on a reliable, component like deque.
>>> Well, technically StringChain is not a data structure in the first
>>> place. StringChain is a string;
>> And strings are data structures, as are arrays and structs. Just because
>> they're simple data structures made directly from primitives rather than
>> rich, complex structures, doesn't mean they're not data structures.
>
> Array is a way to structure data and thus a data structure; array is the
> concept of structuring data using contiguous memory with elements
> addressed by an index. string is just a contiguous memory reserved to
> store data, or in other words: string is an array. This is what I meant
> when I said string is not itself a data structure.
>
>>> a string that is implemented using deque
>>> data structure to make appending algorithmically efficient. It is not a
>>> data structure, in the sense that I can't put arbitrary "thing" into the
>>> data structure.
>> Any "thing" that can be pickled or serialised can be put into a string.
>
> Fair enough, you're right to think so but IMHO I disagree. Streams (or
> perhaps 'blob' to avoid the connotation of FIFO) are the data structure
> which you can put anything pickleable/serialisable into, but string (the
> implementation of stream/blob using array) are just a special case of
> array data structure and not a different, separate data structure than
> array.
>
> Perhaps I should not make such a bold claim as saying string is not data
> structure; what I have in mind is that string is just a special case of
> array and not distinctly separate data structure than array.

While this may be true conceptually it's certainly not true in Python
(and in Python you need to be careful to distinguish between lists and
arrays, since it does have both types).

>From the point of view of the language, strings are primitives. But
every Python implementation uses a data structure to store them, and the
structure is definitely not the same as is used to store lists, or
arrays (which in Python are container types, whereas the string isn't
because the individual indexable elements are immutable).

As always, it's better to seek common ground than pick the nits: I don't
think that there's really that much difference between your approach and
Steven's, but he's a well-known nit-picker (and we are *sometimes*
grateful for it).

regards
Steve
--
Steve Holden +1 571 484 6266 +1 800 494 3119
See PyCon Talks from Atlanta 2010 http://pycon.blip.tv/
Holden Web LLC http://www.holdenweb.com/
UPCOMING EVENTS: http://holdenweb.eventbrite.com/


==============================================================================
TOPIC: Classes as namespaces?
http://groups.google.com/group/comp.lang.python/t/ddaed9721e7bbf45?hl=en
==============================================================================

== 1 of 1 ==
Date: Tues, Mar 30 2010 4:39 am
From: Lie Ryan


On 03/27/2010 10:28 PM, Jonathan Hartley wrote:
> one might like to name the complex block of logic, just to make it
> readable:
>
>
> x = 1
> def account_for_non_square_pixels(x):
> ((some complex logic))
> account_for_non_square_pixels()
> y = 2
>
>
> But defining and then calling the function like that is a tad
> cumbersome. So I was wondering about:
>


I never liked the narrow definition of function as "reusable piece of
code". This narrow definition implies that a piece of code used only
once do not need to be made a function.

I would rather define function as "a logically independent piece of
code" and encourage refactorizing code into functions even if they are
only used once as long as they are conceptually a "step" and being able
to reuse code as a nice side-effect of it.

Under this definition, the "some complex logic" conceptually is an
independent piece of code that can (and probably should) be factorized.

==============================================================================
TOPIC: Watch Angelina Jolie's sex scandal videos
http://groups.google.com/group/comp.lang.python/t/240bec77e41a66fa?hl=en
==============================================================================

== 1 of 1 ==
Date: Tues, Mar 30 2010 7:48 am
From: "+++$$$$SSSS$$$+++"


Watch Angelina Jolie's sex scandal videos at her house

for more details register here to start watching video now

http://moourl.com/xowvu

==============================================================================
TOPIC: Binary Decimals in Python
http://groups.google.com/group/comp.lang.python/t/816a3e4b24300797?hl=en
==============================================================================

== 1 of 5 ==
Date: Tues, Mar 30 2010 8:13 am
From: aditya


To get the decimal representation of a binary number, I can just do
this:

int('11',2) # returns 3

But decimal binary numbers throw a ValueError:

int('1.1',2) # should return 1.5, throws error instead.

Is this by design? It seems to me that this is not the correct
behavior.

- Aditya


== 2 of 5 ==
Date: Tues, Mar 30 2010 8:28 am
From: Patrick Maupin


On Mar 30, 10:13 am, aditya <bluemangrou...@gmail.com> wrote:
> To get the decimal representation of a binary number, I can just do
> this:
>
> int('11',2) # returns 3
>
> But decimal binary numbers throw a ValueError:
>
> int('1.1',2) # should return 1.5, throws error instead.
>
> Is this by design? It seems to me that this is not the correct
> behavior.
>
> - Aditya

So, why should int('1.1', 2) throw an error when int('1.1') doesn't?

Regards,
Pat


== 3 of 5 ==
Date: Tues, Mar 30 2010 8:35 am
From: Grant Olson


On 3/30/2010 11:13 AM, aditya wrote:
> To get the decimal representation of a binary number, I can just do
> this:
>
> int('11',2) # returns 3
>
> But decimal binary numbers throw a ValueError:
>
> int('1.1',2) # should return 1.5, throws error instead.
>
> Is this by design? It seems to me that this is not the correct
> behavior.
>

Well technically that would be a 'radix point', not a decimal point.

But I think the problem is that computers don't store fractional values
that way internally. They either use floating or fixed point math. You
would never look at raw binary data on a computer and see something like
'1010.1010', and no one would write it that way, and no language (that I
know of) would accept that as a valid value if you did something like "x
= 0b1010.1010"

So in that sense, it might not be an intentional oversight, but it's not
a very practical or useful feature.


== 4 of 5 ==
Date: Tues, Mar 30 2010 8:37 am
From: Benjamin Kaplan


On Tue, Mar 30, 2010 at 11:13 AM, aditya <bluemangroupie@gmail.com> wrote:
> To get the decimal representation of a binary number, I can just do
> this:
>
> int('11',2) # returns 3
>
> But decimal binary numbers throw a ValueError:
>
> int('1.1',2) # should return 1.5, throws error instead.
>
> Is this by design? It seems to me that this is not the correct
> behavior.
>
> - Aditya
> --

Because int stands for integer and 1.1 is not an integer. You get the
same error if you try doing int('1.1')

> http://mail.python.org/mailman/listinfo/python-list
>


== 5 of 5 ==
Date: Tues, Mar 30 2010 8:49 am
From: Raymond Hettinger


On Mar 30, 8:13 am, aditya <bluemangrou...@gmail.com> wrote:
> To get the decimal representation of a binary number, I can just do
> this:
>
> int('11',2) # returns 3
>
> But decimal binary numbers throw a ValueError:
>
> int('1.1',2) # should return 1.5, throws error instead.
>
> Is this by design? It seems to me that this is not the correct
> behavior.

The int() constructor returns integers.
So, look to float() for non-integral values.
Binary representation isn't supported yet,
but we do have hex:

>>> float.fromhex('1.8')
1.5


Raymond


==============================================================================
TOPIC: (a==b) ? 'Yes' : 'No'
http://groups.google.com/group/comp.lang.python/t/b985d5727945d2b4?hl=en
==============================================================================

== 1 of 2 ==
Date: Tues, Mar 30 2010 8:40 am
From: gentlestone


Hi, how can I write the popular C/JAVA syntax in Python?

Java example:
return (a==b) ? 'Yes' : 'No'

My first idea is:
return ('No','Yes')[bool(a==b)]

Is there a more elegant/common python expression for this?

== 2 of 2 ==
Date: Tues, Mar 30 2010 8:44 am
From: Mike Kent


On Mar 30, 11:40 am, gentlestone <tibor.b...@hotmail.com> wrote:
> Hi, how can I write the popular C/JAVA syntax in Python?
>
> Java example:
>     return (a==b) ? 'Yes' : 'No'
>
> My first idea is:
>     return ('No','Yes')[bool(a==b)]
>
> Is there a more elegant/common python expression for this?

return ('Yes' if a == b else 'No')


==============================================================================

You received this message because you are subscribed to the Google Groups "comp.lang.python"
group.

To post to this group, visit http://groups.google.com/group/comp.lang.python?hl=en

To unsubscribe from this group, send email to comp.lang.python+unsubscribe@googlegroups.com

To change the way you get mail from this group, visit:
http://groups.google.com/group/comp.lang.python/subscribe?hl=en

To report abuse, send email explaining the problem to abuse@googlegroups.com

==============================================================================
Google Groups: http://groups.google.com/?hl=en

0 Comments:

Post a Comment

Subscribe to Post Comments [Atom]

<< Home


Real Estate