Matteo Dell'Amico wrote:
Kay Schluehr wrote:
Why do You set
d.defaultValue(0)
d.defaultValue(function=list)
but not
d.defaultValue(0)
d.defaultValue([])
?
I think that's because you have to instantiate a different object for
each different key. Otherwise, you would
George Sakkis wrote:
This would be very
useful for list/generator comprehensions, for example being able to
write something like:
[x*y-z for (x,y,z=0) in (1,2,3), (4,5), (6,7,8)]
Looks very appealing, but what to do with
[x*y-z for (x=0,y,z) in (1,2,3), (4,5), (6,7,8)] ?
Should it raise
George Sakkis wrote:
Looks very appealing, but what to do with
[x*y-z for (x=0,y,z) in (1,2,3), (4,5), (6,7,8)] ?
Should it raise an exception due to a pattern mismatch?
I didn't have in mind to generalize the syntax even more than the
respective
for function
signatures, therefore
Tanteauguri wrote:
Hi List, is there in python a variable variable like in PHP ($$var)?
What I want to do is something like that:
pc=[a,b,c]
for i in pc:
i = anyclass()
a.shutdown()
b.update()
Any Ideas?
def seq(n,cls,*args,**kw):
create a sequence of n objects of type
Raymond Hettinger wrote:
I would like to get everyone's thoughts on two new dictionary
methods:
def count(self, value, qty=1):
try:
self[key] += qty
except KeyError:
self[key] = qty
def appendlist(self, key, *values):
George Sakkis wrote:
-1 form me.
I'm not very glad with both of them ( not a naming issue ) because
i
think that the dict type should offer only methods that apply to
each
dict whatever it contains. count() specializes to dict values that
are
addable and appendlist to those that are
*pling* !
I'm sometimes a bit slow :)
Regards Kay
--
http://mail.python.org/mailman/listinfo/python-list
Antoon Pardon wrote:
for instance I have written once somekind of vector class where
it was natural for these vectors to be added as well as te be
concatenated. Unfortunately python uses + for both so I had
no way to have both operators in a natural way in python.
Yes this is a quite common
Paul Boddie wrote:
The principal advantage of the property function was to permit the
definition of active attributes without having a huge
if...elif...else statement in the __getattr__ method. So the
motivation was seemingly to externalize the usually simple logic in
__getattr__ so that one
Torsten Bronger wrote:
Hallöchen!
Moin!
[First, I wanted to say descriptors instead of decorators (I
superseded my post).]
The goal is to trigger function calls when attributes are accessed.
This is called properties in C# (and maybe in Ruby, too). Python
now also has this concept. What
Maybe You can answer my question what this simple LISP function does ?
(defun addn (n)
#'(lambda (x)
(+ x n)))
This is correct LISP-syntax if You bear in mind LISPs powerwull macro
language...
I think Guido and python-dev are very carefull in adding new power to
Python.
There are several ways to fix it. The simplest would be to create a
new
property object in CC's definition:
class CC(C):
def set_value(self, val):
if val 0:
self.__val = 1
else:
self.__val = val
value = property(C.get_value,
Cited from Python-doc ( v.2.3 )
[Warning: In Python 2.3 these modules have been disabled due to
various known and not readily fixable security holes. The modules are
still documented here to help in reading old code that uses the rexec
and Bastion modules.]
My question about rexec and bastion
701 - 713 of 713 matches
Mail list logo