However, the question is overly reductionistic. You ask "is there any difference?" only to quickly exclude quite a few very important differences. Capabilities like inheritance (Python has an elaborate multiple inheritance system with extensive metaclass support) and the special processing of dunder methods are not trifles. They're extensive bodies of work that define much of the language's semantics, operation, and extensibility.
You might want a listing of other ways Python classes are different, such as the the ability to
- Intervene at object creation time and systematically re-orchestrate how objects are created (metaclasses),
- Use static, non-dictionary representations (slots),
- Access members through attribute notation (
- Specialize functional attributes (aka methods) as virtual properties (
@property), class rather than instance methods (
@classmethod), or class-relative normal functions (
We could list out even more ways that classes are different than mere "syntax sugar" on top of dictionaries. And the option to use a slotted, non-dictionary implementation should seal the deal. But such listings miss the number one issue:
Classes define new data types.
Classes and objects may be at some level just fancied dictionaries, but they're sufficiently evolved that they become something else entirely.
Classes define new data types. In all recent versions of the language--2.x forward, using "new style objects" that subclass
object--user-defined classes are largely equivalent too, and fully parallel with, built-in data types. You can ask
instance(x, (int, str, MyClass)), interacting with classes and instances just as you do built-in datatypes and their values. That is not possible in most traditional static languages, where you may be able to build new abstract data types, but they will never, ever be comparable to, or as flexible as, the built-in types.
Full disclosure: There are a few remaining differences, largely subtle, and mostly based on the fact that built in types are implemented "under the covers" in C, and are not Python objects. per se.
But largely, classes are different from dictionaries in ways that pervade the language design, and that put them and their instances on par with language-define types. In Python, their similarity to mapping objects is decidedly secondary.