20 lines
709 B
Python
20 lines
709 B
Python
from caseconverter import snakecase
|
|
|
|
class GeometryObject:
|
|
"""A base class for geometry objects.
|
|
This base class provides some consistent behavior for all geometry objects.
|
|
|
|
Note: This class uses some advanced techniques which you aren't expected to
|
|
understand. If you're interested, by all means keep reading, and ask a teacher
|
|
if you have questions.
|
|
"""
|
|
|
|
def __new__(cls, value):
|
|
"""Overrides default constructor to support construction from other objects.
|
|
When value is an instance of CustomClass, checks cls for a `from_custom_class`
|
|
method which will be called to produce a new instance.
|
|
"""
|
|
method_name = value.__class__.__name__
|
|
|
|
|