Python
Python
An object is something which has one or more attributes and methods. In this
case, the attributes are like the properties; for example, if we think about a
human as an object the height, name, hair color, age and others, those human
properties are object attributes. In the other hand, the methods are the type of
things that the human can do, and those actions can change his own
attributes, for example, a person can change his name, hair color, age, and
others. However, the person can run, read, and others, and those actions are
methods too.
Person.ChangeName
Person.GainWeight
Person.LoseHeight
Those´re methods ´examples
However, if we want to create an object with need first a create a class. A class
´s like a mold which allows create objects.
In this case the function only give a result which, it´s not in a variable
With this command we well see if an instance belong to a specific class or
subclass
In designscript to split
The command enumerates allow create a loop and get the list index and the
element
To get access to the last elements in list, this´s useful when we don’t know the
amount of elements
El comando Continue sirve para saltarnos el código del bucle en una de las
iteraciones e ir a la siguiente
Argparse
It allows us create interactive interfaces, but the difference between that
functions and the input ones, it´s about the possibility of create validations of
the information, covert the data in the correct type, generate help messages,
and others…
When we´re talking about create validation we refer to these actions
In the previous example we can see that the input have to be an Float type, so
if we put an incorrect type the program create an error
We can also limit the options
To add inputs to the parser, and we can see all the actions we can take
This is a more practical example, in that case the arguments are as the
attributes of the parser (Object), but that´s like a template, and with the
function parse_args we create the object with specific attributes.
The strip command´s used to delete the space in an input, that´s to avoid
some possible mistake in the moment to put some information in the input
The function “lower” convert all the words in lowercase, and endswith to verify
the lasts words
When we´re working in legacy projects of IA, it´s common get problems related
with compatibility of some libraries, the error looks like:
Ezdxf library
This a library to manipulate DXF files, so we can edit them, create new files,
etc…