Questions tagged as 'python'

2
answers

New instance overwrites old values

Take a look at this class: class Signal: point = None view = { "x": None, "y": None, } def __init__(self, point): self.point = point self.set_position() print(self.point + " ->...
asked by 08.09.2016 / 23:49
2
answers

Importing Packages PyCharm

Well, I have a problem when trying to use a project in pycharm .. I use xhtml2pdf and when trying to debug this error appears: ButIalreadyhavethepackagesaddedintheproject: Does anyone have any idea how I can fix this?     
asked by 16.10.2014 / 18:24
1
answer

What are PEP's in Python?

I was researching about Type Hints in Python and came across this page. PEP 0484 - Type Hints What would this PEP be? Is this some kind of proposal for the next versions of the languages?     
asked by 11.01.2016 / 15:54
1
answer

How to clone objects in Python?

In some languages, in addition to instantiating a class to construct a given object, we can also clone an existing instance, if we want an object with the same characteristics of the current instance, but without changing the original state. p>...
asked by 04.11.2016 / 11:33
1
answer

When it comes to the Python "list", is it wrong to call "array"?

In a response to a question I asked here on the site, I corrected a user who wrote "array" when referring to a Python "list". I did this for the sake of being a common nomenclature to be used in Python, although I know that list of Pyt...
asked by 12.12.2016 / 13:46
2
answers

How to add elements from a list and return the result as an integer?

I need to set the function soma_elementos This function receives a list with integers and returns an integer corresponding to the sum of the elements of the list received. How do I do this? def soma_elementos(lista): l = []     
asked by 28.04.2017 / 08:24
2
answers

After all, what is the function of repr in python?

I'm a beginner in python and wanted to know what this really confusing function really is, I looked at several sites but none really tells what it's for.     
asked by 01.05.2017 / 19:51
1
answer

More elegant ways to reverse integers, arrays, and strings in Python

Save! I've been looking for elegant ways to reverse strings, arrays, and integers in Python. What do you think of my codes below and what do they suggest to improve them? They work ... Thank you! frase = 'eu gosto de python'[::-1] num...
asked by 28.10.2015 / 00:33
2
answers

What is the __init__.py file used for in modules in python?

I'm starting to work deeper with Python and have noticed many projects with __int__.py files in folders, and are often blank. What is the purpose of these files?     
asked by 05.11.2015 / 23:25
2
answers

When to use list comprehension and not filter + lambda?

Good evening, everyone. Studying here, I found the List Comprehension and filter + lambda functions to be fantastic, but they both seemed pretty similar to me on some points ... When should I use List Comprehension instead of filter +...
asked by 16.10.2015 / 02:22