[Tutor] [Python-Help] Instancing class issue

Dino Bektešević ljetibo at gmail.com
Tue Aug 13 00:57:09 CEST 2013


Hello,


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'}
>


Yeah so much I figured, same way self could be me, but what kind of
__init__ function is that that doesn't even know how many arguments it
takes, at least it should have the mandatory arguments to satisfy the
Parent __init__ function which is object but I don't even see
object.__init__(self,
**kwargs) in sdsspy's __init__ (or **keys whatever you prefer) what are
even the keyword arguments needed for instancing object. Isn't object like
THE most abstract class that becomes anything? How do I even go about
trying to instance this? (and since it calls on some printed error
obviously written somewhere in the SDSSPY how do I reach it so I'd know
what to do?)

many thanks to responders,
Dino Bektešević

2013/8/12 Chris Down <chris at chrisdown.name>

> 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 --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/tutor/attachments/20130813/74c0b583/attachment.html>


More information about the Tutor mailing list