Re: Is this PEP-able? fwhile

2013-06-24 Thread wu wei
On Tue, Jun 25, 2013 at 10:19 AM, Fábio Santos fabiosantos...@gmail.com
 wrote:

 for X in (i for i in open('largefile') if is_part_of_header(i)):

 The above code would be wasting time on IO and processing. It would load
 another line and calculate the condition for every line of the large file
 and I just wanted to loop over the few header lines.

 itertools.takewhile and fwhile/for..while actually stops the loop when the
 condition is not meant, while your example keeps checking the condition
 until the end of file, even though it is a generator expression.

Ah yes, of course, my bad.

It's still possible by raising a StopIteration within the condition
function:

def is_part_of_header(x):
if header_condition:
return True
else:
raise StopIteration

But yes, by this point any clarity of the generator expression approach
comes with the cost of more explicit setup of the breaking condition.
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Re: Objects in Python

2012-08-24 Thread wu wei
On Fri, Aug 24, 2012 at 7:14 PM, Evan Driscoll drisc...@cs.wisc.edu wrote:

 On 8/23/2012 22:17, alex23 wrote:
  But Roy's point was that referring to 'a' as a 'variable' makes no
  sense, as it's not an allocated piece of memory.

 Does the computer just remember what 'a' refers to by keeping notes
 about it in Narnia?


You're correct. It will be, on some level, a piece of memory. But I don't
recall seeing any guarantee that the memory used to hold the dictionary key
of 'a' in one scope would be re-used if 'a' was first deleted and then
re-created. It's an implementation detail about the language that we don't
care about.
-- 
http://mail.python.org/mailman/listinfo/python-list


Fwd: Checking a string against multiple matches

2008-12-03 Thread wu wei
Sorry to hassle the list with this but I'm getting irregular spam from this
asshole, clearly triggered by comp.lang.python posts being resent to the
python-list. I've contacted Yahoo abuse -and- the list administrators but
its still occurring.

Is anyone able to remove this guy from the list? I've asked him to stop but
he rather abusively replied saying that he wasn't doing anything wrong.

-- Forwarded message --
From: Stephen Meredith [EMAIL PROTECTED]
Date: Tue, Dec 2, 2008 at 11:08 AM
Subject: Re: Checking a string against multiple matches
To: alex23 [EMAIL PROTECTED]


THE 10 DOLLAR PAYPAL MONEY MAKING METHOD
As On 20/20 - TURN 10$ into a good chunk of change in a short time
Earn money using PAYPAL as seen on Oprah  20/20
THE PAYPAL 6 DOLLAR MONEY-MAKING METHOD
AS SEEN ON OPRAH EARN HUGE 
all you need is:
1) An email address
2) A PayPal account
3) $10.00
I have participated in sending $1 dollar to six people, and have not
made as much money as with $5 dollars to 2 people. For and extra 4
dollars you will bring in much more money then the dollar method.
THIS IS A October 2008 , CURRENT EMAIL LIST, What do you have to lose
being you are only sending 5 dollars to 2 people. I WAS SKEPTICAL AT
FIRST, but over about a week hundreds starting appearing in my paypal
account! It was like Christmas morning
INSTRUCTIONS:
STEP 1:
The first thing to do is highlight and SAVE this entire post in word
or notepad on your computer so you can come back to it later. After
that, if you are not already a PayPal user you need to go to
the PayPal website at
https://www.paypal.com/au/mrb/pal=CW4RHQ... and
SIGN UP. If you want to be able to receive credit card payments from
other people then you will need to sign up for a PREMIER or BUSINESS
account (not just a PERSONAL
account). This is highly recommended to allow others easy payment
options. In order to place the initial 10$ into your account, you
will have to verify your bank account with PAYPAL (which may take a
few days). PAYPAL is 100% secure and is used by millions of people
worldwide.
STEP 2:
Here is where the action occurs. The first thing to do is to send a
$5.00 payment to each of the 2 email addresses on the current list
from your PayPal account. To do this quickly and successfully,
follow
these simple steps:
1. Login to PayPal and click on the Send Money tab near the top of
the screen
2. In the Recipient's Email field enter the email address
3. In the Amount field enter 5 (This is your $5.00 payment)
4. In the Category field select Service (Keeping it legal)
5. In the Subject field type Tutoring Help, and in the NOTE
field
Enter Thanks for the help or even better Enter Thank you for
answering my (pick a subject ex. Business, financial etc) question.
By doing this, you are
creating a service and maintaining the legality of the system by
paying for the service. In theory you are tutoring others how to
make money online through paypal. It is very important that you follow
those directions since that is what keeps it legal. You probably have
seen this exact method before with others telling you to write please
put me on your email list in the note section. I originally used the
please put me on your email list and it worked great until paypal
said that is considered a pyramid scheme. They were really nice about
it, telling me that I couldn't do this anymore (They let me keep the
954.34 that I had made over the 3 weeks, I just had to stop). So I now
have been using this NEW method for about 3 months and there have been
no problems. This is providing a helping service to others, which
paypal has verified as legal. I promise you that this works and is
legal, I even called customer service explaining what I was doing
would not get me in trouble. They gave me the thumbs up, saying this
method meet their user policy! Whats the worst that happens, you lose
10$ dollars? Unlike most people, I have tried this program and have
figured out what works! The great thing about this email list is that
I have contacted all of them by email. They all are active in this
paypal method, guaranteeing that they will be posting their list with
your email address to hundreds of posts. You have to be careful, since
many email lists are filled with inactive or wrong emails! If you need
help getting started or have any questions feel free to email me at
[EMAIL PROTECTED], working together is what will allow us to
make this potential large sum of money.
Remember, all of this is ABSOLUTELY LEGAL! If you have any doubts,
please refer to le 18 Sec.1302  1241 of the United States Postal
laws.
Now, click on the Continue button to complete the payment.
Repeat these steps for each of the 2 email addresses. That's it! By
sending the $5.00 payment to each address, you are implementing the
compounding POWER of the system. You will reap what you sow!
Here is the current e-mail list:
*
The email list:
1) [EMAIL PROTECTED]
2) [EMAIL