Am 16.03.2010 21:44, schrieb Mark Lawrence:
Who actually *IS* running the time machine? Are there any bugs??
My is. And as I'm a lazy hacker: sure. there are bugs. lets just call
them features and move on. nothing to see here ;)
--
http://mail.python.org/mailman/listinfo/python-list
Am 14.03.2010 21:08, schrieb pyt...@bdurham.com:
Any reason you prefer PDB over WinPDB?
http://winpdb.org/
Yes. I don't have Windows except one one PC :P
WinPDB runs on non-Windows platforms :)
Uh, OK.
Then the name mislead me ;)
But yeah, I prefer a console based debugger.
--
http://mail.pyt
Am 14.03.2010 16:03, schrieb pyt...@bdurham.com:
Any reason you prefer PDB over WinPDB?
http://winpdb.org/
Yes. I don't have Windows except one one PC :P
--
http://mail.python.org/mailman/listinfo/python-list
Am 14.03.2010 12:53, schrieb Mark Lawrence:
vsoler wrote:
I sometimes want to stop the script at a certain point,
with something like stop, break, end or something similar.
What statement can I use?
Something like
import sys
sys.exit()?
Or just "raise SystemExit", "raise SyntaxError" or any o
Am 10.03.2010 16:55, schrieb Bill:
def fizzbuzz(num):
if num:
if num % 15 is 0: return fizzbuzz(num-1) + 'fizzbuzz \n'
elif num % 5 is 0: return fizzbuzz(num-1) + 'buzz \n'
elif num % 3 is 0: return fizzbuzz(num-1) + 'fizz \n'
else : return fizzbuzz(num-1)
Am 12.03.2010 21:56, schrieb Martin v. Loewis:
(*) If a source encoding was given, the source is actually recoded to
UTF-8, parsed, and then re-encoded back into the original encoding.
Why is that? So "unicode"-strings (as in u"string") are not really
unicode-, but utf8-strings?
Need citatio
Am 09.03.2010 13:02, schrieb Peter Otten:
[sum(a for a,b in zip(x,y) if b==c)/y.count(c)for c in y]
[1.5, 1.5, 8.0, 4.0, 4.0, 4.0]
Peter
... pwned.
Should be the fastest and shortest way to do it.
I tried to do something like this, but my brain hurt while trying to
visualize list comprehensi
OK, I golfed it :D
Go ahead and kill me ;)
x = [1 ,2, 8, 5, 0, 7]
y = ['a', 'a', 'b', 'c', 'c', 'c' ]
def f(a,b,v={}):
try: v[a].append(b)
except: v[a]=[b]
def g(a): return sum(v[a])/len(v[a])
return g
w = [g(i) for g,i in [(f(i,v),i) for i,v in zip(y,x)]]
print("w is now the li
Am 08.03.2010 23:34, schrieb dimitri pater - serpia:
Hi,
I have two related lists:
x = [1 ,2, 8, 5, 0, 7]
y = ['a', 'a', 'b', 'c', 'c', 'c' ]
what I need is a list representing the mean value of 'a', 'b' and 'c'
while maintaining the number of items (len):
w = [1.5, 1.5, 8, 4, 4, 4]
This kind
Am 04.03.2010 18:20, schrieb Robert Kern:
What I'm trying to explain is that the with: statement has a use even if
Cleanup doesn't. Arguing that Cleanup doesn't improve on try: finally:
does not mean that the with: statement doesn't improve on try: finally:.
Yes, the with-statement rocks :)
I
Am 04.03.2010 17:32, schrieb Jean-Michel Pichavant:
It looks like to me that 'with' statements are like decorators: overrated.
Oh no, you just insulted my favourite two python features, followed
immediately by generators, iterators and list comprehensions / generator
expressions :p
No, real
Am 04.03.2010 11:38, schrieb Karen Wang:
Hi all,
I want to use python to access to https server, like
"https://212.218.229.10/chinatest/";
If open it from IE, will see the pop-up login windows like this
I tried several ways but always only get page for" HTTP Error 401.2 -
Unauthorized" error
Am 03.03.2010 18:38, schrieb Tracubik:
Il Wed, 03 Mar 2010 09:39:54 +0100, Peter Otten ha scritto:
def loop():
count = 0
m = 0
lookup = {1: 1, 2: 10, 3: 100}
for iterations in range(20): # off by one
# ...
print "%2d %1d %3d" % (iterations, count, m) # ...
Am 03.03.2010 04:51, schrieb Lie Ryan:
import itertools
def gen():
valid_chars = 'abcdefghijklmnopqrstuvwxyz'
for char in itertools.repeat(valid_chars):
yield char
gen = gen()
def gen_rand_string(length):
chars = (next(gen) for i in range(length))
return ''.join(char
Am 03.03.2010 12:47, schrieb Oren Elrad:
""" code involving somefile """
try:
os.remove(somefile)
except:
...pass # The bloody search indexer has got the file and I
can't delete it. Nothing to be done.
You don't know that what you stated in your comment is true.
All you know is
Am 28.02.2010 15:08, schrieb Alf P. Steinbach:
>>> "Hello".upper
>>> f = "Hello".upper
>>> f
>>> f()
'HELLO'
>>>
>>>
>>>
>>> f.__self__
'Hello'
Holy hand grenade.
You have no Idea how enlightened I feel right now :D
Thank you, "bound method" was the term I forgot and your examp
Out of curiosity I tried this and it actually worked as expected:
>>> class T(object):
x=[]
foo=x.append
def f(self):
return self.x
>>> t=T()
>>> t.f()
[]
>>> T.foo(1)
>>> t.f()
[1]
>>>
At first I thought "hehe, always fun to play around with pyt
Am 27.02.2010 10:00, schrieb alex23:
Michael Rudolf wrote:
In Java, Method Overloading is my best friend
Guido wrote a nice article[1] on "multimethods" using decorators,
which Ian Bicking followed up on[2] with a non-global approach.
1: http://www.artima.com/weblogs/viewpost.
Am 26.02.2010 12:47, schrieb Michael Rudolf:
I'd just hate to see something like "if False" in production level code.
And yeah, I've seen it. And worse.
--
http://mail.python.org/mailman/listinfo/python-list
Am 25.02.2010 17:39, schrieb Grant Edwards:
IMO, any sort of "commented out" code left in a program is a
big mistake. If the code is soething that does need to stay
for optional use, then it needs to be properly integrated along
with logic to control when it's used.
OK, then we are perfectly f
Am 25.02.2010 16:39, schrieb Tracubik:
hi all, i've this sample code:
n = 4.499
str(round(n,2))
'4.5'
that's right, but what i want is '4.50' to be displayed instead of '4.5'.
Off course i know that 4.5 = 4.50, still i'ld like to have 4.50.
How can I solve this?
Thanks in advance
Nico
Thi
Am 25.02.2010 16:07, schrieb Grant Edwards:
On 2010-02-25, Paul Rudin wrote:
No idea, but it would be nice to have some multiline comment syntax
(other than # at the beginning of each line). Particularly one that can
be nested.
if 0:
Seriously, that's what I generally do: mark the block of c
Am 25.02.2010 11:58, schrieb Jean-Michel Pichavant:
You said it yourself: "simply make two or three functions and name
them appropiately" :-)
When 2 methods of a class were to have the same name for doing
completely different things like you said, there's a design flaw to my
opinion.
JM
I wond
Am 24.02.2010 23:58, schrieb Aahz:
(abbreviated "gen iter" or "geniter").
lol I don't know why, but this sounds like a sex toy to me ;)
Regards,
Michael
--
http://mail.python.org/mailman/listinfo/python-list
Am 24.02.2010 21:06, schrieb mk:
I just posted a comparison with calculating std deviations for various
methods - using os.urandom, SystemRandom.choice with seeding and without
seeding.
I saw them
They all seem to have slightly different distributions.
No they don't. Just run those tests a
Am 24.02.2010 19:35, schrieb mk:
On 2010-02-24 18:56, Michael Rudolf wrote:
The reason is 256 % 26 != 0
256 mod 26 equals 22, thus your code is hitting a-v about 10% (256/26 is
approx. 10) more often than w-z.
writing secure code is hard...
So true. That's why one should stick to sta
Am 24.02.2010 18:23, schrieb mk:
Even then I'm not getting completely uniform distribution for some reason:
d 39411
l 39376
f 39288
a 39275
s 39225
r 39172
p 39159
t 39073
k 39071
u 39064
e 39005
o 39005
n 38995
j 38993
h 38975
q 38958
c 38938
b 38906
g 38894
i 38847
m 38819
v 38712
z 35321
y 352
First: Thanks for all the replies so far, they really helped me.
Am 24.02.2010 11:28, schrieb Jean-Michel Pichavant:
>>> def a(x=None):
if x is None:
pass
else:
pass
This is the way to do it python, and it has its advantages: 1 docstring,
1 way do do it, 1 interface.
Just a quick question about what would be the most pythonic approach in
this.
In Java, Method Overloading is my best friend, but this won't work in
Python:
>>> def a():
pass
>>> def a(x):
pass
>>> a()
Traceback (most recent call last):
File "", line 1, in
a()
TypeError:
How can i declare a global array in python?
--
http://mail.python.org/mailman/listinfo/python-list
Can someone tell me how to allocate single and multidimensional arrays
in python. I looked online and it says to do the following x =
['1','2','3','4']
However, I want a much larger array like a 100 elements, so I cant
possibly do that. I want to allocate an array and then populate it
using a for
Am Thu, 5 Mar 2009 05:38:58 -0800 (PST)
schrieb John Machin :
> Main page (http://pypi.python.org/pypi), right at the top:
> """
> The Python Package Index is a repository of software for the Python
> programming language. There are currently 5883 packages here.
> """
Ooops... totally missed that
Hi, I just wondered how many Packages are in the Python Package Index.
I could not find any counter, but I found that there is a category
overview on http://pypi.python.org/pypi?%3Aaction=browse .
A quick look at the HTML told me that the number of Packages per
Category is listed surrounded by pa
33 matches
Mail list logo