Agreed, I dislike map and its ilk as well.
However, they are handy in some cases. I particularly like the way Ruby
deals with this problem. Instead of all these functions, internal
iterators and true anonymous blocks are used.
Case in point:
def gt_than_5(obj):
return obj > 5
results = filter(
My personal favorite would be ruby's iterators and blocks.
Instead of writing a bunch of repetitive list comprehensions or
defining a bunch of utility functions, you just use the iterators
supported by container objects.
For instance,
[f(x) for x in y]
could be written in Ruby as
y.collect |x| d
Have you tried the tarfile or zipfile modules? You might need to ugrade
your python if you don't have them. They look pretty easy and should
make this a snap.
You can grab the output from the *nix "file" command using the new
subprocess module.
Good Luck
- Chris
===
PYTHON POWERs all!
All your
You probably want:
import pickle
pickle.dump(myAccount, file("account.pickle", "w"))
To reload your account:
import pickle
myAccount = pickle.load(file("account.pickle"))
--
http://mail.python.org/mailman/listinfo/python-list
Antoon Pardon wrote:
> Well at least I find them missing.
>
> For the moment I frequently come across the following cases.
>
> 1) Two files, each with key-value pairs for the same dictionary.
> However it is an error if the second file contains a key that
> was not in the first file.
>
> In treati
Please do STFU! You are most annoying and this is the wrong place to
post this.
If anyone else if reading this, yes, I do realize it's probably a bot.
But I need to vent some rage. Now if only his nick didn't have a "..."
in it... I would so report it to yahoo and/or counterspam it.
--
http://mai
You want the function raw_input().
Have you read the tutorial? I should have been covered there.
--
http://mail.python.org/mailman/listinfo/python-list
Since everyone's improving the program, I thought I'd just tweak Dennis
Lee Bieber's code a little. Here's the result. Good luck Ignorati!
import time
class Transaction(object):
def __init__(self, payee, amount, date=None):
# amount is the amt withdrawn/deposited
self.payee =