Re: What's the best way to minimize the need of run time checks?

2016-08-28 Thread Steven D'Aprano
On Sunday 28 August 2016 15:56, Juan Pablo Romero Méndez wrote: > 2016-08-27 21:30 GMT-07:00 Steve D'Aprano : [...] >> Now it is true that speaking in full generality, classes and types refer to >> different things. Or to be perhaps more accurate, *subclassing* and >> *subtyping* are different thi

Re: What's the best way to minimize the need of run time checks?

2016-08-28 Thread Jussi Piitulainen
Chris Angelico writes: > On Sun, Aug 28, 2016 at 4:13 PM, Jussi Piitulainen wrote: >>> This is where I'm less sure. Sometimes a variable's type should be >>> broader than just one concrete type - for instance, a variable might >>> hold 1 over here, and 1.5 over there, and thus is storing either >>

Re: What's the best way to minimize the need of run time checks?

2016-08-28 Thread Steven D'Aprano
On Sunday 28 August 2016 15:29, Chris Angelico wrote: > On Sun, Aug 28, 2016 at 2:30 PM, Steve D'Aprano > wrote: >> But the author of this piece ignores that standard distinction and invents >> his own non-standard one: to him, classes are merely different >> representations of the same data. E.g

Multimeter USB output

2016-08-28 Thread Joe
Am 28.08.2016 um 00:45 schrieb Terry Reedy: > On 8/27/2016 3:35 PM, Joe wrote: >> Hi, >> >> I'm using Python 3.5.1 with PyUSB 1.0 under Win 10 (64). We try to read >> the USB output of a DMM 'UT61B'. >> >> import usb.core >> import usb.util >> import usb.backend.libusb1 >> >> def Gosub(): >>

Re: What's the best way to minimize the need of run time checks?

2016-08-28 Thread Chris Angelico
On Sun, Aug 28, 2016 at 6:33 PM, Steven D'Aprano wrote: > On Sunday 28 August 2016 15:29, Chris Angelico wrote: >> It might be a good way of thinking about points on a Cartesian plane, >> though. Rectangular and polar coordinates truly are just different >> ways of expressing the same information.

Re: Is duck-typing misnamed?

2016-08-28 Thread Joe
Am 28.08.2016 um 00:34 schrieb Terry Reedy: On 8/26/2016 7:58 PM, ROGER GRAYDON CHRISTMAN wrote: "If it walks like a duck, quacks like a duck,... " so there is indeed precedence for this so-called 'duck typing' but wouldn't it be more Pythonic to call this 'witch typing'? "How do you know sh

Re: Multimeter USB output

2016-08-28 Thread Terry Reedy
On 8/28/2016 5:13 AM, Joe wrote: Am 28.08.2016 um 00:45 schrieb Terry Reedy: On 8/27/2016 3:35 PM, Joe wrote: Hi, I'm using Python 3.5.1 with PyUSB 1.0 under Win 10 (64). We try to read the USB output of a DMM 'UT61B'. import usb.core import usb.util import usb.backend.libusb1 def Gosub():

Re: What's the best way to minimize the need of run time checks?

2016-08-28 Thread Juan Pablo Romero Méndez
2016-08-28 0:04 GMT-07:00 Steven D'Aprano < steve+comp.lang.pyt...@pearwood.info>: > On Sunday 28 August 2016 15:56, Juan Pablo Romero Méndez wrote: > > > 2016-08-27 21:30 GMT-07:00 Steve D'Aprano : > [...] > >> Now it is true that speaking in full generality, classes and types > refer to > >> dif

Re: Is duck-typing misnamed?

2016-08-28 Thread Eric S. Johansson
On 8/27/2016 7:28 PM, ROGER GRAYDON CHRISTMAN wrote: > Your response is appreciated. I just thought I'd comment a little more on > the > script: > > Woman: I'm not a witch! I'm not a witch! > > V: ehh... but you are dressed like one. > > W: They dressed me up like this! > > All: naah no we

Re: Is duck-typing misnamed?

2016-08-28 Thread Michael Torrie
On 08/27/2016 05:28 PM, ROGER GRAYDON CHRISTMAN wrote: > They took a woman who originally, I think we might agree, was not a witch, Umm no, she was actually a witch. Which makes the scene even funnier. "Fair caught," she says at the end. -- https://mail.python.org/mailman/listinfo/python-list

Re: What's the best way to minimize the need of run time checks?

2016-08-28 Thread Steve D'Aprano
On Sun, 28 Aug 2016 07:28 pm, Chris Angelico wrote: > On Sun, Aug 28, 2016 at 6:33 PM, Steven D'Aprano > wrote: >> On Sunday 28 August 2016 15:29, Chris Angelico wrote: >>> It might be a good way of thinking about points on a Cartesian plane, >>> though. Rectangular and polar coordinates truly ar

Re: Is duck-typing misnamed?

2016-08-28 Thread Steve D'Aprano
On Sun, 28 Aug 2016 08:34 am, Terry Reedy wrote: > On 8/26/2016 7:58 PM, ROGER GRAYDON CHRISTMAN wrote: >> "If it walks like a duck, quacks like a duck,... " >> >> so there is indeed precedence for this so-called 'duck typing' >> >> >> but wouldn't it be more Pythonic to call this 'witch typing'?

Re: What's the best way to minimize the need of run time checks?

2016-08-28 Thread Chris Angelico
On Mon, Aug 29, 2016 at 12:43 PM, Steve D'Aprano wrote: > On Sun, 28 Aug 2016 07:28 pm, Chris Angelico wrote: > >> On Sun, Aug 28, 2016 at 6:33 PM, Steven D'Aprano >> wrote: >>> On Sunday 28 August 2016 15:29, Chris Angelico wrote: It might be a good way of thinking about points on a Cartesi