how do you get the name of a dictionary?

Fredrik Lundh fredrik at pythonware.com
Wed Aug 23 02:56:54 EDT 2006


Steven D'Aprano wrote:

> But an upside is that it would enable more useful error messages, at least
> sometimes. Here's some trivial pseudo-code:
> 
> def foo(a):
>     assert len(a) > 10, "%s is too short" % a.__name__
> 
> y = "hello"
> foo(y)
> 
> would display "AssertionError: y is too short".

why not "a is too short" ?

or for that matter, "x is to short" ?

</F>




More information about the Python-list mailing list