Read you doc file and set the __doc__ attr of the object you want to change.
On Monday, June 28, 2010, Brian Blais bbl...@bryant.edu wrote:
Hello,
I know that the help text for an object will give a description of every
method based on the doc string. Is there a way to add something to this
I don't know it is a feature, or implement detail:
class C(object): pass
...
c = C()
setattr(c, ' ', 3)
getattr(c, ' ')
3
setattr(c, 'with blank', 4)
getattr(c, 'with blank')
4
getattr / setattr seems treat any string as attribute name.
--
On Thu, Jul 30, 2009 at 4:17 PM, Javier Collado javier.coll...@gmail.comwrote:
Hello,
In the string.Template documentation
(http://docs.python.org/library/string.html) it's explained that if a
custom regular expression for pattern substitution is needed, it's
possible to override idpattern
On Sun, Aug 2, 2009 at 9:06 AM, Steven D'Aprano
st...@remove-this-cybersource.com.au wrote:
I was playing around with a custom mapping type, and I wanted to use it
as a namespace, so I tried to use it as my module __dict__:
import __main__
__main__.__dict__ = MyNamespace()
Traceback
maybe a shell script to switch PYTHONPATH, like:
start-python-2.5
start-python-2.4 ...
On Fri, Jun 5, 2009 at 4:56 PM, David Cournapeau courn...@gmail.com wrote:
Hi,
As I don't have admin privileges on my main dev machine, I install a
good deal of python modules somewhere in my $HOME, using
a
*safer* version 'get()' method.
On Fri, May 22, 2009 at 12:35 PM, Rhodri James
rho...@wildebst.demon.co.ukwrote:
Please don't top-post, it makes the thread of argument hard to follow.
On Fri, 22 May 2009 01:44:37 +0100, Red Forks redfo...@gmail.com wrote:
You mean 'get' method should
if you don't.
I misunderstand you last email, thanks.
On Fri, 22 May 2009 09:53:04 +0100, Red Forks redfo...@gmail.com wrote:
Yes, you maybe right. When use defaultdict, should not rely get() method
anymore, d[] is just enough.
Almost. You should rely on get() to do what it says, not what
from collections import defaultdict
d = defaultdict(set)
assert isinstance(d['a'], set)
assert isinstance(d.get('b'), set)
d['a'] is ok, and a new set object is insert to d, but d.get('b') won't.
It's a bug, or just a feature?
I think dict.get() method is just a *safe* version of dict[key],
James
rho...@wildebst.demon.co.ukwrote:
On Thu, 21 May 2009 13:07:50 +0100, Red Forks redfo...@gmail.com wrote:
from collections import defaultdict
d = defaultdict(set)
assert isinstance(d['a'], set)
assert isinstance(d.get('b'), set)
d['a'] is ok, and a new set object is insert to d