[Baypiggies] Companies moving to Python 3?

Mjumbe Poe mjumbewu at gmail.com
Sat Oct 17 00:39:45 CEST 2015


Hi Marilyn,

I think the important point in Aahz's reply is that all classes in Python 3
are "new-style" classes. You don't actually have to use the explicit
(object) inheritance.

In my experience, that's made teaching classes with Python 3 easier because
I don't find myself apologizing for the different types of classes. When
you start covering inheritance, you can just say "by default, a class
derives from object, but if you want to change that, blah blah blah." Hope
that helps :).

- Mjumbe

On Fri, Oct 16, 2015 at 5:40 PM Aahz <aahz at pythoncraft.com> wrote:

> On Fri, Oct 16, 2015, Marilyn Davis wrote:
> >
> > In 3, I'll have to apologize for the "(object)", which they don't yet
> > understand because they don't know yet about inheritance.
>
> What "object"?  Here's code that works perfectly well in both Python2
> and Python3, modulo the print:
>
> class SimpleBunch:
>     def __init__(self, **kwargs):
>         self.__dict__.update(kwargs)
>
> x = SimpleBunch(a='foo', x='bar')
> print(x.a)
>
> I don't see any "object" there....
> --
> Aahz (aahz at pythoncraft.com)           <*>
> http://www.pythoncraft.com/
>
> import antigravity
> _______________________________________________
> Baypiggies mailing list
> Baypiggies at python.org
> To change your subscription options or unsubscribe:
> https://mail.python.org/mailman/listinfo/baypiggies
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/baypiggies/attachments/20151016/0621760c/attachment.html>


More information about the Baypiggies mailing list