Wednesday, January 27, 2010

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

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

comp.lang.python@googlegroups.com

Today's topics:

* Simple Password Strength Checker Review Help needed - 1 messages, 1 author
http://groups.google.com/group/comp.lang.python/t/c320de989d20c778?hl=en
* python 3's adoption - 6 messages, 5 authors
http://groups.google.com/group/comp.lang.python/t/69463c4b9b1ecd8f?hl=en
* Sikuli: the coolest Python project I have yet seen... - 1 messages, 1 author
http://groups.google.com/group/comp.lang.python/t/766e5530f706ed52?hl=en
* Help parsing a page with python - 4 messages, 2 authors
http://groups.google.com/group/comp.lang.python/t/458b27fb23b667e2?hl=en
* Ad hoc lists vs ad hoc tuples - 2 messages, 2 authors
http://groups.google.com/group/comp.lang.python/t/c8a013c1b308b797?hl=en
* myths about python 3 - 3 messages, 3 authors
http://groups.google.com/group/comp.lang.python/t/8b8f4a9f999e33e8?hl=en
* Terminal application with non-standard print - 1 messages, 1 author
http://groups.google.com/group/comp.lang.python/t/fb21750dc257d33e?hl=en
* scraping with urllib2 - 1 messages, 1 author
http://groups.google.com/group/comp.lang.python/t/a42522ff9aa5e5a5?hl=en
* Python and Ruby - 3 messages, 3 authors
http://groups.google.com/group/comp.lang.python/t/dfe4f6c60032755e?hl=en
* starting a thread in a nother thread - 2 messages, 2 authors
http://groups.google.com/group/comp.lang.python/t/6b1e130987c24aa2?hl=en
* Just drawing lines and plotting points? - 1 messages, 1 author
http://groups.google.com/group/comp.lang.python/t/b6abf422cf3fc103?hl=en

==============================================================================
TOPIC: Simple Password Strength Checker Review Help needed
http://groups.google.com/group/comp.lang.python/t/c320de989d20c778?hl=en
==============================================================================

== 1 of 1 ==
Date: Wed, Jan 27 2010 12:03 am
From: Paul Rubin


Steven D'Aprano <steven@REMOVE.THIS.cybersource.com.au> writes:
> I think you're missing a word there. Relatively secure perhaps?

Yes, something like that, oops.

> The problem is that most users will not be a little bit careful. They
> will stick the password on a Post-it note on the side of the monitor,...

Right, that's what I mean about careful. But, people do generally
develop skills at keeping important bits of paper (like their drivers'
license) safe.

> Besides, with the number of on-line identities and passwords many people
> need, you'll need a separate wallet just for the passwords. I have
> something of the order of 80 or 90 passwords written down..

I don't have anywhere that many important ones. For the less important
ones I just use my browser's auto-fill feature (i.e. the passwords are
stored in the browser). I generate important ones with a program (2-6
words selected at random from a dictionary). When I generate a new one,
I write it on a slip of paper that I keep in my pocket and refer to as
necessary. After referring to the paper a few times I usually remember
the password and don't need the paper any more, so I dispose of it.

> So I need at least one (and likely more) password I can keep in my
> head, so I can encrypt my list of rarely-used passwords.

If there's just one, and it's a phrase, you can remember it.

> since I'm really bad at judging randomness (like nearly all humans),

Right, humans are no good at generating or judging randomness. It's
best to use an entropy source. www.diceware.com explains how to do it
with dice and a wordlist they supply. I use a program something like
the following instead:

from math import log
dictfile = '/usr/share/dict/words'

def genrandom(nbytes):
with open('/dev/urandom') as f:
return int(f.read(nbytes).encode('hex'), 16)

def main():
wordlist = list(x.strip() for x in open(dictfile) if len(x) < 7)
nwords = len(wordlist)
print "%d words, entropy=%.3f bits/word"% (
nwords, log(nwords, 2))
print '-'.join(wordlist[genrandom(10)%nwords] for i in xrange(5))

main()

You can also use the diceware word list instead of the unix wordlist,
of course.

==============================================================================
TOPIC: python 3's adoption
http://groups.google.com/group/comp.lang.python/t/69463c4b9b1ecd8f?hl=en
==============================================================================

== 1 of 6 ==
Date: Wed, Jan 27 2010 12:20 am
From: Steven D'Aprano


On Tue, 26 Jan 2010 23:37:00 -0800, Paul Rubin wrote:

> Steven D'Aprano <steven@REMOVE.THIS.cybersource.com.au> writes:
>> Sorry, I meant consistent with the rest of Python, which mostly uses
>> functions/methods and only rarely statements (e.g. del and import).
>
> yield, assert, if/else, return, etc. If we're after that kind of
> consistency, why not get rid of all those statements too? They have
> already partly done it with yield, and they ended up introducing a new
> separate if/else expression syntax as an alternative to the statement.

Without becoming a purely functional language, you won't get rid of all
statements. In my opinion, outside of such purely functional languages
and unconventional languages like Forth, statements play a valuable role
in that they are controlling syntax. For example:

for, while, if, try, break, yield, return

are all used for flow control, and should remain as statements. But print
is not -- it's a function disguised as a statement. print, after all, is
just sugar for stdout.write, which is fine as far as it goes, but when
you want to do something slightly different from what the sugar does, it
becomes terribly inconvenient.

A consequence of print being a statement is that my modules are often
filled with functions and methods called "print_". Suppose I want to
print the type of each argument as well as it's value. I would like to do
this:


def decorator(pr):
def inner(*args, **kwargs):
args = [(type(a), a) for a in args]
pr(*args, **kwargs)
return inner

print = decorator(print)


and then use print as normal, but of course I can't. So instead I do
something like this:


def print_(*args, **kwargs):
args = [(type(a), a) for a in args]
kw = {'file': sys.stdout, 'sep': ' ', 'end': '\n'}
kw.update(kwargs)
if len(kw) != 3:
raise TypeError('invalid keyword argument')
file = kw['file']
sep = kw['sep']
end = kw['end']
for arg in args:
print >>file, (str(arg) + sep), # Don't forget the comma.
print >>file, end, # Another comma.


And then, I have to remember to call print_ instead of print.

--
Steven


== 2 of 6 ==
Date: Wed, Jan 27 2010 12:36 am
From: Paul Rubin


Steven D'Aprano <steven@REMOVE.THIS.cybersource.com.au> writes:
> Without becoming a purely functional language, you won't get rid of all
> statements.

Why not? GCC lets you use any statement in an expression:

#include <stdio.h>

main()
{
int i, x, p=0;
x = ({ for (i=1; i<=10; i++) p += i; p;});
printf ("x=%d\n", x);
}

and C is certainly not a purely functional language.

> for, while, if, try, break, yield, return
> are all used for flow control, and should remain as statements.

What about assert, import, and pass?


== 3 of 6 ==
Date: Wed, Jan 27 2010 1:35 am
From: Daniel Fetchinson


>>> * Print is now a function. Great, much improvement.
>
> Actually not, IMHO. All it does is is to provide incompatibility.


What incompatibility are you exactly talking about?

Python 2.6.2 (r262:71600, Aug 21 2009, 12:23:57)
[GCC 4.4.1 20090818 (Red Hat 4.4.1-6)] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> print( 'hello' )
hello
>>> print 'hello'
hello
>>>

Yes, this is with python 2.6.2 which is in the 2.x line of releases. So?

Cheers,
Daniel

--
Psss, psss, put it down! - http://www.cafepress.com/putitdown


== 4 of 6 ==
Date: Wed, Jan 27 2010 2:19 am
From: Steve Holden


Paul Rubin wrote:
> Steven D'Aprano <steven@REMOVE.THIS.cybersource.com.au> writes:
>> Without becoming a purely functional language, you won't get rid of all
>> statements.
>
> Why not? GCC lets you use any statement in an expression:
>
> #include <stdio.h>
>
> main()
> {
> int i, x, p=0;
> x = ({ for (i=1; i<=10; i++) p += i; p;});
> printf ("x=%d\n", x);
> }
>
> and C is certainly not a purely functional language.
>
>> for, while, if, try, break, yield, return
>> are all used for flow control, and should remain as statements.
>
> What about assert, import, and pass?

Remember that Guido stated (I think in the original FAQ entry for why
assignments don't produce results, but I could be wrong) that he
explicitly wanted Python to be a statement-based language.

regards
Steve
--
Steve Holden +1 571 484 6266 +1 800 494 3119
PyCon is coming! Atlanta, Feb 2010 http://us.pycon.org/
Holden Web LLC http://www.holdenweb.com/
UPCOMING EVENTS: http://holdenweb.eventbrite.com/

== 5 of 6 ==
Date: Wed, Jan 27 2010 3:40 am
From: Xah Lee


Someone is badmouthing me, and it has been doing so over the years. I
feel obliged to post a off topic relpy. See:

• DreamHost.com and A Incidence of Harassment
http://xahlee.org/Periodic_dosage_dir/t2/harassment.html

• Why Can't You Be Normal?
http://xahlee.org/Netiquette_dir/why_cant_you_be_normal.html

Xah

On Jan 26, 7:12 pm, "Alf P. Steinbach" <al...@start.no> wrote:
> * John Bokma:
>
> > "Alf P. Steinbach" <al...@start.no> writes:
>
> >> Please don't post more noise and ad hominem attacks to the group,
> >> Steve.
>
> > Funny that you talk about noise while replying yourself to noise. Xah
> > Lee is just a pathetic spammer. He's not going to reply in this
> > thread. He just shits out his stuff in as many groups as possible to
> > promote his website.
>
> Sorry, I didn't know.
>
> Thanks for the heads-up.
>
> Cheers,
>
> - Alf

== 6 of 6 ==
Date: Wed, Jan 27 2010 4:26 am
From: Xah Lee


On Jan 26, 3:47 pm, Xah Lee <xah...@gmail.com> wrote:

> * Many functions that return lists now returns "Views" or
> "Iterators" Instead. A fucking fuck all fucked up shit. A extraneous
> "oop engineering" complication. (See: Lambda in Python 3000)

See also:

"Iterators: Signs of Weakness in Object-Oriented Languages" (1992) By
Henry G Baker. http://home.pipeline.com/~hbaker1/Iterator.html

Xah wrote:
> * The cmp() function used in sort is basically gone, users are now
> supposed to use the "key" parameter instead. This is a flying-face-
> fuck to computer science. This would be the most serious fuckup in
> python 3. (See: Sorting in Python and Perl)

Steven D'Aprano wrote:
> I did too, when I first heard cmp was to be dumped. But I changed my mind
> and now agree with the decision to drop cmp. Custom sorts are nearly
> always much better written with key rather than cmp: key adds an O(N)
> overheard to the sorting, while cmp makes sorting O(N**2). In other
> words, key is *much* faster, and generally easier to write as well.

The reason cmp is a order slower is due to Python lang's limitation
and compiler implementation limitation.

• Sorting in Python and Perl
http://xahlee.org/perl-python/sort_list.html

the python lang, by the very nature of being a dynamic lang, makes it
hard for compiler analize and optimize a sort function call with cmp
argument that is equivalent to a key.

So, for practical reasons, i think a "key" parameter is fine. But
chopping off "cmp" is damaging. When your data structure is complex,
its order is not embedded in some "key". Taking out "cmp" makes it
impossible to sort your data structure.

in the essay, i also gave a few examples of data structures where you
need a general means to specify the ordering function in order to
sort. Without a cmp, you'll need to munge your data by some decorate-
sort-dedecorate technique.

From another perspective, often it is considered a good principle of
design that the lang be a bit flexible to let programers do what they
want, instead of force them into one way. Python, being a loosely
typed lang, with so-called "duck typing", in contrast to Java or OCaml
in different ways, certainly is more on the lose extreme of the lang
spectrum with respect to code construction. So, i don't see how python
3 people made the decision to removed cmp. (am pretty sure, at least
part of the reason, is a ill attitude towards functional programing
and lambda, lead by Guido.)

> There may be a handful of rare applications where there is no obvious way
> to convert a cmp function to a key, but they are vanishingly rare. I
> think, if you search the archives, Paul Rubin may have come up with one
> example. There are a number of recipes for easily converting cmp sorts to
> key sorts.

You say that it is rare. You are probably right. Though, that may just
be caused by the language itself and consequently the type of people
who uses it. If Python's lambda is not limited, and the python
community doesn't look down on lambda, it is likely cmp will used
more. The more your data structure becomes complex, the more cmp will
be needed.

> I think, in my perfect world, list.sort() and sorted() should continue
> being key based, while the standard library contained (perhaps in the
> functools module?) a sort function that contains all the bells and
> whistles. You want cmp, it's there, and you can pay the extra cost if you
> need it. You want to sort multiple lists by the contents of one? One
> import away. But keep the general sort() function lean and super-fast.

btw, is something like cmp still available in some module for sort?

Xah
http://xahlee.org/

==============================================================================
TOPIC: Sikuli: the coolest Python project I have yet seen...
http://groups.google.com/group/comp.lang.python/t/766e5530f706ed52?hl=en
==============================================================================

== 1 of 1 ==
Date: Wed, Jan 27 2010 12:45 am
From: alex23


Tim Roberts <t...@probo.com> wrote:
> it's not the most efficient way to automate applications

Sikuli doesn't seem that much different from Python in this way: it
may not be the most efficient use of the computer's time, but I dare
say it's significantly less demanding on the end user's.

I can see Sikuli easily progressing to a full visual programming
interface, replacing the 'click' keyword et al with iconic
representations.

Simple "script-less" GUI macro-ing for the masses? Fantastic.

==============================================================================
TOPIC: Help parsing a page with python
http://groups.google.com/group/comp.lang.python/t/458b27fb23b667e2?hl=en
==============================================================================

== 1 of 4 ==
Date: Wed, Jan 27 2010 2:13 am
From: Simon Brunning


2010/1/27 mierdatutis mi <mmm286@gmail.com>:
> Hi,
>
> I would like to parse a webpage to can get the url of the video download. I
> use pyhton and firebug but I cant get the url link.
>
> Example:
>
> The url where I have to get the video link is:
> http://www.rtve.es/mediateca/videos/20100125/saber-comer---salsa-verde-judiones-25-01-10/676590.shtml"
>
> The video is
> http://www.rtve.es/resources/TE_SSAC011/flv/8/2/1264426362028.flv
> Could you help me please?

That URL doesn't appear to be in the HTML - it must be being brought
in by the JavaScript somehow.

--
Cheers,
Simon B.


== 2 of 4 ==
Date: Wed, Jan 27 2010 3:51 am
From: Simon Brunning


2010/1/27 mierdatutis mi <mmm286@gmail.com>:
> Those videos are generated by javascript.
> There is some parser with python for javascript???

There is <http://github.com/davisp/python-spidermonkey>, but
simulating the whole context of a browser is going to be a horror.

You are probably far better off automating a real browser. WebDriver
(<http://bit.ly/crAEPu>) has Python bindings these days. It's
primarily intended for functional testing, but it might be a good fit
here too.

--
Cheers,
Simon B.


== 3 of 4 ==
Date: Wed, Jan 27 2010 4:00 am
From: Javier Collado


Hello,

A test case for Windmill might also be used to extract the information
that you're looking for.

Best regards,
Javier

2010/1/27 mierdatutis mi <mmm286@gmail.com>:
> Those videos are generated by javascript.
> There is some parser with python for javascript???
>
> Thanks a lot!
>
>
> 2010/1/27 Simon Brunning <simon@brunningonline.net>
>>
>> 2010/1/27 mierdatutis mi <mmm286@gmail.com>:
>> > Hi,
>> >
>> > I would like to parse a webpage to can get the url of the video
>> > download. I
>> > use pyhton and firebug but I cant get the url link.
>> >
>> > Example:
>> >
>> > The url where I have to get the video link is:
>> >
>> > http://www.rtve.es/mediateca/videos/20100125/saber-comer---salsa-verde-judiones-25-01-10/676590.shtml"
>> >
>> > The video is
>> > http://www.rtve.es/resources/TE_SSAC011/flv/8/2/1264426362028.flv
>> > Could you help me please?
>>
>> That URL doesn't appear to be in the HTML - it must be being brought
>> in by the JavaScript somehow.
>>
>> --
>> Cheers,
>> Simon B.
>> --
>> http://mail.python.org/mailman/listinfo/python-list
>
>
> --
> http://mail.python.org/mailman/listinfo/python-list
>
>


== 4 of 4 ==
Date: Wed, Jan 27 2010 4:14 am
From: Simon Brunning


2010/1/27 mierdatutis mi <mmm286@gmail.com>:
> Hello again,
>
> What test case for Windmill? Can you say me the link, please?

http://lmgtfy.com/?q=windmill+test

--
Cheers,
Simon B.

==============================================================================
TOPIC: Ad hoc lists vs ad hoc tuples
http://groups.google.com/group/comp.lang.python/t/c8a013c1b308b797?hl=en
==============================================================================

== 1 of 2 ==
Date: Wed, Jan 27 2010 2:20 am
From: Floris Bruynooghe


One thing I ofter wonder is which is better when you just need a
throwaway sequence: a list or a tuple? E.g.:

if foo in ['some', 'random', 'strings']:
...
if [bool1, bool2, boo3].count(True) != 1:
...

(The last one only works with tuples since python 2.6)

Is a list or tuple better or more efficient in these situations?


Regards
Floris

PS: This is inspired by some of the space-efficiency comments from the
list.pop(0) discussion.


== 2 of 2 ==
Date: Wed, Jan 27 2010 4:22 am
From: Iain King


On Jan 27, 10:20 am, Floris Bruynooghe <floris.bruynoo...@gmail.com>
wrote:
> One thing I ofter wonder is which is better when you just need a
> throwaway sequence: a list or a tuple?  E.g.:
>
> if foo in ['some', 'random', 'strings']:
>     ...
> if [bool1, bool2, boo3].count(True) != 1:
>    ...
>
> (The last one only works with tuples since python 2.6)
>
> Is a list or tuple better or more efficient in these situations?
>
> Regards
> Floris
>
> PS: This is inspired by some of the space-efficiency comments from the
> list.pop(0) discussion.

I tend to use tuples unless using a list makes it easier to read. For
example:

if foo in ('some', 'random', 'strings'):

draw.text((10,30), "WHICH IS WHITE", font=font)
draw.line([(70,25), (85,25), (105,45)])

I've no idea what the performance difference is; I've always assumed
it's negligible.

Iain

==============================================================================
TOPIC: myths about python 3
http://groups.google.com/group/comp.lang.python/t/8b8f4a9f999e33e8?hl=en
==============================================================================

== 1 of 3 ==
Date: Wed, Jan 27 2010 2:32 am
From: Daniel Fetchinson


Hi folks,

I was going to write this post for a while because all sorts of myths
periodically come up on this list about python 3. I don't think the
posters mean to spread false information on purpose, they simply are
not aware of the facts.

My list is surely incomplete, please feel free to post your favorite
misconception about python 3 that people periodically state, claim or
ask about.

1. Print statement/function creates incompatibility between 2.x and 3.x!

Certainly false or misleading, if one uses 2.6 and 3.x the
incompatibility is not there. Print as a function works in 2.6:

Python 2.6.2 (r262:71600, Aug 21 2009, 12:23:57)
[GCC 4.4.1 20090818 (Red Hat 4.4.1-6)] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> print( 'hello' )
hello
>>> print 'hello'
hello
>>>


2. Integer division creates incompatibility between 2.x and 3.x!

Again false or misleading, because one can get the 3.x behavior with 2.6:

Python 2.6.2 (r262:71600, Aug 21 2009, 12:23:57)
[GCC 4.4.1 20090818 (Red Hat 4.4.1-6)] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> 6/5
1
>>> from __future__ import division
>>> 6/5
1.2


Please feel free to post your favorite false or misleading claim about python 3!

Cheers,
Daniel


--
Psss, psss, put it down! - http://www.cafepress.com/putitdown


== 2 of 3 ==
Date: Wed, Jan 27 2010 2:40 am
From: Stefan Behnel


Daniel Fetchinson, 27.01.2010 11:32:
> 1. Print statement/function creates incompatibility between 2.x and 3.x!
>
> Certainly false or misleading, if one uses 2.6 and 3.x the
> incompatibility is not there. Print as a function works in 2.6:
>
> Python 2.6.2 (r262:71600, Aug 21 2009, 12:23:57)
> [GCC 4.4.1 20090818 (Red Hat 4.4.1-6)] on linux2
> Type "help", "copyright", "credits" or "license" for more information.
> >>> print( 'hello' )
> hello
> >>> print 'hello'
> hello

This is actually misleading by itself, as the first statement is not a
function call in Py2:

Python 2.6.4 (r264:75706, Dec 7 2009, 18:43:55)
[GCC 4.4.1] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> print(1,2)
(1, 2)

It can, however, be made a function call through a future import in 2.6:

>>> from __future__ import print_function
>>> print(1,2)
1 2

Stefan


== 3 of 3 ==
Date: Wed, Jan 27 2010 2:45 am
From: Andre Engels


On Wed, Jan 27, 2010 at 11:32 AM, Daniel Fetchinson
<fetchinson@googlemail.com> wrote:
> Hi folks,
>
> I was going to write this post for a while because all sorts of myths
> periodically come up on this list about python 3. I don't think the
> posters mean to spread false information on purpose, they simply are
> not aware of the facts.
>
> My list is surely incomplete, please feel free to post your favorite
> misconception about python 3 that people periodically state, claim or
> ask about.
>
> 1. Print statement/function creates incompatibility between 2.x and 3.x!
>
> Certainly false or misleading, if one uses 2.6 and 3.x the
> incompatibility is not there. Print as a function works in 2.6:
>
> Python 2.6.2 (r262:71600, Aug 21 2009, 12:23:57)
> [GCC 4.4.1 20090818 (Red Hat 4.4.1-6)] on linux2
> Type "help", "copyright", "credits" or "license" for more information.
>>>> print( 'hello' )
> hello
>>>> print 'hello'
> hello
>>>>
>
>
> 2. Integer division creates incompatibility between 2.x and 3.x!
>
> Again false or misleading, because one can get the 3.x behavior with 2.6:
>
> Python 2.6.2 (r262:71600, Aug 21 2009, 12:23:57)
> [GCC 4.4.1 20090818 (Red Hat 4.4.1-6)] on linux2
> Type "help", "copyright", "credits" or "license" for more information.
>>>> 6/5
> 1
>>>> from __future__ import division
>>>> 6/5
> 1.2
>
>
> Please feel free to post your favorite false or misleading claim about python 3!

Well, I see two false or misleading claims just above - namely that
the two claims above are false or misleading. They tell just half of
the story, and that half is indeed easy. A Python 3 program can be
unchanged (in the case of print) or with only trivial modifications
(in the case of integer division) be made to run on Python 2.6. The
other way around this is _not_ the case. To say that two things are
compatible if one can be used for the other, but the other not for the
first, is false or misleading.


--
André Engels, andreengels@gmail.com

==============================================================================
TOPIC: Terminal application with non-standard print
http://groups.google.com/group/comp.lang.python/t/fb21750dc257d33e?hl=en
==============================================================================

== 1 of 1 ==
Date: Wed, Jan 27 2010 3:23 am
From: Rémi


On 25 jan, 23:30, Sean DiZazzo <half.ital...@gmail.com> wrote:
> On Jan 24, 11:27 am, Rémi <babedo...@yahoo.fr> wrote:
>
>
>
> > Hello everyone,
>
> > I would like to do a Python application that prints data to stdout, but
> > not the common way. I do not want the lines to be printed after each
> > other, but the old lines to be replaced with the new ones, like wget
> > does it for example (when downloading a file you can see the percentage
> > increasing on a same line).
>
> > I looked into the curses module, but this seems adapted only to do a
> > whole application, and the terminal history is not visible anymore when
> > the application starts.
>
> > Any ideas?
>
> > Thanks,
>
> > Remi
>
> You might want to take a look at the readline module.
>
> ~Sean

Thanks everyone for your answers, that helped a lot.

==============================================================================
TOPIC: scraping with urllib2
http://groups.google.com/group/comp.lang.python/t/a42522ff9aa5e5a5?hl=en
==============================================================================

== 1 of 1 ==
Date: Wed, Jan 27 2010 3:58 am
From: Javier Collado


Hello,

To accept cookies, use the HTTPCookieProcessor as explained here:
http://www.nomadjourney.com/2009/03/automatic-site-login-using-python-urllib2/

Best regards,
Javier

2010/1/27 Andre Engels <andreengels@gmail.com>:
> On Wed, Jan 27, 2010 at 6:26 AM, Patrick <whyadd9@gmail.com> wrote:
>> I'm trying to scrape the attached link for the price listed $99.99:
>> http://bananarepublic.gap.com/browse/product.do?cid=41559&vid=1&pid=692392
>>
>> I can see the price if I view the source(I even turned off java and
>> javascript), but when I use urllib2, the price doesn't show up.
>>
>> Is there another library other than urllib2 that would work?
>
> To see that page you need to accept cookies from the site and send them back.
>
>
>
> --
> André Engels, andreengels@gmail.com
> --
> http://mail.python.org/mailman/listinfo/python-list
>

==============================================================================
TOPIC: Python and Ruby
http://groups.google.com/group/comp.lang.python/t/dfe4f6c60032755e?hl=en
==============================================================================

== 1 of 3 ==
Date: Wed, Jan 27 2010 5:01 am
From: Jean Guillaume Pyraksos


What are the arguments for choosing Python against Ruby
for introductory programming ? Python has no provisions
for tail recursion, Ruby is going to... So what ?
Thanks,

JG


== 2 of 3 ==
Date: Wed, Jan 27 2010 5:04 am
From: Stefan Behnel


Jean Guillaume Pyraksos, 27.01.2010 14:01:
> What are the arguments for choosing Python against Ruby
> for introductory programming ?

PEP 20:

http://www.python.org/dev/peps/pep-0020/

Stefan


== 3 of 3 ==
Date: Wed, Jan 27 2010 5:47 am
From: Simon Brunning


2010/1/27 Jean Guillaume Pyraksos <wissme@hotmail.com>:
> What are the arguments for choosing Python against Ruby
> for introductory programming ?

Frankly, either would be a good choice.

I think Python is a little cleaner, but I'm sure you'd find Ruby fans
who'd argue the complete opposite. Both have good ecosystems, (i.e.
good communities, and plenty of good libraries and frameworks) - but
Python is probably a bit ahead here having been around a bit longer.

> Python has no provisions
> for tail recursion, Ruby is going to... So what ?

This would be a very strange reason to pick one language over the
other - it's a very minor point.

--
Cheers,
Simon B.

==============================================================================
TOPIC: starting a thread in a nother thread
http://groups.google.com/group/comp.lang.python/t/6b1e130987c24aa2?hl=en
==============================================================================

== 1 of 2 ==
Date: Wed, Jan 27 2010 5:06 am
From: Richard Lamboj

hello,

just for _curiosity_. What would be if i start a thread in a nother thread and
acquire a lock in the "child" thread. Is there anything that could go wrong
if someone try to start threads in threads?

Kind Regards,

Richi


== 2 of 2 ==
Date: Wed, Jan 27 2010 5:10 am
From: Stefan Behnel


Richard Lamboj, 27.01.2010 14:06:
> just for _curiosity_. What would be if i start a thread in a nother thread and
> acquire a lock in the "child" thread. Is there anything that could go wrong
> if someone try to start threads in threads?

There's usually tons of things that can go wrong w.r.t. threads:

http://www.eecs.berkeley.edu/Pubs/TechRpts/2006/EECS-2006-1.pdf

However, there's nothing special to a thread that was started from another
thread, so the problems don't change.

Stefan

==============================================================================
TOPIC: Just drawing lines and plotting points?
http://groups.google.com/group/comp.lang.python/t/b6abf422cf3fc103?hl=en
==============================================================================

== 1 of 1 ==
Date: Wed, Jan 27 2010 6:05 am
From: "Alf P. Steinbach"


* rantingrick:
> On Jan 26, 10:52 pm, "Alf P. Steinbach" <al...@start.no> wrote:
>> * rantingrick:
>>
>>
>>
>>
>>
>>> On Jan 26, 9:38 pm, Terry Reedy <tjre...@udel.edu> wrote:
>>>> On 1/26/2010 7:54 PM, Chris Rebert wrote:
>>>>> On Tue, Jan 26, 2010 at 4:36 PM, Someone Something<fordhai...@gmail.com> wrote:
>>>>>> Hello,
>>>>>> I need a python library that makes drawing lines and plotting points (these
>>>>>> two things are the only things I need to do) easy. Or, how can I do
>>>>>> something like this with pygame? Basically, what I want to do is make
>>>>>> graphs. In pygame, since the coordinate system switches the x's and the y's
>>>>>> I would have to switch them again when I plot my points so my graphs look
>>>>>> okay. I hope this was enough info for me to get a good answer.
>>>>> matplotlib, perhaps?:http://matplotlib.sourceforge.net/
>>>> or dislin?
>>> it doesn't get any easier than the tkCanvas widget...
>>> import Tkinter as tk
>>> #import tkinter as tk #python3.0+
>>> app = tk.Tk()
>>> canvas = tk.Canvas(app)
>>> canvas.pack()
>>> canvas.create_line(sx,sy, ex,ey)
>>> #...
>>> #...
>>> app.mainloop()
>> He he, it's even easier to draw a graph using the turtle module.
>>
>> Cheers,
>>
>> - Alf
>
> Yes Alf please forgive me, i had completely forgotten about the
> "visual" learners amongst us.
>
> turtle, turtle, watch him go...
> turtle, turtle, why he so slow...
> turtle, turtle, not even he don't know...?
>
> ;-)

Uhm, that is a misconception.

Just do

turtle.hideturtle()
turtle.tracer( 0 )

to turn off the animation stuff.

That said, the turtle module bundled with Python is somewhat limited, but for
plotting simple graphs it's certainly simpler than using tkinter directly.


Cheers & hth.,

- Alf


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

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