A.I, Data and Software Engineering

Tagobject

Advanced Python: Object operations and comparisons

In many cases, it is convenient to perform mathematical operations on objects rather than numerical values. Python classes have the ability to emulate the behaviour of numeric values to support operations like addition and subtraction. You can override many more to support number-like functionality. Numeric functions In the following table, the right column contains expressions...

Advanced Python: classes String and computed attribute

This article demonstrates more advanced features of Python classes and their customisation. Specifically, how enum objects are created, class to strings, and computed attribute. Class string values A string is typically an informal representation of the object. However, it’s just a nicely in human-readable form. Python provides 2 common methods, i.e. str() and repr(). We can...

Determine the sizes of python objects

petamind

When working with data structures, you may want to analyse the space complexity of a particular object. For example, you want to compare the size of a sparse matrix and a dense matrix which represent the same data. With python, “Just use sys.getsizeof” is not a complete answer. It does work for builtin objects directly, but it does not account for what those objects may...

A.I, Data and Software Engineering

PetaMinds focuses on developing the coolest topics in data science, A.I, and programming, and make them so digestible for everyone to learn and create amazing applications in a short time.

Categories