Re: Encapsulation unpythonic?

2013-09-01 Thread Fabrice Pombet
> That said, though, when you consider the language ecosystem rather > > than just the language, there is a strong tendency for Java and C++ > > code to wrap everything up with functions (no public data members), > > whereas Python code is far more likely to have external code directly > > acc

Re: Encapsulation unpythonic?

2013-08-31 Thread Fabrice Pombet
On Saturday, August 31, 2013 1:46:52 PM UTC+2, Steven D'Aprano wrote: > On Fri, 30 Aug 2013 23:07:47 -0700, Fabrice Pombet wrote: > > > > > well, look at that: > > > > > > a=(1,2) > > > a=2+3 ->a is an object and I have changed its type

Re: Encapsulation unpythonic?

2013-08-31 Thread Fabrice Pombet
> > http://nedbatchelder.com/text/names.html > > > > --Ned. This is an excellent explanation, thank you. It is mostly of theoretical interest though, and in practice, I still contend that the consequences towards the syntax are (or seem, if you prefer) analogous to those of the lack of enc

Re: Encapsulation unpythonic?

2013-08-31 Thread Fabrice Pombet
On Saturday, August 31, 2013 9:42:55 AM UTC+2, Fabrice Pombet wrote: > On Saturday, August 31, 2013 9:03:58 AM UTC+2, Gary Herron wrote: > > > On 08/30/2013 11:07 PM, Fabrice Pombet > > > wrote: > > > > > > > > > ... long discu

Re: Encapsulation unpythonic?

2013-08-31 Thread Fabrice Pombet
On Saturday, August 31, 2013 9:03:58 AM UTC+2, Gary Herron wrote: > On 08/30/2013 11:07 PM, Fabrice Pombet > wrote: > > > ... long discussion elided ... > > well, look at that: > > a=(1,2) > a=2+3 ->a is an object and I have changed it

Re: Encapsulation unpythonic?

2013-08-30 Thread Fabrice Pombet
On Saturday, August 31, 2013 4:35:39 AM UTC+2, Steven D'Aprano wrote: > On Fri, 30 Aug 2013 10:43:28 -0700, Fabrice Pombet wrote: > > > > > On Saturday, August 17, 2013 2:26:32 PM UTC+2, Fernando Saldanha wrote: > > > > >> 2) If it is in fact true th

Re: Encapsulation unpythonic?

2013-08-30 Thread Fabrice Pombet
On Saturday, August 17, 2013 2:26:32 PM UTC+2, Fernando Saldanha wrote: > I am new to Python, with experience in Java, C++ and R. > > > > As I understand encapsulation is not a big thing in the Python world. I read > that you can put two underscores before the name of a variable within a class

Re: Is there a function that applies list of functions to a value?

2013-08-30 Thread Fabrice Pombet
On Friday, August 30, 2013 8:36:40 AM UTC+2, alex23 wrote: > On 30/08/2013 4:17 PM, fp2...@gmail.com wrote: > > > On Wednesday, August 28, 2013 8:50:53 PM UTC+2, Josh English wrote: > > >> def compose(*funcs): > > >> for func in funcs: > > >> if not callable(func): > > >>

Re: Is there a function that applies list of functions to a value?

2013-08-30 Thread Fabrice Pombet
On Friday, August 30, 2013 8:23:44 AM UTC+2, alex23 wrote: > On 30/08/2013 4:14 PM, fp2...@gmail.com wrote: > > > For this purpose however, I suspect that a named function with a proper > > docstring that can be imported and reused over and over again is probably > > more appropriate than a lamb

Re: Interface and duck typing woes

2013-08-29 Thread Fabrice POMBET
Le 29 août 2013 à 00:56, python-list-requ...@python.org a écrit : """While designing a simple library, I found myself asking a philosophical question: to check or not to check the parameter's interface? I think that, considering it is Python, the usual answer would be "no", but here is the situa

Rép : Why is str(None) == 'None' and not an empty string?

2013-08-28 Thread Fabrice POMBET
On 8/28/2013 4:57 AM, Piotr Dobrogost wrote: > Having repr(None) == 'None' is sure the right thing but why does str(None) == > 'None'? Wouldn't it be more correct if it was an empty string? the point of str(obj) is to return a string containing the obj (a sequence of characters if it is unboun