[Tutor] [Python-Help] Instancing class issue

Chris Down chris at chrisdown.name
Mon Aug 12 23:19:09 CEST 2013


Hi Dino,

On 2013-08-12 20:32, Dino Bektešević wrote:
>     def __init__(self, **keys):
>         from . import util
>
>         self.keys=keys
>         self.load()
>
> where I don't understand what **keys mean, I've only seen that as **kwargs
> meaning other key words and arguments in examples.

The name of the variable doesn't matter, that's still what it does; you can
think of it as encapsulating any other keyword arguments.

    >>> def foo(bar, **kwargs):
    ...     print("bar: %s" % (bar,))
    ...     print("kwargs: %r" % (kwargs,))
    ...
    >>> foo("bar", baz="qux", wibble="wobble")
    bar: bar
    kwargs: {'baz': 'qux', 'wibble': 'wobble'}


> When I try to instance
> Astrom class by:
> new=Astrom()
> I receive a following error:

Sorry, no idea about this bit, I've never used sdsspy. est of luck sorting this
out.

Chris
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 490 bytes
Desc: not available
URL: <http://mail.python.org/pipermail/tutor/attachments/20130812/dc911a4e/attachment.pgp>


More information about the Tutor mailing list