Questions tagged as 'python'

1
answer

Is it wise to implement functions that just call other functions?

I've learned which functions should be small and concise. Would this rule also apply to functions like this? def run_game(self): process_input() update_state() render() What I mean is: run_game appears to be trying to do...
asked by 14.02.2014 / 23:13
2
answers

Graph differences in matplotlib for different parameter accuracies

For a work of a discipline, I built the following code in Python using the Matplotlib and scikit-image packages: #!/usr/bin/env python # -*- coding: utf-8 -*- import numpy as np from scipy import interpolate from mpl_toolkits.mplot3d import...
asked by 13.12.2013 / 19:40
1
answer

Differences between Python versions 3.x and 2.7

I'm going to start a project in the faculty related to search engines and I want to take the opportunity to also learn Python. I do not know much about language, and my biggest question is which version, between 3.x and 2.7, has better suppor...
asked by 19.02.2016 / 03:08
4
answers

How to read a CSV file in Python?

I need to read a very large CSV file (+ 300K lines). What is the best way to read a CSV file in python ?     
asked by 09.11.2015 / 23:31
2
answers

Make decorator override of Python mock

I have a class TestCase where all the tests, except one, need to do the same patch of an object. I'm using Python Mock , and I did the following: @mock.patch('metodo_alvo', mock.Mock(return_value=1)) class Tests(TestCase): @mock.p...
asked by 08.01.2014 / 23:19
1
answer

How to remove installed packages with python

I downloaded a package with wget , unpacked and accessed the folder, I used the command: python setup.py install It ran without any errors, but now I no longer use this program, what is the correct way to uninstall the program?     
asked by 23.04.2015 / 14:31
3
answers

Problem accessing an accented file (combining character)

I'm trying to list a folder (files, subfolders) in Python [2.7, on Windows XP], and am having problems with accented files. I know that the method os.listdir behaves differently if the argument is a single string or a unicode string. My...
asked by 31.12.2013 / 01:49
3
answers

What is the expression 'if __name__ == "__main__"?

I notice that some scripts in Python , right at the end of the code, have the following expression: if __name__ == "__main__": #faça alguma coisa aqui What is the purpose of this?     
asked by 15.10.2015 / 21:10
2
answers

How to generate noise in an image using python?

How to generate periodic noise of type Moiré in a grayscale image using Python?     
asked by 22.02.2014 / 02:17
1
answer

Developing Android Applications Using Python

Is it possible to create Android applications with the Python language? If so, how does it work?     
asked by 14.02.2014 / 20:46