Finding Default Page Name using urllib2

2008-10-27 Thread barrett
Is there a way to find the name of a page you are retrieving using python. For example, if I get http://www.cnn.com/ i want to know that the page is index.html. I can do this using wget. as seen in the code below. Can I do this in python? Thanks, $ wget cnn.com --11:15:25-- http://cnn.com/

PLEASE HELP--Button images refuse to show.

2010-04-19 Thread Barrett
I have been fighting the same bug for weeks now with zero success: I am trying to get images to come up on my buttons, but they are way too small. Regardless of whether I used my old Python 2.5.1 or now 2.6.5, the following code: '''Minesweeper.''' from Tkinter import * #from

Re: What is Expresiveness in a Computer Language?

2005-07-10 Thread Pete Barrett
o dig the garden, but you wouldn't if a spade was available). Similarly with computer languages - some are better for certain tasks than others, but I don't think 'expressiveness' is the way to describe that. Pete Barrett -- http://mail.python.org/mailman/listinfo/python-list

with ignored

2013-04-07 Thread Barrett Lewis
depth explanation of how this is working. I am trying to learn as much as possible about the actual python internals. Thanks in advance! -Barrett -- http://mail.python.org/mailman/listinfo/python-list

Re: with ignored

2013-04-07 Thread Barrett Lewis
> > However, ignored() is actually implemented as a generator function > with the @contextmanager decorator shortcut. This decorator takes a > generator function and wraps it up as a class with the necessary > __enter__ and __exit__ methods. The __enter__ method in this case > calls the .next() m

Re: Formatting lost in hg-web (was Re: with ignored)

2013-04-08 Thread Barrett Lewis
I am viewing it on Chrome Version 26.0.1410.43 m for windows and it works perfectly for me. On Mon, Apr 8, 2013 at 12:32 AM, Chris Angelico wrote: > On Mon, Apr 8, 2013 at 4:38 PM, Barrett Lewis > wrote: > > I looked up the source to the decorator > > found here: >

Re: How to do a Lispy-esque read?

2013-04-08 Thread Barrett Lewis
> For example, if the input stream contained the text: > [1, # python should ignore this comment > 2] > > and I do a "read" on it, I should obtain the result > [1, 2] > -- > I don't know much about lisp but given that input and the desired output you can write functions like the following def str

Re: help needed

2013-04-08 Thread Barrett Lewis
Do you happen to be on windows? Because if you are then you need to edit the registry. If you are on windows let me know and I will walk you through the fix, but if not then it would be a waste of time for me to explain it. -- http://mail.python.org/mailman/listinfo/python-list

Re: Process tuple contents on the fly

2013-04-15 Thread Barrett Lewis
> d = {} > for key, d[key] in (("this",18), ("that",17), ("other",38)): > print key > do_something(d) > Why not use a dict comprehension? d = {k:v for k,v in (("this",18), ("that",17), ("other",38))} I feel this is more straightforward and easier to read. the results are the same how

Re: Process tuple contents on the fly

2013-04-15 Thread Barrett Lewis
> In the particular case I did it in, I needed the incremental results > passed to a function, not just the final result. I don't think this > made it into the final code, rather it was expanded to be more > readable. But the discovery made me feel a disturbance in the > Pythonic force of the uni

Re: Can a jet fuel/hydrocarbon fire collapse a steel structure? An experiment.

2007-02-02 Thread John Barrett
<[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] >> >>Can a jet fuel/hydrocarbon fire collapse a steel structure? An >> >>experiment. >> >> > [snip] >> > Run your "experiment" again but add some pure oxygen such as was >> > escaping from the on-board breathing oxygen tanks on the >> >

Re: Can a jet fuel/hydrocarbon fire collapse a steel structure? An experiment.

2007-02-03 Thread John Barrett
<[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > On Feb 2, 10:32 pm, "John Barrett" <[EMAIL PROTECTED]> wrote: >> <[EMAIL PROTECTED]> wrote in message > >> >> > [snip] >> >> > Run your "experiment"

Re: Can a jet fuel/hydrocarbon fire collapse a steel structure? An experiment.

2007-02-03 Thread John Barrett
<[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > On Feb 2, 10:32 pm, "John Barrett" <[EMAIL PROTECTED]> wrote: >> <[EMAIL PROTECTED]> wrote in message > >> >> > [snip] >> >> > Run your "experiment"

Re: Can a jet fuel/hydrocarbon fire collapse a steel structure? An experiment.

2007-02-03 Thread John Barrett
<[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > On Feb 2, 10:32 pm, "John Barrett" <[EMAIL PROTECTED]> wrote: >> <[EMAIL PROTECTED]> wrote in message > >> >> > [snip] >> >> > Run your "experiment"

Odd behavior regarding a list

2009-03-26 Thread Edd Barrett
Hi there, My first post here, so hello :) Just a little background, I am writing my dissertation, which is a JIT compiler based upon LLVM and it's python bindings, along with the aperiot LL(1) parser. I have some code here, which is not behaving as I would expect. Could someone enlighten me as t

Re: Odd behavior regarding a list

2009-03-26 Thread Edd Barrett
Hi there, First of all, thanks to everyone for replying. This has been a great help. On Mar 26, 4:21 pm, Steven D'Aprano wrote: > On Thu, 26 Mar 2009 08:36:49 -0700, Edd Barrett wrote: > > My question is: why has 'parent_struct_sig' changed? I was under the >

collections.namedtuple: conflicting instances?

2010-09-23 Thread David A. Barrett
I've noticed that it's possible to create conflicting instances of the collections.namedtuple class: from collections import namedtuple as nt IX = nt('X', 'a b') IY = nt('Y', 'c d') x = IX(0, 1) y = IY(2, 3) The above are non-conflicting class instances and of two distinct namedtup