¡GoConqr estrena diseño! Cuéntanos qué te parece.

Apuntes

Python

Jagadeep Sai Inglés 1 página

Contenido del apunte (1)

Página 1

Default int type is long

input taken is always interpretated as string . There are no characters, they are seen as string of length of 1 .

Two other ways of iteration through the loop : iterator and generator

Genrator doesm't compute and store values over the loop but generates one result once when being called :) . Efficient and uses less memory as it doesn't compute all at once but one at a time .and takes way too less time .

lists , dictionary are mutable , tuples are immutable .

functions pass arguments by reference by default

Can add a string just after the definition of function . it will give the specification of the function and it treated as a comment .

But if you reassign any value to the argument variable inside the function it will now have a new reference and any changes to it isn't reflected in the main variable .

Types of arguments for a function :- Required arguments(the common one ) , keyword arguments (order doesn't matter in passing to the function ), default arguments , variable length arguments .

It assumes that any variable assigned a value in a function is local.

Therefore, in order to assign a value to a global variable within a function, you must first use the global statement.

The statement global VarName tells Python that VarName is a global variable. Python stops searching the local namespace for the variable

The dir() built-in function returns a sorted list of strings containing the names defined by a module.

The globals() and locals() functions can be used to return the names in the global and local namespaces depending on the location from where they are called.

For exception handling : https://www.tutorialspoint.com/python/python_exceptions.htm

Initialiser of a class - def __init__(self, arg1 , arg2 .... ):

There are attributes of every class . These attribute variable are defined for every class :)

some of these attributes are name of the class , class documentation string , module in which the class is defined .etc

Información

Descripción
Apunte sobre Python, creado por Jagadeep Sai el 06/09/2017.
Creado por
Jagadeep Sai
Visitas
0
Valoración

Escríbenos

¿Sobre qué es tu mensaje?

¿Qué te parece el nuevo diseño?

¿Te gusta?