Effective Python: 59 Specific Ways to Write Better Python by Brett Slatkin

Effective Python: 59 Specific Ways to Write Better Python by Brett Slatkin

Author:Brett Slatkin
Language: eng
Format: epub, pdf
Publisher: Addison-Wesley Professional
Published: 2018-09-24T16:00:00+00:00


v3 = Vector3D(10, -7, 3)

print('Before: ', v3)

data = v3.serialize()

print('Serialized:', data)

print('After: ', deserialize(data))

>>>

Before: Vector3D(10, -7, 3)

Serialized: {"class": "Vector3D", "args": [10, -7, 3]}

After: Vector3D(10, -7, 3)

Using metaclasses for class registration ensures that you’ll never miss a class as long as the inheritance tree is right. This works well for serialization, as I’ve shown, and also applies to database object-relationship mappings (ORMs), plug-in systems, and system hooks.



Download



Copyright Disclaimer:
This site does not store any files on its server. We only index and link to content provided by other sites. Please contact the content providers to delete copyright contents if any and email us, we'll remove relevant links or contents immediately.