Re: Egos, heartlessness, and limitations

2011-04-14 Thread Steven D'Aprano
On Wed, 13 Apr 2011 22:08:17 -0700, John Ladasky wrote:

> I may regret wading into a flame-war, but...
> 
> I got started with Python in 2002.  I took one look at TKinter, said
> "yuck!", and went searching for something else.  Now, wxPython is a bit
> clunky for a Python programmer because of its strong ties to C++ -- but
> that's what I chose, and it has served me well.  I would like to see
> wxPython become the default GUI for our very fine programming language.


So would many others, but unfortunately there are complications that more 
or less rule out wxPython being supplied as part of the standard library. 
For example, that would require the wxPython developers agreeing to 
synchronizing wxPython updates with Python's schedule, and that's 
unlikely to happen.

Fortunately, if you're using a recent Linux or a Mac with MacPorts, 
installing wxPython should never be more than one command line (or half a 
dozen clicks) away. Windows users aren't quite so lucky, but still, it's 
not like installing it is a major hassle.

Also, in more recent versions of Python, Tkinter has had something of a 
face lift with the introduction of "tiled TK" with native-looking widgets.



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


Re: [OT] Free software versus software idea patents

2011-04-14 Thread harrismh777

geremy condra wrote:

Having said that, I have a greater respect for mathematics than I do
for my own economic views, and I don't like seeing it become a
political football. If you can prove something,*prove it*. If you
cannot- no matter how close you might feel you are- don't claim that
math says you're right.


Fair enough.

http://www.groklaw.net/articlebasic.php?story=2009151305785


With your background, you will have no problem with this text... 
although, and I do apologize, it is a long text... scroll down and begin 
reading at the heading:


An Explanation of Computation Theory for Lawyers

By PolR



The write-up is excellent, written as well or better than I could 
write it myself, and is very clear and concise... yes, even a lawyer can 
understand it.



Kind regards,

m harris


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


Re: Free software versus software idea patents

2011-04-14 Thread harrismh777

geremy condra wrote:

>  But on a serious note, I did wonder who would be the first jouster to offer
>  the argumentum ad hominem? ... ah, sticks and stones...



>  My major professor once told me, "You know you've won the argument when they
>  start calling you names!"



I think your professor should have said "you know you've won the
argument when you can prove it".




http://www.groklaw.net/articlebasic.php?story=2009151305785









http://www.youtube.com/watch?v=z5jKMEB4hHE

kind regards,
m harris


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


Re: Postmortem on Unladen Swallow

2011-04-14 Thread Daniel Fetchinson
> There's a postmortem on the failure of Unladen Swallow by one of the
> developers at:
>
> http://qinsb.blogspot.com/2011/03/unladen-swallow-retrospective.html

This outcome of things is really a testament to the hard work of the pypy folks.
They, a volunteer bunch, beat google!
And that's something to be proud of, I'd think.

Cheers,
Daniel

-- 
Psss, psss, put it down! - http://www.cafepress.com/putitdown
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Egos, heartlessness, and limitations

2011-04-14 Thread Chris Angelico
On Thu, Apr 14, 2011 at 12:03 PM, Ryan Kelly  wrote:
> On Thu, 2011-04-14 at 11:46 +1000, Chris Angelico wrote:
>> Wait... so where do the Python experts hang out?
>
> Don't panic, there are plenty of experts here :-)
>
> It's an oft-cited troll complaint that many python big-wigs (Guido,
> Raymond H, et al) don't subscribe to python-list.

Apart from Guido, I wouldn't even recognize their names. (I have no
idea who Raymond H is or what his position in the community is.) Does
this make me a bad Python programmer? I don't think so; just makes me
not a major member of the community. (Apologies to Raymond, I don't
mean to slight your contributions; but I would respect you on the
basis of your posts on this list, regardless of your Subversion
contribs.)

> It's also an oft-cited troll conspiracy that Guido hangs out on
> python-list and posts under various pseudonyms.  I think it would be
> kinda fun if he did...

What if he's rantingrick? He would SO be laughing right now

Chris Angelico
-- 
http://mail.python.org/mailman/listinfo/python-list


about soaplib demo's time latency

2011-04-14 Thread Stephen.Wu
I just follow the instructions below - 
http://soaplib.github.com/soaplib/2_0/pages/helloworld.html
to establish a soap server. After starting the server, everytime I run
the client script, I fetch the response nearly 20 seconds afterward.
Why this happen?
I just want the server send response asap then the client will show
the result to me immediately.

please give some hints. thanks
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: [OT] Free software versus software idea patents

2011-04-14 Thread Chris Angelico
On Thu, Apr 14, 2011 at 4:04 PM, harrismh777  wrote:
>
>    How many web crawlers have you built? Are there any web programmers out
> there who need a web bot to hit multiple sites zillions of times a month
> from different places on earth to 'up' the number of hits for economic
> reasons? I've seen my share of this.

A well-behaved spider will (a) have a UA that identifies itself (as a
bot, and preferably as itself - eg "GoogleBot", etc - some even go so
far as to include a URL for more info), and (b) start by fetching
/robots.txt before they go any further. Servers can recognize
properly-built crawlers. And improperly-built crawlers, deliberately
trying to hammer a server to lie about browser stats? Seriously, do
you think people actually care THAT much?

>    How mamy times have you altered the identity of your web browser so that
> the web site would 'work'? You know, stupid messages from the server that
> say, "We only support IE 6+, upgrade your browser...",  so you tell it
> you're using IE 6 and, well no problem.

Yep. Which means that the figures will always be skewed toward IE a
bit. But it's a lot less than you might think; most people don't leave
UA switchers active all the time, and the number of web sites that
require them is dropping. It's true that UA switching will tip toward
IE (I've never seen a site where you have to pretend to be Google
Chrome), but the epidemology is, I believe, not all that high.

>    Web site data is bogus. It assumes even distributions... it assumes even
> usage of the site from all surfers, it assumes no web crawlers and no bots,
> it assumes no browser identity tampering, and it assumes that there aren't
> those who for economic reasons are not inflating the numbers deliberately
> (no, really??) from world-owned bot farms.

Even distributions of what?

1) Assuming nothing, it merely gives data. About one site. That's why
overall "browser marketshare" stats have to be done by averaging
multiple sites.

2) Web crawlers - see above. If you've ever looked at AWStats or
Webalizer or *insert stats engine here*, you'll have seen that it will
identify them. AWStats goes a bit further and will identify "viewed
traffic" and "not viewed traffic" even if it's unable to identify the
specific bot.

3) Yes, it assumes no UA switchers, obviously. It's just based on
headers. But I reckon you could easily identify someone who's using a
switcher, based on other headers - for instance, I doubt very much
that IE6 will send "Accept-Encoding: gzip,deflate,sdch" (which my
Chrome does).

4) Assumes people aren't deliberately fiddling the figures. Yeah, that
would be correct. We're in the realm of conspiracy theories here...
does anyone seriously think that browser stats are THAT important that
they'd go to multiple web servers with deceitful hits? Not forgetting
that they'd have to mix up the IPs, make plausible "browsing sessions"
(with referers and image retrieval and so on), vary the date/times,
etc, etc, etc, etc... and generate enough hits to make a reasonable
dent in the figures.

>    There is no reliable way to measure free software usage. But, there sure
> is a lot of posturing going on in the market place ...  wonder why?

Sure, and there's no reliable way to measure non-free software usage
either. What's the difference? You could count sales of Microsoft
Office, and you could count downloads of Open Office. Neither is any
more accurate than the other; although I think the 24-hour figures for
Firefox 4 / IE 9 downloads are fairly indicative, since people can't
get them off their respective OS install CDs. And this isn't
restricted to electronica either. Which is more popular, Coca-Cola or
Pepsi? Do more people vote Liberal or Labour, Republican or Democrat,
Whig or Tory?

Statisticking is a huge science. Most of it involves figuring out
what's important - anyone can get data, but getting useful information
out of the data takes some work.

Chris Angelico
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: about soaplib demo's time latency

2011-04-14 Thread Chris Angelico
On Thu, Apr 14, 2011 at 6:43 PM, Stephen.Wu <54wut...@gmail.com> wrote:
> I just follow the instructions below - 
> http://soaplib.github.com/soaplib/2_0/pages/helloworld.html
> to establish a soap server. After starting the server, everytime I run
> the client script, I fetch the response nearly 20 seconds afterward.
> Why this happen?
> I just want the server send response asap then the client will show
> the result to me immediately.
>
> please give some hints. thanks

Not sure if it's what you're seeing, but you might have an issue with
reverse DNS. When the client connects, the server tries to look up its
PTR record for its log. You can speed this up by either having such a
record, or having an authoritative DNS server that returns an
immediate failure; either option is fairly easy if you run BIND, but
you might be able to do it with your hosts file (/etc/hosts or
c:\windows\system32\drivers\etc\hosts) instead - just put in an entry
for your client computer and some hostname.

Hope that helps!

Chris Angelico
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: automated pep8 reformatter ?

2011-04-14 Thread Andrea Crotti
James Mills  writes:

> Does anyone know of a tool that will help with
> reformatting badly written code to be pep8 compliant ?
>
> a 2to3 for pep8 ?
>

What I daily and with great happiness use is flymake-mode in emacs.
Combined with pylint, pep8 and pychecker I can see while I'm programming
all the possible problems that are caught in my program with those
tools.

An automatic tool maybe is not such a good idea, most of those warnings
have to be checked and analyzed before changing something.
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Egos, heartlessness, and limitations

2011-04-14 Thread jmfauth
On 14 avr, 08:59,

> Fortunately, if you're using a recent Linux or a Mac with MacPorts,
> installing wxPython should never be more than one command line (or half a
> dozen clicks) away. Windows users aren't quite so lucky, but still, it's
> not like installing it is a major hassle.
>


Probably, the joke of the day :-)

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


python ioctl

2011-04-14 Thread Nitish Sharma
Hi PyPpl,
For my current project I have a kernel device driver and a user-space
application. This user-space application is already provided to me, and
written in python. I have to extend this application with some addition
features, which involves communicating with kernel device driver through
ioctl() interface.
I am fairly new with Python and not able to grok how to provide "op" in
ioctl syntax - fcntl.ioctl (fd, op[, arg[, mutate_flag]]). Operations
supported by device driver, through ioctl, are of the form: IOCTL_SET_MSG
 _IOR(MAGIC_NUMBER, 0, char*).
It'd be great if some help can be provided about how to "encode" these
operations in python to implement the desired functionality.

Regards
Nitish
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: python ioctl

2011-04-14 Thread Neal Becker
Nitish Sharma wrote:

> Hi PyPpl,
> For my current project I have a kernel device driver and a user-space
> application. This user-space application is already provided to me, and
> written in python. I have to extend this application with some addition
> features, which involves communicating with kernel device driver through
> ioctl() interface.
> I am fairly new with Python and not able to grok how to provide "op" in
> ioctl syntax - fcntl.ioctl (fd, op[, arg[, mutate_flag]]). Operations
> supported by device driver, through ioctl, are of the form: IOCTL_SET_MSG
>  _IOR(MAGIC_NUMBER, 0, char*).
> It'd be great if some help can be provided about how to "encode" these
> operations in python to implement the desired functionality.
> 
> Regards
> Nitish
Here's some of my stuff.  Specific to my device, but maybe you get some ideas

 eioctl.py 
from ctypes import *

libc = CDLL ('/lib/libc.so.6')
#print libc.ioctl

def set_ioctl_argtype (arg_type):
libc.ioctl.argtypes = (c_int, c_int, arg_type)

IOC_WRITE = 0x1

_IOC_NRBITS=8
_IOC_TYPEBITS=  8
_IOC_SIZEBITS=  14
_IOC_DIRBITS=   2

_IOC_NRSHIFT=   0
_IOC_TYPESHIFT= (_IOC_NRSHIFT+_IOC_NRBITS)
_IOC_SIZESHIFT= (_IOC_TYPESHIFT+_IOC_TYPEBITS)
_IOC_DIRSHIFT=  (_IOC_SIZESHIFT+_IOC_SIZEBITS)


def IOC (dir, type, nr, size):
return (((dir)  << _IOC_DIRSHIFT) | \
 ((type) << _IOC_TYPESHIFT) | \
 ((nr)   << _IOC_NRSHIFT) | \
 ((size) << _IOC_SIZESHIFT))

def ioctl (fd, request, args):
return libc.ioctl (fd, request, args)
--

example of usage:

# Enable byte swap in driver
from eioctl import IOC, IOC_WRITE

EOS_IOC_MAGIC = 0xF4

request = IOC(IOC_WRITE, EOS_IOC_MAGIC, 1, struct.calcsize ('i'))
err = fcntl.ioctl(eos_fd, request, 1)



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


Re: about soaplib demo's time latency

2011-04-14 Thread Stephen.Wu
On Apr 14, 5:18 pm, Chris Angelico  wrote:
> On Thu, Apr 14, 2011 at 6:43 PM, Stephen.Wu <54wut...@gmail.com> wrote:
> > I just follow the instructions below 
> > -http://soaplib.github.com/soaplib/2_0/pages/helloworld.html
> > to establish a soap server. After starting the server, everytime I run
> > the client script, I fetch the response nearly 20 seconds afterward.
> > Why this happen?
> > I just want the server send response asap then the client will show
> > the result to me immediately.
>
> > please give some hints. thanks
>
> Not sure if it's what you're seeing, but you might have an issue with
> reverse DNS. When the client connects, the server tries to look up its
> PTR record for its log. You can speed this up by either having such a
> record, or having an authoritative DNS server that returns an
> immediate failure; either option is fairly easy if you run BIND, but
> you might be able to do it with your hosts file (/etc/hosts or
> c:\windows\system32\drivers\etc\hosts) instead - just put in an entry
> for your client computer and some hostname.
>
> Hope that helps!
>
> Chris Angelico

Thanks Chris.
I recheck the logic line by line and I find it is this sentence drag
speed down :  hello_client = Client('http://localhost:7789/?wsdl').
To initialize a suds.client.Client instance need that long lasting 20
seconds?
On your suggestion, if I just want to run the server localhost, how
should I set up the local \etc\hosts file?

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


Re: about soaplib demo's time latency

2011-04-14 Thread Chris Angelico
On Thu, Apr 14, 2011 at 11:30 PM, Stephen.Wu <54wut...@gmail.com> wrote:
> Thanks Chris.
> I recheck the logic line by line and I find it is this sentence drag
> speed down :  hello_client = Client('http://localhost:7789/?wsdl').
> To initialize a suds.client.Client instance need that long lasting 20
> seconds?
> On your suggestion, if I just want to run the server localhost, how
> should I set up the local \etc\hosts file?

It's probably already there for localhost; check the file I named and
see if there's a line looking like:

127.0.0.1   localhost

If there is, you should be able to get reverse DNS for 127.0.0.1. The
other possibility there is that it's the _forward_ DNS that's slow
(although I don't know why it would be). Try the IP instead:

hello_client = Client('http://127.0.0.1:7789/?wsdl')

Chris Angelico
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Egos, heartlessness, and limitations

2011-04-14 Thread Westley Martínez
On Wed, 2011-04-13 at 20:26 -0700, rantingrick wrote:
> On Apr 13, 10:01 pm, Ryan Kelly  wrote:
> > On Wed, 2011-04-13 at 19:10 -0700, rantingrick wrote:
> > > On Apr 13, 8:29 pm, Ryan Kelly  wrote:
> > > > On Wed, 2011-04-13 at 17:39 -0700, rantingrick wrote:
> [...]
> 
> > Funny you should bring that up.  The folks on python-dev are currently
> > making a substantial push to increase involvement in python core
> > development through the "Python Mentors" program.
> >
> > Site here:
> 
> [...]
> 
> > So anyone following along this thread, if you're interested in making a
> > genuine contribution to python as a language, this is a great time and
> > place to start.
> 
> That was a very helpful post Ian, thank you!
> 
> However i have a sneaking suspicion that if i join this group i will
> be denied as was the case with other python groups. However the
> question remains. Why do we need yet another group? Why can we not use
> the comp.lang.python that everyone knows already. Since this is a
> group created for noobs, how do you expect them to find out about it?
> I have been hanging around for over four years and i did not know
> until now. Go figure. The first place people are going to go for
> online help is
> comp.lang.X for whatever language they are learning.
> 
> And who pissed in Guido's punch bowl anyway? Why is he such an elitist
> now? Why can he not come over once and a while and rub shoulders with
> the little people? He does not have to hang out every day, just drop
> in once a week or month at least.
> 
> I guess i am just old fashioned but i though "benevolent" was a
> *positive* moniker. We need to know what kind of leader we are dealing
> with here. We deserve that much. And if he is really "benevolent" then
> *I* will apologize to both him and the community at whole. Until then
> i wait...
> 
> 
> 

Nobody has to do anything.  This is an open source project.

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


Re: [OT] Free software versus software idea patents

2011-04-14 Thread Steven D'Aprano
On Thu, 14 Apr 2011 19:15:05 +1000, Chris Angelico wrote:

> 4) Assumes people aren't deliberately fiddling the figures. Yeah, that
> would be correct. We're in the realm of conspiracy theories here... does
> anyone seriously think that browser stats are THAT important that they'd
> go to multiple web servers with deceitful hits? 

Back in the day, not that many years ago, when it looked like Internet 
Explorer would never dip below 90% market share and web developers coded 
for IE quirks instead of standards as a matter of course, I used to 
fantasize of writing a Windows virus that (apart from propagating) did 
nothing but change the user-agent string on IE. It would have been 
awesome to witness the consternation among web developers.

But thanks to the EU doing what the US DOJ refused to do, and the grass-
roots popularity of Firefox (plus a fewer well-known even if not often 
used browsers like Safari and Opera), and then Google's scarily efficient 
way they can capture hearts and minds on the Internet, IE's market share 
has been whittled away to the point that there are places in the world 
where IE is a minority browser. A large minority, it is true, but still a 
minority.

Now, if only we could convince web users that having your browser execute 
untrusted code downloaded from the Internet is not such a good idea, 
supposed sandbox or not. What the world needs is a virus that silently 
removes Javascript and Flash from browsers...



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


Re: [OT] Free software versus software idea patents

2011-04-14 Thread Chris Angelico
On Fri, Apr 15, 2011 at 12:02 AM, Steven D'Aprano
 wrote:
> Now, if only we could convince web users that having your browser execute
> untrusted code downloaded from the Internet is not such a good idea,
> supposed sandbox or not. What the world needs is a virus that silently
> removes Javascript and Flash from browsers...

We don't need a virus. All we need is a few good blog posts and some
viable alternatives. Flash may very well start dying as HTML5 takes
over; it'll be relegated to in-browser games (some of which are very
good, as it happens), and people will use it only if they play those
games. Javascript/ECMAScript though is here to stay... I very much
doubt anyone's going to abolish or replace it. Sure, executing code
downloaded from the internet can be risky; but scripting is a lot less
risky than downloading plugins, and there's a LOT of people who will
just go "Oh, I need to download something to make this work? Okay.
*click*" - now THAT is the real risk. They don't know (or care)
whether they're getting Adobe Flash Player version 123, or Acrobat
Reader 234, or Java Applet Engine By Bob's Dodgy Coders 345, and if
that doesn't scare sysadmins, nothing will.

Chris Angelico
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: OT] Free software versus software idea patents

2011-04-14 Thread wisecracker
HI Steven D'Aprano...

> Now, if only we could convince web users that having your browser execute
> untrusted code downloaded from the Internet is not such a good idea, supposed 
> sandbox or not.

No need, we have an abundance of half wits - erm I mean, surfers - out there 
willing click on anything.

> What the world needs is a virus that silently removes Javascript and Flash 
> from browsers...

Hmmm, now wouldn't that be fun... >;)



--
73...

Bazza, G0LCU...

Team AMIGA...

http://homepages.tesco.net/wisecracker/

http://main.aminet.net/search?readme=wisecracker

http://mikeos.berlios.de/

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


Re: Free software versus software idea patents

2011-04-14 Thread Ethan Furman

geremy condra wrote:

On Wed, Apr 13, 2011 at 10:50 PM, harrismh777  wrote:

>>

My major professor once told me, "You know you've won the argument when they
start calling you names!"


I think your professor should have said "you know you've won the
argument when you can prove it".



If you can prove it, you know you're right.  Unfortunately, being right 
doesn't mean you win the argument.  :(


~Ethan~
--
http://mail.python.org/mailman/listinfo/python-list


memory usage multi value hash

2011-04-14 Thread christian
Hello,

i'm not very experienced in python. Is there a way doing below more
memory efficient and maybe faster.
I import a  2-column file and  then concat for every unique value in
the first column ( key) the value from the second
columns.

So The ouptut is something like that.
A,1,2,3
B,3,4
C,9,10,11,12,90,34,322,21


Thanks for advance & regards,
Christian


import csv
import random
import sys
from itertools import groupby
from operator import itemgetter

f=csv.reader(open(sys.argv[1]),delimiter=';')
z=[[i[0],i[1]] for i in f]
z.sort(key=itemgetter(0))
mydict = dict((k,','.join(map(itemgetter(1), it)))
   for k, it in groupby(z, itemgetter(0)))
del(z)

f = open(sys.argv[2], 'w')
for k,v in mydict.iteritems():
f.write(v + "\n")

f.close()
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Free software versus software idea patents

2011-04-14 Thread CM
On Apr 14, 1:50 am, harrismh777  wrote:
> Westley Martínez wrote:
>    I don't  even know one person who has Win7 installed, running, and 
>  likes it...
>  >  >>  not even one.
>
> >>> >  >  Hi, m harris, nice to meet you.  Now you do.
>
> >>> >  >  To the online community:  Is there a name for trolling for A by
> >>> >  >  advocating for not-A in a way that discredits your point of view an
> >>> >  >  case so that A now seems much more reasonable?  It's not really
> >>> >  >  "concern trolling".  What would this be called?
>
> >> >  Harrisment.
>
> >> >  /I'm sorry, this is abuse...
>
> >> >  Geremy Condra
> > That was harristerical.
>
> Actually, it is funny... and I love humor as much as I love mathematics,
> software, and freedom. Truly harristerical...    :)
>
> But on a serious note, I did wonder who would be the first jouster to
> offer the argumentum ad hominem? ... ah, sticks and stones...

I don't think there has been any argumentum ad hominem used here.  No
one besmirched you.  What was criticized was your approach, which
seemed counter-productive, and so much so that it seemed like you are
"really" advocating FOR software patents by discrediting the position
against them.

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


Re: [OT] Free software versus software idea patents

2011-04-14 Thread Ian Kelly
On Thu, Apr 14, 2011 at 12:04 AM, harrismh777  wrote:
>    How mamy times have you altered the identity of your web browser so that
> the web site would 'work'? You know, stupid messages from the server that
> say, "We only support IE 6+, upgrade your browser...",  so you tell it
> you're using IE 6 and, well no problem.

I actually can't even recall the last time I had to deal with that
problem, although occasionally I find myself forced to use IE because
the site really, truly doesn't work in Firefox.  It might work in some
other browser, but I'm not going to spend the time trying every FOSS
browser in existence just to avoid using IE.  Anyway, I would hope
that the statisticians who gather this data would be smart enough to
discard any site that was reporting 100% usage of one particular
browser.

Note that user-agent masking is also a rather tech-savvy thing to do.
I sincerely doubt that more than a couple percent of the population
actually does this.  The rest would either grumble about it and start
up IE, or just leave the site without looking back.

Cheers,
Ian
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: [OT] Free software versus software idea patents

2011-04-14 Thread geremy condra
On Thu, Apr 14, 2011 at 12:22 AM, harrismh777  wrote:
> geremy condra wrote:
>>
>> Having said that, I have a greater respect for mathematics than I do
>> for my own economic views, and I don't like seeing it become a
>> political football. If you can prove something,*prove it*. If you
>> cannot- no matter how close you might feel you are- don't claim that
>> math says you're right.
>
>    Fair enough.
>
>    http://www.groklaw.net/articlebasic.php?story=2009151305785
>
>
>    With your background, you will have no problem with this text...
> although, and I do apologize, it is a long text... scroll down and begin
> reading at the heading:
>
>    An Explanation of Computation Theory for Lawyers
>
>    By PolR
>
>
>
>    The write-up is excellent, written as well or better than I could write
> it myself, and is very clear and concise... yes, even a lawyer can
> understand it.

This is not a proof. This is an argument. There's a very big difference.

To be clear, this article makes basically the same mistake you do- you
assume that a program is exactly equivalent to its computation, while
the article makes the additional and even more wrong assumption that a
program is perfectly defined by its CPU instructions. It's to your
credit that you avoided advancing this obviously incorrect claim, but
you still haven't addressed my earlier points.

Geremy Condra
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: memory usage multi value hash

2011-04-14 Thread Peter Otten
christian wrote:

> Hello,
> 
> i'm not very experienced in python. Is there a way doing below more
> memory efficient and maybe faster.
> I import a  2-column file and  then concat for every unique value in
> the first column ( key) the value from the second
> columns.
> 
> So The ouptut is something like that.
> A,1,2,3
> B,3,4
> C,9,10,11,12,90,34,322,21
> 
> 
> Thanks for advance & regards,
> Christian
> 
> 
> import csv
> import random
> import sys
> from itertools import groupby
> from operator import itemgetter
> 
> f=csv.reader(open(sys.argv[1]),delimiter=';')
> z=[[i[0],i[1]] for i in f]
> z.sort(key=itemgetter(0))
> mydict = dict((k,','.join(map(itemgetter(1), it)))
>for k, it in groupby(z, itemgetter(0)))
> del(z)
> 
> f = open(sys.argv[2], 'w')
> for k,v in mydict.iteritems():
> f.write(v + "\n")
> 
> f.close()

I don't expect that it matters much, but you don't need to sort your data if 
you use a dictionary anyway:

import csv
import sys

infile, outfile = sys.argv[1:]

d = {}
with open(infile, "rb") as instream:
for key, value in csv.reader(instream, delimiter=';'):
d.setdefault(key, [key]).append(value)

with open(outfile, "wb") as outstream:
csv.writer(outstream).writerows(d.itervalues())


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


Re: memory usage multi value hash

2011-04-14 Thread Terry Reedy

On 4/14/2011 12:55 PM, Peter Otten wrote:


I don't expect that it matters much, but you don't need to sort your data if
you use a dictionary anyway:


Which means that one can build the dict line by line, as each is read, 
instead of reading the entire file into memory. So it does matter for 
intermediate memory use.



import csv
import sys

infile, outfile = sys.argv[1:]

d = {}
with open(infile, "rb") as instream:
 for key, value in csv.reader(instream, delimiter=';'):
 d.setdefault(key, [key]).append(value)

with open(outfile, "wb") as outstream:
 csv.writer(outstream).writerows(d.itervalues())



--
Terry Jan Reedy

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


Re: Fun python 3.2 one-liner

2011-04-14 Thread Albert van der Horst
In article ,
Daniel Fetchinson   wrote:
>>> what is the character limit on a one liner :P.
>>
>> For PEP 8 compliance, 80 characters. :-)
>
>Yeah, but we don't live in the 80's or 90's anymore and our screens
>can support xterms (or let alone IDE widows) much wider than 80
>characters. I'm using 140 for python these days. Seriously, who would
>want to limit him/herself to 80 characters in 2011?

I want to limit myself to 72 char's for readability.
80 char's is over the top.

>
>Cheers,
>Daniel
>

Groetjes Albert

--
-- 
Albert van der Horst, UTRECHT,THE NETHERLANDS
Economic growth -- being exponential -- ultimately falters.
albert@spe&ar&c.xs4all.nl &=n http://home.hccnet.nl/a.w.m.van.der.horst

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


Re: Egos, heartlessness, and limitations

2011-04-14 Thread Jeffrey Gaynor
Lemme see now...




>i laid out grandiose plans for a new beginning only to have my words
>fall on deaf ears. Have we become so self absorbed as to care only for
>our status and ego and not for the community at whole? 

So you proposed a grandiose plane that is a heck of a lot of work for the 
people on this list who are trying to get their jobs done and are now 
complaining they aren't doing all that extra work for you? Really?  You 
diagnosed this as being caused by



>   * Poor Documentation or lack thereof
>   * Knowledge Hoarding
>   * Selfishness
>   * Lack of alturistic tendancies [sic!]



Again, not having people take a lot of time to personally tutor you is not 
Knowledge Hoarding. An awful lot of knowledge can't be communicated 
successfully to others in written format and requires a great deal of give and 
take, which is time consuming. That you can't just give them orders to work 
overtime at their own expense is not selfishness nor is it lack of altruism. 
You do, however, come across as a self-righteous totalitarian, who seems to 
think that having a good idea means it is incumbent on everyone else to 
implement since you are so special. No. Write a prototype that totally rocks, 
generate some enthusiasm and above all, make a tool that helps *other* people 
and they will flock to this. Said more plainly, the direction of your supposed 
altruism is 180 degrees off the mark. 

Don't know much about this topic, but boy is my BS detector going off... And 
just a tip on people skills, you will never get people to do voluntarily things 
for you (which is the real definition of power) by this sort of shtick.


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


Re: Egos, heartlessness, and limitations

2011-04-14 Thread Grant Edwards
On 2011-04-14, rantingrick  wrote:

> [the usual bait]

One has to congratulate RR on how many fish he catches.  I guess we
should just be glad that in this electronic ocean overfishing doesn't
cause a population crash.

-- 
Grant Edwards   grant.b.edwardsYow! Everybody gets free
  at   BORSCHT!
  gmail.com
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: [OSX] side by side python

2011-04-14 Thread Fabio
In article 
<0d6d1306-6395-4c29-a3c1-b2748bda4...@i39g2000prd.googlegroups.com>,
 Robert  wrote:

> Can I install Python 2.7 and 3.2 (from python.org) side by side on OSX
> without them stepping all over each other?

I have troubles with textwrangler, and I have the feeling it is related 
to the fact that I have two different versions of Python installed.
I am on MacOSX 10.6.7.
I have the "built-in" Python2.5 which comes installed by "mother Apple".
Then I installed Python2.6, and left 2.5 untouched (I was suggested to 
leave it on the system, since "something might need it").

I ran the "Update Shell Profile.command", and now if I launch "python" 
in the terminal it happily launches the 2.6 version.
Then I installed some libraries (scipy and matplotlib).
They work, and everything is fine.

Then, I started to use TexWrangler, and I wanted to use the "shebang" 
menu, and "run" command.
I have the "#! first line" pointing to the 2.6 version.
It works fine, as long as I don't import the libraries, in which case it 
casts an error saying:
import scipy as sp
ImportError: No module named scipy

which makes me think that for some reason it points to the old 2.5 
version. But I might be wrong and the problem is another...

Any clue?

Thanks

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


Re: [OT] Free software versus software idea patents

2011-04-14 Thread Westley Martínez
On Thu, 2011-04-14 at 14:02 +, Steven D'Aprano wrote:
> On Thu, 14 Apr 2011 19:15:05 +1000, Chris Angelico wrote:
> 
> > 4) Assumes people aren't deliberately fiddling the figures. Yeah, that
> > would be correct. We're in the realm of conspiracy theories here... does
> > anyone seriously think that browser stats are THAT important that they'd
> > go to multiple web servers with deceitful hits? 
> 
> Back in the day, not that many years ago, when it looked like Internet 
> Explorer would never dip below 90% market share and web developers coded 
> for IE quirks instead of standards as a matter of course, I used to 
> fantasize of writing a Windows virus that (apart from propagating) did 
> nothing but change the user-agent string on IE. It would have been 
> awesome to witness the consternation among web developers.
> 
> But thanks to the EU doing what the US DOJ refused to do, and the grass-
> roots popularity of Firefox (plus a fewer well-known even if not often 
> used browsers like Safari and Opera), and then Google's scarily efficient 
> way they can capture hearts and minds on the Internet, IE's market share 
> has been whittled away to the point that there are places in the world 
> where IE is a minority browser. A large minority, it is true, but still a 
> minority.
> 
> Now, if only we could convince web users that having your browser execute 
> untrusted code downloaded from the Internet is not such a good idea, 
> supposed sandbox or not. What the world needs is a virus that silently 
> removes Javascript and Flash from browsers...
> 
> 
> 
> -- 
> Steven

Web developers will always use the tool they find to be the most
reliable, efficient, and useful, as will consumers.

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


Re: [OT] Free software versus software idea patents

2011-04-14 Thread Westley Martínez
On Thu, 2011-04-14 at 14:02 +, Steven D'Aprano wrote:
> On Thu, 14 Apr 2011 19:15:05 +1000, Chris Angelico wrote:
> 
> > 4) Assumes people aren't deliberately fiddling the figures. Yeah, that
> > would be correct. We're in the realm of conspiracy theories here... does
> > anyone seriously think that browser stats are THAT important that they'd
> > go to multiple web servers with deceitful hits? 
> 
> Back in the day, not that many years ago, when it looked like Internet 
> Explorer would never dip below 90% market share and web developers coded 
> for IE quirks instead of standards as a matter of course, I used to 
> fantasize of writing a Windows virus that (apart from propagating) did 
> nothing but change the user-agent string on IE. It would have been 
> awesome to witness the consternation among web developers.
> 
> But thanks to the EU doing what the US DOJ refused to do, and the grass-
> roots popularity of Firefox (plus a fewer well-known even if not often 
> used browsers like Safari and Opera), and then Google's scarily efficient 
> way they can capture hearts and minds on the Internet, IE's market share 
> has been whittled away to the point that there are places in the world 
> where IE is a minority browser. A large minority, it is true, but still a 
> minority.
> 
> Now, if only we could convince web users that having your browser execute 
> untrusted code downloaded from the Internet is not such a good idea, 
> supposed sandbox or not. What the world needs is a virus that silently 
> removes Javascript and Flash from browsers...
> 
> 
> 
> -- 
> Steven

Also, why aren't Opera and Google criticized for their proprietary
browsers (Chrome is essentially a proprietary front-end)? Is it because
their browsers follow web standards, or is it because we have demonized
Microsoft?

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


[Mac OSX] TextWrangler "run" command not working properly

2011-04-14 Thread Fabio
Hi to all,
I have troubles with TextWrangler "run" command in the "shebang" (#!) 
menu.
I am on MacOSX 10.6.7.
I have the "built-in" Python2.5 which comes installed by "mother Apple".
Then I installed Python2.6, and left 2.5 untouched (I was suggested to 
leave it on the system, since "something might need it").

I ran the "Update Shell Profile.command", and now if I launch "python" 
in the terminal it happily launches the 2.6 version.
Then I installed some libraries (scipy and matplotlib) on this newer 2.6 
version.
They work, and everything is fine.

Then, I started to use TexWrangler, and I wanted to use the "shebang" 
menu, and "run" command.
I have the "#! first line" pointing to the 2.6 version.
It works fine, as long as I don't import the libraries, in which case it 
casts an error saying:

ImportError: No module named scipy

Maybe for some reason it points to the old 2.5 version. 
But I might be wrong and the problem is another...

I copy here the first lines in the terminal window if i give the "run in 
terminal" command


Last login: Thu Apr 14 22:38:26 on ttys000
Fabio-Mac:~ fabio$ 
/var/folders/BS/BSS71XvjFKiJPH3Wqtx90k+++TM/-Tmp-/Cleanup\ At\ 
Startup/untitled\ text-324506443.860.command ; exit;
Traceback (most recent call last):
  File "/Users/fabio/Desktop/test.py", line 3, in 
import scipy as sp
ImportError: No module named scipy
logout

[Process completed]

where the source (test.py) contains just:

#!/usr/bin/python2.6

import scipy as sp

print "hello world"


Any clue?

Thanks

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


Re: TextWrangler "run" command not working properly

2011-04-14 Thread Jon Clements
On Apr 14, 9:52 pm, Fabio  wrote:
> Hi to all,
> I have troubles with TextWrangler "run" command in the "shebang" (#!)
> menu.
> I am on MacOSX 10.6.7.
> I have the "built-in" Python2.5 which comes installed by "mother Apple".
> Then I installed Python2.6, and left 2.5 untouched (I was suggested to
> leave it on the system, since "something might need it").
>
> I ran the "Update Shell Profile.command", and now if I launch "python"
> in the terminal it happily launches the 2.6 version.
> Then I installed some libraries (scipy and matplotlib) on this newer 2.6
> version.
> They work, and everything is fine.
>
> Then, I started to use TexWrangler, and I wanted to use the "shebang"
> menu, and "run" command.
> I have the "#! first line" pointing to the 2.6 version.
> It works fine, as long as I don't import the libraries, in which case it
> casts an error saying:
>
> ImportError: No module named scipy
>
> Maybe for some reason it points to the old 2.5 version.
> But I might be wrong and the problem is another...
>
> I copy here the first lines in the terminal window if i give the "run in
> terminal" command
>
> Last login: Thu Apr 14 22:38:26 on ttys000
> Fabio-Mac:~ fabio$
> /var/folders/BS/BSS71XvjFKiJPH3Wqtx90k+++TM/-Tmp-/Cleanup\ At\
> Startup/untitled\ text-324506443.860.command ; exit;
> Traceback (most recent call last):
>   File "/Users/fabio/Desktop/test.py", line 3, in 
>     import scipy as sp
> ImportError: No module named scipy
> logout
>
> [Process completed]
>
> where the source (test.py) contains just:
>
> #!/usr/bin/python2.6
>
> import scipy as sp
>
> print "hello world"
>
> Any clue?
>
> Thanks
>
> Fabio

http://www.velocityreviews.com/forums/t570137-textwrangler-and-new-python-version-mac.html
?
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: [OT] Free software versus software idea patents

2011-04-14 Thread Ethan Furman

Westley Martínez wrote:

Also, why aren't Opera and Google criticized for their proprietary
browsers (Chrome is essentially a proprietary front-end)? Is it because
their browsers follow web standards, or is it because we have demonized
Microsoft?


My biggest gripe with Microsoft as that they *don't* follow standards, 
which makes interoperability a nightmare.


~Ethan~

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


Re: TextWrangler "run" command not working properly

2011-04-14 Thread Ernest Obusek
I'm not a python expert, but you might trying running 'print sys.path' inside 
your script and run that from TextWrangler to see where it's looking for 
modules.

- Ernest


On Apr 14, 2011, at 5:01 PM, Jon Clements wrote:

> On Apr 14, 9:52 pm, Fabio  wrote:
>> Hi to all,
>> I have troubles with TextWrangler "run" command in the "shebang" (#!)
>> menu.
>> I am on MacOSX 10.6.7.
>> I have the "built-in" Python2.5 which comes installed by "mother Apple".
>> Then I installed Python2.6, and left 2.5 untouched (I was suggested to
>> leave it on the system, since "something might need it").
>> 
>> I ran the "Update Shell Profile.command", and now if I launch "python"
>> in the terminal it happily launches the 2.6 version.
>> Then I installed some libraries (scipy and matplotlib) on this newer 2.6
>> version.
>> They work, and everything is fine.
>> 
>> Then, I started to use TexWrangler, and I wanted to use the "shebang"
>> menu, and "run" command.
>> I have the "#! first line" pointing to the 2.6 version.
>> It works fine, as long as I don't import the libraries, in which case it
>> casts an error saying:
>> 
>> ImportError: No module named scipy
>> 
>> Maybe for some reason it points to the old 2.5 version.
>> But I might be wrong and the problem is another...
>> 
>> I copy here the first lines in the terminal window if i give the "run in
>> terminal" command
>> 
>> Last login: Thu Apr 14 22:38:26 on ttys000
>> Fabio-Mac:~ fabio$
>> /var/folders/BS/BSS71XvjFKiJPH3Wqtx90k+++TM/-Tmp-/Cleanup\ At\
>> Startup/untitled\ text-324506443.860.command ; exit;
>> Traceback (most recent call last):
>>   File "/Users/fabio/Desktop/test.py", line 3, in 
>> import scipy as sp
>> ImportError: No module named scipy
>> logout
>> 
>> [Process completed]
>> 
>> where the source (test.py) contains just:
>> 
>> #!/usr/bin/python2.6
>> 
>> import scipy as sp
>> 
>> print "hello world"
>> 
>> Any clue?
>> 
>> Thanks
>> 
>> Fabio
> 
> http://www.velocityreviews.com/forums/t570137-textwrangler-and-new-python-version-mac.html
> ?
> -- 
> http://mail.python.org/mailman/listinfo/python-list

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


PEP index by topic

2011-04-14 Thread Eric Snow
Reading the PEPs is a great way to get a look at how Python has developed
and at some of its subtle nuances.  It's a great way to compare your great
new idea to what the community has seriously considered before.  Most of
them have information that you won't find consolidated anywhere else.

Quite a few are either open or languishing.  The open ones you can have a
hand in improving/accepting/rejecting by joining the discussions on
python-ideas and python-dev.  The dead and not-dead-yet ones you could learn
from, and even try to resurrect.  For instance, PEP 3150 is currently
involved in a lengthy discussion on python-ideas and Nick is talking about
revising it now that the moratorium is over.

I've read a handful of the PEPs and found every one to be informative and
helpful.  One problem I have had is that there are so many to read.  Finding
ones applicable to your needs or interests isn't terribly easy.  So in
pursuit of an improvement I have started a PEP index on the Python wiki
organized by topic.

http://wiki.python.org/moin/Topically%20Organized%20PEP%20List

I add a few topics already, but haven't indexed many of the standards track
PEPs.

I would love to see an index like this in PEP 1, but it may not be
practical, as the topics in the index can grow pretty dynamically.  Maybe a
snapshot of the wiki content could be added to PEP 1?  Or maybe just a link
there to the wiki page?  Regardless, I hope everyone finds a topical PEP
index useful.

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


Re: [OT] Free software versus software idea patents

2011-04-14 Thread Martin Gregorie
On Thu, 14 Apr 2011 13:50:24 -0700, Westley Martínez wrote:

> Also, why aren't Opera and Google criticized for their proprietary
> browsers (Chrome is essentially a proprietary front-end)? Is it because
> their browsers follow web standards, or is it because we have demonized
> Microsoft?
>
Personally, I could care less whether a web browser is proprietary or 
not. What matters to me is whether its standards-compliant enough to 
interoperate successfully with standards-compliant browsers. If you're 
going to argue about web standards its better to criticise non-compliant 
servers since those will piss off a greater number of people.

I think the only real evil is to set out to make a non-standards-
compliant server and then design client software that seeks to lock in 
people to your server. FWIW I'm not certain that is anything that MS 
deliberately set out to do. Judging from stories over the years of lost 
code (the Win98 New Year problem) and the general slackness of their 
project management, its equally possible its simply the result of out of 
control, anarchic and undocumented software development. 


-- 
martin@   | Martin Gregorie
gregorie. | Essex, UK
org   |
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: [OT] Free software versus software idea patents

2011-04-14 Thread Chris Angelico
On Fri, Apr 15, 2011 at 7:36 AM, Martin Gregorie
 wrote:
> I think the only real evil is to set out to make a non-standards-
> compliant server and then design client software that seeks to lock in
> people to your server. FWIW I'm not certain that is anything that MS
> deliberately set out to do.

IE 6. Why is it still around? Because MS deliberately set out to
encourage companies to use its features (mainly in intranet
applications).

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


Re: [OT] Free software versus software idea patents

2011-04-14 Thread Martin Gregorie
On Fri, 15 Apr 2011 08:01:42 +1000, Chris Angelico wrote:

> On Fri, Apr 15, 2011 at 7:36 AM, Martin Gregorie
>  wrote:
>> I think the only real evil is to set out to make a non-standards-
>> compliant server and then design client software that seeks to lock in
>> people to your server. FWIW I'm not certain that is anything that MS
>> deliberately set out to do.
> 
> IE 6. Why is it still around? Because MS deliberately set out to
> encourage companies to use its features (mainly in intranet
> applications).
>
Fair point, though I should point out that IIRC its contemporary rivals 
were often as bad when it came to standards compliance. I don't remember 
many standards-compliant browsers before the first release of Opera.

Never ascribe to malice things that can equally be achieved by 
incompetence.
 

-- 
martin@   | Martin Gregorie
gregorie. | Essex, UK
org   |
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: [OT] Free software versus software idea patents

2011-04-14 Thread Westley Martínez
On Fri, 2011-04-15 at 08:01 +1000, Chris Angelico wrote:
> On Fri, Apr 15, 2011 at 7:36 AM, Martin Gregorie
>  wrote:
> > I think the only real evil is to set out to make a non-standards-
> > compliant server and then design client software that seeks to lock in
> > people to your server. FWIW I'm not certain that is anything that MS
> > deliberately set out to do.
> 
> IE 6. Why is it still around? Because MS deliberately set out to
> encourage companies to use its features (mainly in intranet
> applications).
> 
> ChrisA

I always thought it was because sys admins don't bother to upgrade.

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


Re: [OT] Free software versus software idea patents

2011-04-14 Thread Martin Gregorie
On Thu, 14 Apr 2011 15:23:01 -0700, Westley Martínez wrote:

> On Fri, 2011-04-15 at 08:01 +1000, Chris Angelico wrote:
>> On Fri, Apr 15, 2011 at 7:36 AM, Martin Gregorie
>>  wrote:
>> > I think the only real evil is to set out to make a non-standards-
>> > compliant server and then design client software that seeks to lock
>> > in people to your server. FWIW I'm not certain that is anything that
>> > MS deliberately set out to do.
>> 
>> IE 6. Why is it still around? Because MS deliberately set out to
>> encourage companies to use its features (mainly in intranet
>> applications).
>> 
>> ChrisA
> 
> I always thought it was because sys admins don't bother to upgrade.
>
Its both: a lot of company intranets that rely on IE6 quirks and have 
never been upgraded and, evidently, there are still office PCs in use 
that are old enough to have been bought with it installed and never 
upgraded.


-- 
martin@   | Martin Gregorie
gregorie. | Essex, UK
org   |
-- 
http://mail.python.org/mailman/listinfo/python-list


python-farsight

2011-04-14 Thread लेवीस
> I'v mad a text chat sytem in python using xmpp.
>can anyone help me to implement video chat in it, heard python-farsight is 
>used for audio/video conferencing. Can anyone help me how to use it in my 
>code, I'm a python beginer so can't imlement much in python. I found this 
>python-farsight from Gajim src 
>code(http://www.gajim.org/downloads.php?lang=en).Can you people describe which 
>all functions are to be used for starting video chat.
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: about soaplib demo's time latency

2011-04-14 Thread Stephen.Wu
On Apr 14, 9:39 pm, Chris Angelico  wrote:
> On Thu, Apr 14, 2011 at 11:30 PM, Stephen.Wu <54wut...@gmail.com> wrote:
> > Thanks Chris.
> > I recheck the logic line by line and I find it is this sentence drag
> > speed down :  hello_client = Client('http://localhost:7789/?wsdl').
> > To initialize a suds.client.Client instance need that long lasting 20
> > seconds?
> > On your suggestion, if I just want to run the server localhost, how
> > should I set up the local \etc\hosts file?
>
> It's probably already there for localhost; check the file I named and
> see if there's a line looking like:
>
> 127.0.0.1   localhost
>
> If there is, you should be able to get reverse DNS for 127.0.0.1. The
> other possibility there is that it's the _forward_ DNS that's slow
> (although I don't know why it would be). Try the IP instead:
>
> hello_client = Client('http://127.0.0.1:7789/?wsdl')
>
> Chris Angelico

It works. Seems the DNS server will exchange localhost and 127.0.0.1,
taking nearly 15 seconds. Anyway, I got to know the exactly reason let
the initialized procedures down, which is the most important thing.
Thanks again.
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: [OT] Free software versus software idea patents

2011-04-14 Thread Steven D'Aprano
On Fri, 15 Apr 2011 08:01:42 +1000, Chris Angelico wrote:

> On Fri, Apr 15, 2011 at 7:36 AM, Martin Gregorie
>  wrote:
>> I think the only real evil is to set out to make a non-standards-
>> compliant server and then design client software that seeks to lock in
>> people to your server. FWIW I'm not certain that is anything that MS
>> deliberately set out to do.
> 
> IE 6. Why is it still around? Because MS deliberately set out to
> encourage companies to use its features (mainly in intranet
> applications).

IE 6 is still around due to inertia: partly users who haven't upgraded, 
but *mostly* developers who *think* users haven't upgraded, and that IE 6 
is still the standard to code for.

I mean, it's 2011 and I recently came across a site that claimed to only 
support IE and Netscape. Netscape!!!

But if I recall correctly, the proportion of IE users still using IE 6 is 
about 10%, which makes it about 5% of the total browser share. Between 
Google (YouTube, Gmail, etc) and Microsoft dropping support for IE 6, I 
would expect that percentage to rapidly fall.



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


Re: python-farsight

2011-04-14 Thread Steven D'Aprano
On Fri, 15 Apr 2011 06:25:34 +0530, लेवीस quoted:

>> I'v mad a text chat sytem in python using xmpp.
>>can anyone help me to implement video chat in it, heard python-farsight
>>is used for audio/video conferencing. Can anyone help me how to use
>>it in my code, I'm a python beginer so can't imlement much in python. I
>>found this python-farsight from Gajim src
>>code(http://www.gajim.org/downloads.php?lang=en).Can you people describe
>>which all functions are to be used for starting video chat.


Who are you quoting? Did you have a comment to add or a question to ask?



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


Re: about soaplib demo's time latency

2011-04-14 Thread Chris Angelico
On Fri, Apr 15, 2011 at 11:14 AM, Stephen.Wu <54wut...@gmail.com> wrote:
> It works. Seems the DNS server will exchange localhost and 127.0.0.1,
> taking nearly 15 seconds. Anyway, I got to know the exactly reason let
> the initialized procedures down, which is the most important thing.

Generally BIND, on install, is configured to be authoritative for the
.localhost domain (little-known trivia fact: localhost isn't a machine
name, it's a top-level domain - on par with .com or .uk), which should
mean you get fast responses. May want to check your DNS server's
config. I don't know if other DNS software comes nicely preconfigured
like that, but it should, since nobody ever assigns localhost to be
anything else (imagine the confusion THAT would cause - even if you
set it to something relatively innocuous like 127.0.0.2).

Chris Angelico
-- 
http://mail.python.org/mailman/listinfo/python-list


Pythonic infinite for loop?

2011-04-14 Thread Chris Angelico
Apologies for interrupting the vital off-topic discussion, but I have
a real Python question to ask.

I'm doing something that needs to scan a dictionary for elements that
have a particular beginning and a numeric tail, and turn them into a
single list with some processing. I have a function parse_kwdlist()
which takes a string (the dictionary's value) and returns the content
I want out of it, so I'm wondering what the most efficient and
Pythonic way to do this is.

My first draft looks something like this. The input dictionary is
called dct, the output list is lst.

lst=[]
for i in xrange(1,1000): # arbitrary top, don't like this
  try:
lst.append(parse_kwdlist(dct["Keyword%d"%i]))
  except KeyError:
break

I'm wondering two things. One, is there a way to make an xrange object
and leave the top off? (Sounds like I'm risking the numbers
evaporating or something.) And two, can the entire thing be turned
into a list comprehension or something? Generally any construct with a
for loop that appends to a list is begging to become a list comp, but
I can't see how to do that when the input comes from a dictionary.

In the words of Adam Savage: "Am I about to feel really, really stupid?"

Thanks in advance for help... even if it is just "hey you idiot, you
forgot about X"!

Chris Angelico
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: [OT] Free software versus software idea patents

2011-04-14 Thread Steven D'Aprano
On Thu, 14 Apr 2011 13:50:24 -0700, Westley Martínez wrote:

> Also, why aren't Opera and Google criticized for their proprietary
> browsers (Chrome is essentially a proprietary front-end)? Is it because
> their browsers follow web standards, or is it because we have demonized
> Microsoft?

A little of both.

Personally, I think it is *good* that there is a plurality of browsers in 
the market. In my perfect world, no single browser should capture more 
than 20% share of users.


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


Re: [OT] Free software versus software idea patents

2011-04-14 Thread Steven D'Aprano
On Thu, 14 Apr 2011 13:46:46 -0700, Westley Martínez wrote:

>> Now, if only we could convince web users that having your browser
>> execute untrusted code downloaded from the Internet is not such a good
>> idea, supposed sandbox or not. What the world needs is a virus that
>> silently removes Javascript and Flash from browsers...
> 
> Web developers will always use the tool they find to be the most
> reliable, efficient, and useful, as will consumers.

That doesn't explain Javascript or Flash. Both are popular *despite* 
being unreliable and inefficient. The Flash plugin is widely regarded as 
a steaming heap of unreliable crap even on Windows. Its reputation on 
Linux is even worse.

What they give is ubiquity, which is a point in their favour. But just 
because something is common doesn't make it useful: for the most part 
both are used for style over substance, of sizzle without sausage, rather 
than anything actually useful or desirable: think of a misfeature that 
*degrades* the user-experience, and chances are it's implemented in Flash 
or Javascript on tens of thousands of sites.


Yes-I-am-a-bitter-old-curmudgeon-ly y'rs,


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


Re: Egos, heartlessness, and limitations

2011-04-14 Thread Steven D'Aprano
On Thu, 14 Apr 2011 12:15:59 -0500, Jeffrey Gaynor wrote:

[...]
> Don't know much about this topic, but boy is my BS detector going off...

Just search the archives for "rantingrick". He's been around a few years 
now, and my estimate is that 99% of his posts are haranguing others for 
refusing to agree with him, declaring that the silent majority of users 
agree completely with him, that people are going to run away from Python 
to Ruby or some other language unless we *immediately* drop everything 
and work on fixing whatever deficiency Rick cares about this week, and 
making accusations that GvR and the other Python developers are so caught 
up in some bizarre power trip that they are deliberately sabotaging 
Python's future.

I have seen him actually make a constructive, helpful post. Once. By 
memory he helped a n00b with a Tkinter problem. But for every short, 
helpful post he writes, he writes about 80 or 100 long, useless posts 
that turn this list into a tar-pit of wasted time and frustration and 
halves its usefulness.

Save yourself a lot of time and just killfile him now. You'll thank me 
for it later.


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


Re: [OT] Free software versus software idea patents

2011-04-14 Thread Chris Angelico
On Fri, Apr 15, 2011 at 12:09 PM, Steven D'Aprano
 wrote:
> Personally, I think it is *good* that there is a plurality of browsers in
> the market. In my perfect world, no single browser should capture more
> than 20% share of users.

In *MY* perfect world, choice of browser should be completely up to
the user, and web developers should not have to care. You code to the
standard, safe in the knowledge that all your users are going to have
standards-compliant browsers, and you don't care whether some of them
are on Chrome, some on Firefox, some on IE, some on Opera, and some on
TwoCansPieceString. And users know that they can choose whatever
browser gives them the features they want, without having to worry
about whether other sites will fail. We're getting close to that, but
we're not yet there.

> That doesn't explain Javascript or Flash. Both are popular *despite*
> being unreliable and inefficient. The Flash plugin is widely regarded as
> a steaming heap of unreliable crap even on Windows. Its reputation on
> Linux is even worse.

I've tried my hand at writing Flash code. If its next version requires
that developers stab themselves with rusty forks and code using their
own blood, I think it'd be an improvement over the current one. And
from the other end... leaving Flash sites up in my browser is one of
the best ways to destroy my battery life. It sucks... power.

Chris Angelico
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Pythonic infinite for loop?

2011-04-14 Thread Ryan Kelly
On Fri, 2011-04-15 at 12:10 +1000, Chris Angelico wrote:
> Apologies for interrupting the vital off-topic discussion, but I have
> a real Python question to ask.
> 
> I'm doing something that needs to scan a dictionary for elements that
> have a particular beginning and a numeric tail, and turn them into a
> single list with some processing. I have a function parse_kwdlist()
> which takes a string (the dictionary's value) and returns the content
> I want out of it, so I'm wondering what the most efficient and
> Pythonic way to do this is.
> 
> My first draft looks something like this. The input dictionary is
> called dct, the output list is lst.
> 
> lst=[]
> for i in xrange(1,1000): # arbitrary top, don't like this
>   try:
> lst.append(parse_kwdlist(dct["Keyword%d"%i]))
>   except KeyError:
> break
> 
> I'm wondering two things. One, is there a way to make an xrange object
> and leave the top off? (Sounds like I'm risking the numbers
> evaporating or something.)

There is, use an infinite generator:

  def ints_from(start):
  while True:
  yield start
  start += 1


  for i in ints_from(1):
   ..etc...


But why not just put the while loop inline:

  i = 0
  while True:
  try:
  ...etc...
  except KeyError:
  break
  i += 1

It might be even easier to just iterate through the dictionary keys:

  for k in sorted(dct.keys()):
  if k.startswith("Keyword"):
  lst.append(parse_kwdlist(dct[k]))


>  And two, can the entire thing be turned
> into a list comprehension or something? Generally any construct with a
> for loop that appends to a list is begging to become a list comp, but
> I can't see how to do that when the input comes from a dictionary.

You probably could, but I think it would hurt readability in this case:

  lst = [parse_kwdlist(dct[k]) for k in sorted(dct.keys())
   if k.startswith("Keyword")]


  Cheers,

Ryan

-- 
Ryan Kelly
http://www.rfk.id.au  |  This message is digitally signed. Please visit
r...@rfk.id.au|  http://www.rfk.id.au/ramblings/gpg/ for details



signature.asc
Description: This is a digitally signed message part
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Pythonic infinite for loop?

2011-04-14 Thread Nobody
On Fri, 15 Apr 2011 12:10:52 +1000, Chris Angelico wrote:

> One, is there a way to make an xrange object and leave the top off?

itertools.count()

> And two, can the entire thing be turned into a list comprehension or
> something? Generally any construct with a for loop that appends to a
> list is begging to become a list comp, but I can't see how to do that
> when the input comes from a dictionary.

The source of a list comprehension can be any iterable; it doesn't have to
be a list. So:

lst = [parse_kwdlist(dct[key]) for key in dct]
or:
lst = [parse_kwdlist(val) for val in dct.itervalues()]


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


Re: Pythonic infinite for loop?

2011-04-14 Thread Steven D'Aprano
On Fri, 15 Apr 2011 12:10:52 +1000, Chris Angelico wrote:

> Apologies for interrupting the vital off-topic discussion, but I have a
> real Python question to ask.

Sorry, you'll in the wrong forum for that.

*wink*

[...]
> My first draft looks something like this. The input dictionary is called
> dct, the output list is lst.
> 
> lst=[]
> for i in xrange(1,1000): # arbitrary top, don't like this
>   try:
> lst.append(parse_kwdlist(dct["Keyword%d"%i]))
>   except KeyError:
> break
> 
> I'm wondering two things. One, is there a way to make an xrange object
> and leave the top off? 

No. But you can use an itertools.count([start=0]) object, and then catch 
the KeyError when you pass the end of the dict. But assuming keys are 
consecutive, better to do this:

lst = [parse_kwdlist(dct["Keyword%d"%i]) for i in xrange(1, len(dct)+1)]

If you don't care about the order of the results:

lst = [parse_kwdlist(value) for value in dct.values()]




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


Re: Pythonic infinite for loop?

2011-04-14 Thread John Connor
If I understand  your question correctly, what you want is probably
something like:

i = 0
lst=[]
while True:
 try:
   lst.append(parse_kwdlist(dct["Keyword%d"%i]))
   i += 1
 except KeyError:
   break

--jac

On Thu, Apr 14, 2011 at 9:10 PM, Chris Angelico  wrote:
> Apologies for interrupting the vital off-topic discussion, but I have
> a real Python question to ask.
>
> I'm doing something that needs to scan a dictionary for elements that
> have a particular beginning and a numeric tail, and turn them into a
> single list with some processing. I have a function parse_kwdlist()
> which takes a string (the dictionary's value) and returns the content
> I want out of it, so I'm wondering what the most efficient and
> Pythonic way to do this is.
>
> My first draft looks something like this. The input dictionary is
> called dct, the output list is lst.
>
> lst=[]
> for i in xrange(1,1000): # arbitrary top, don't like this
>  try:
>    lst.append(parse_kwdlist(dct["Keyword%d"%i]))
>  except KeyError:
>    break
>
> I'm wondering two things. One, is there a way to make an xrange object
> and leave the top off? (Sounds like I'm risking the numbers
> evaporating or something.) And two, can the entire thing be turned
> into a list comprehension or something? Generally any construct with a
> for loop that appends to a list is begging to become a list comp, but
> I can't see how to do that when the input comes from a dictionary.
>
> In the words of Adam Savage: "Am I about to feel really, really stupid?"
>
> Thanks in advance for help... even if it is just "hey you idiot, you
> forgot about X"!
>
> Chris Angelico
> --
> http://mail.python.org/mailman/listinfo/python-list
>
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: [OT] Free software versus software idea patents

2011-04-14 Thread Roy Smith
In article <4da7a8f5$0$29986$c3e8da3$54964...@news.astraweb.com>,
 Steven D'Aprano  wrote:

> On Thu, 14 Apr 2011 13:50:24 -0700, Westley Martínez wrote:
> 
> > Also, why aren't Opera and Google criticized for their proprietary
> > browsers (Chrome is essentially a proprietary front-end)? Is it because
> > their browsers follow web standards, or is it because we have demonized
> > Microsoft?
> 
> A little of both.
> 
> Personally, I think it is *good* that there is a plurality of browsers in 
> the market. In my perfect world, no single browser should capture more 
> than 20% share of users.

I was just thinking about this the other day.  The browser space is 
currently a perfect example of why competition is good.  Just a few 
years ago, IE dominated the market to the point where people developing 
web applications could completely ignore all other browsers.

Now, while IE may still be the most popular, they've dropped under 50% 
share, and falling, while Firefox and Chrome are still gaining.  It 
won't be long before the three pretty much reach parity.  And, yeah, 
Opera and Safari will continue to survive down in the single digits.

The upshot of this is that people writing web apps these days are much 
more likely to be going for standards compliance then for "Works with 
IE".  This is to everybody's benefit.  The app developers can 
concentrate on building their apps, without wasting time fighting the 
browser wars.  The browser makers are free to innovate in all sorts of 
ways while having a fixed HTML target to shoot for in their rendering 
engines.

Since everybody is working on the same HTML (yeah, OK, big handwave 
there), new browser projects have a reduced barrier to entry.  I can 
take a flyer and install some new browser to try it out, with a 
reasonable expectation that it'll render the pages I go to in a 
reasonable fashion.  It's been a long time since I've run across a page 
that I just couldn't read in my favorite browser d'jour (modulo any 
internal apps from Big Company IT Department that depend on Active-X).  
Even if these projects fail, they sometimes have good idea which get 
incorporated by the Firefoxes and Chromes of the world.
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Pythonic infinite for loop?

2011-04-14 Thread Ryan Kelly
On Fri, 2011-04-15 at 12:34 +1000, Ryan Kelly wrote:
> On Fri, 2011-04-15 at 12:10 +1000, Chris Angelico wrote:
> >
> > 
> > My first draft looks something like this. The input dictionary is
> > called dct, the output list is lst.
> > 
> > lst=[]
> > for i in xrange(1,1000): # arbitrary top, don't like this
> >   try:
> > lst.append(parse_kwdlist(dct["Keyword%d"%i]))
> >   except KeyError:
> > break
> >
> It might be even easier to just iterate through the dictionary keys:
> 
>   for k in sorted(dct.keys()):
>   if k.startswith("Keyword"):
>   lst.append(parse_kwdlist(dct[k]))

Actually sorted() won't work here, since it sorts lexicographically.  So
you'd wind up with "Keyword111" before "Keyword2".  You would have to
sort after extracting the necessary info (assuming order is actually
important in the final list)


   Ryan


-- 
Ryan Kelly
http://www.rfk.id.au  |  This message is digitally signed. Please visit
r...@rfk.id.au|  http://www.rfk.id.au/ramblings/gpg/ for details



signature.asc
Description: This is a digitally signed message part
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: [OT] Free software versus software idea patents

2011-04-14 Thread Roy Smith
In article <4da7abad$0$29986$c3e8da3$54964...@news.astraweb.com>,
 Steven D'Aprano  wrote:

> What they give is ubiquity, which is a point in their favour. But just 
> because something is common doesn't make it useful: for the most part 
> both are used for style over substance, of sizzle without sausage, rather 
> than anything actually useful or desirable: think of a misfeature that 
> *degrades* the user-experience, and chances are it's implemented in Flash 
> or Javascript on tens of thousands of sites.

There's certainly a lot to hate about JS (and even more so, flash), but 
they fill a niche.  They provide a way to have better user interaction 
than you could with just forms and a submit button.

That's not to say there's not lot of sucky shit build with them.  But, 
if they didn't exist, something else would have to take their place.  I 
don't see JS going away any time soon.

Flash, on the other hand, is an unadulterated pile of dung.
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Pythonic infinite for loop?

2011-04-14 Thread Chris Angelico
Thanks for the responses, all! In its strictest sense,
itertools.count() seems to be what I'm after, but may not be what I
need.

On Fri, Apr 15, 2011 at 12:33 PM, Steven D'Aprano
 wrote:
> No. But you can use an itertools.count([start=0]) object, and then catch
> the KeyError when you pass the end of the dict. But assuming keys are
> consecutive, better to do this:
>
> lst = [parse_kwdlist(dct["Keyword%d"%i]) for i in xrange(1, len(dct)+1)]

Ah, didn't think to use len(dct) as the top! And yes, the keys will be
consecutive (or rather, if someone omits Keyword5 then I can
justifiably ignore Keyword6).

> If you don't care about the order of the results:
>
> lst = [parse_kwdlist(value) for value in dct.values()]

No, order will matter (I have to pick up the first N that fit certain
conditions, after parsing).

The dictionary is potentially a lot larger than this particular set of
values (it's a mapping of header:value for a row of a user-provided
CSV file). Does this make a difference to the best option? (Currently
I'm looking at "likely" figures of 60+ keys in the dictionary and 3-8
postage options to pick up, but both of those could increase
significantly before production.)

Efficiency is important, though not king; this whole code will be
inside a loop. But readability is important too.

I can't just give all of dct.values() to parse_kwdlist; the function
parses a particular format of text string, and it's entirely possible
that other values would match that format (some of them are pure
free-form text). This has to get only the ones starting with Keyword,
and in order. Steven, the line you suggested:

lst = [parse_kwdlist(dct["Keyword%d"%i]) for i in xrange(1, len(dct)+1)]

will bomb with KeyError when it hits the first one that isn't present,
I assume. Is there an easy way to say "and when you reach any
exception, not just StopIteration, return the list"? (I could wrap the
whole "lst = " in a try/except, but then it won't set lst at all.)

If not, I think I'll go with:

for i in xrange(1,len(dct)+1):

and otherwise as per OP. Having a check for "if key%d in dct" going
all the way up seems like an odd waste of effort (or maybe I'm wrong
there).

Chris Angelico
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Egos, heartlessness, and limitations

2011-04-14 Thread Ben Finney
Steven D'Aprano  writes:

> Save yourself a lot of time and just killfile him now. You'll thank me
> for it later.

You never thanked *me* for it, after you eventually realised that was
the right decision :-)

-- 
 \ “Time's fun when you're having flies.” —Kermit the Frog |
  `\   |
_o__)  |
Ben Finney
-- 
http://mail.python.org/mailman/listinfo/python-list


pdb and jump - newbie question

2011-04-14 Thread BiDi
I have been trying to figure out how to use pdb to correct simple errors in a 
file and then continue with program execution. Perhaps someone can tell me why 
this is not working for me.

Here is my file test.py:

#--
import pdb
pdb.set_trace()

print """
this is a test file
"""
x = 0
y = 4.2
z = y/x
print z

print "with a bug"
#--


The line `z = y/x` fails because x is zero.

If I run this, I can step until that exception occurs, at which point I see

ZeroDivisionError: 'float division'
> c:\temp\test.py(9)()
-> z = y/x
(Pdb)

Now, I thought I would be able to set x to another value and then jump back to 
re-run the line with the division statement. However, that does not seem to 
work. Here's what happens:

(Pdb) !x = 2
(Pdb) j 9
> c:\temp\test.py(9)()
-> z = y/x
(Pdb) n
--Return--
> c:\temp\test.py(9)()->None
-> z = y/x
(Pdb) n
Traceback (most recent call last):
  File "C:\temp\test.py", line 9, in 
z = y/x
ZeroDivisionError: float division

I have also tried assigning a value to z and jumping past the illegal division, 
but I can't get that to work either.

It seems that there must be a way to do this, but I can't find it. Any help 
would be appreciated.

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