Check for the type of arguments

2013-08-17 Thread Fernando Saldanha
I am new to Python, with some experience in Java, C++ and R. Writing in other languages I usually check the type and values of function arguments. In the Python code examples I have seen this is rarely done. Questions: 1) Is this because it would be unpythonic or just because the examples are

Re: Check for the type of arguments

2013-08-17 Thread Fernando Saldanha
Thanks for the insightful answers. PTVS is Python Tools for Visual Studio. -- http://mail.python.org/mailman/listinfo/python-list

Python getters and setters

2013-08-17 Thread Fernando Saldanha
I am new to Python. I understand that it is unpythonic to write getters and setters, and that property() can be used if necessary. This deals with the case of attributes, but there are other kinds of information available within a class. Suppose my class contains an attribute called data that

Re: Python getters and setters

2013-08-17 Thread Fernando Saldanha
The debate got more interesting than I expected. Without taking sides, I would like to add that perhaps my length example was misleading: length is easy to calculate. The information could be hard to extract from the data, either because complex calculations are involved, or because it is not