Sent from Windows Mail
--
https://mail.python.org/mailman/listinfo/python-list
hi,
I'm not sure how I can use exec within a function correctly
here is the code i'm using:
def a():
exec('b=1')
print(b)
a()
this will raise an error, but I would like to see it outputting 1
thanks
smk
--
http://mail.python.org/mailman/listinfo/python-list
On May 20, 10:38 am, Thomas Bellman <[EMAIL PROTECTED]> wrote:
> Arnaud Delobelle <[EMAIL PROTECTED]> wrote:
> > from collections import defaultdict
> > d = defaultdict(int) # That means the default value will be 0
> > for person in people:
> > d[person.fav_food] += 1
>
> Ah! I didn't think of
On May 20, 12:26 pm, Zack <[EMAIL PROTECTED]> wrote:
> Given a bunch of objects that all have a certain property, I'd like to
> accumulate the totals of how many of the objects property is a certain
> value. Here's a more intelligible example:
>
> Users all have on
Given a bunch of objects that all have a certain property, I'd like to
accumulate the totals of how many of the objects property is a certain
value. Here's a more intelligible example:
Users all have one favorite food. Let's create a dictionary of
favorite foods as the keys and how many people hav
Dustan wrote:
> On Feb 16, 5:59 pm, Zack <[EMAIL PROTECTED]> wrote:
>> Zack wrote:
>>> Diez B. Roggisch wrote:
>>>> Zack schrieb:
>>>>> If I have a class static variable it doesn't show up in the __dict__
>>>>> of an instance o
Dustan wrote:
> On Feb 16, 4:40 pm, Zack <[EMAIL PROTECTED]> wrote:
>> what method can you use on x to find all available
>> attributes for that class?
>
>>>> class Foo(object):
> bar = "hello, world!"
> def __init__(self, baz
Zack wrote:
> Diez B. Roggisch wrote:
>> Zack schrieb:
>>> If I have a class static variable it doesn't show up in the __dict__
>>> of an instance of that class.
>>>
>>> class C:
>>>n = 4
>>>
>>> x = C()
>>>
Diez B. Roggisch wrote:
> Zack schrieb:
>> If I have a class static variable it doesn't show up in the __dict__
>> of an instance of that class.
>>
>> class C:
>>n = 4
>>
>> x = C()
>> print C.__dict__
>> {'__module__': &
s n is not encapsulated in x's
namespace but what method can you use on x to find all available
attributes for that class?
--
Zack
--
http://mail.python.org/mailman/listinfo/python-list
'''
counter = 0
while seq:
below = []
for item in seq:
if hasattr(item, '__iter__'):
below.extend(item)
else:
print item,
counter += 1
#intentional blank line to distinguish long lines that wrap
print '\n'
seq = below
return counter
L = grow([],10)
C = traverse(L)
--
Zack
--
http://mail.python.org/mailman/listinfo/python-list
on iterables in L.'''
if L == []:
return count
n = []
for e in L:
if not hasattr(e,'__iter__'):
print e,
count += 1
else:
n[:] += e
print '\n'
return traverse(n,count)
L = grow([],10)
C = traverse(
See scapy.py
I've completed windows support at this time and am currently testing it,
working out some bugs.
If you want a copy just ask. I need some testers.
It can do almost any packet transmissions you want. (google it)
Z
--
http://mail.python.org/mailman/listinfo/python-list
ething I'd prefer to avoid if there is a better solution available. Any ideas?
Thanks so much,
Zack Payton
--
http://mail.python.org/mailman/listinfo/python-list
14 matches
Mail list logo