Question on ABC classes

2020-10-22 Thread Julio Di Egidio
Hello guys, I am professional programmer but quite new to Python, and I am trying to get the grips of some peculiarities of the language. Here is a basic question: if I define an ABC class, I can still instantiate the class unless there are abstract methods defined in the class. (In the typical

Re: Question on ABC classes

2020-10-22 Thread Julio Di Egidio
On Thursday, 22 October 2020 23:04:25 UTC+2, Ethan Furman wrote: > On 10/22/20 9:25 AM, Julio Di Egidio wrote: > > > Now, I do read in the docs that that is as intended, > > but I am not understanding the rationale of it: why > > only if there are abstract methods define

Re: Question on ABC classes

2020-10-22 Thread Julio Di Egidio
On Friday, 23 October 2020 07:36:39 UTC+2, Greg Ewing wrote: > On 23/10/20 2:13 pm, Julio Di Egidio wrote: > > I am now thinking whether I could achieve the "standard" > > behaviour via another approach, say with decorators, somehow > > intercepting calls to __new__

Re: Question on ABC classes

2020-10-29 Thread Julio Di Egidio
On Sunday, 25 October 2020 20:55:26 UTC+1, Peter J. Holzer wrote: > On 2020-10-22 23:35:21 -0700, Julio Di Egidio wrote: > > On Friday, 23 October 2020 07:36:39 UTC+2, Greg Ewing wrote: > > > On 23/10/20 2:13 pm, Julio Di Egidio wrote: > > > > I am now thinki

Re: Question on ABC classes

2020-10-29 Thread Julio Di Egidio
On Friday, 30 October 2020 05:09:34 UTC+1, Chris Angelico wrote: > On Fri, Oct 30, 2020 at 1:06 PM Julio Di Egidio wrote: > > On Sunday, 25 October 2020 20:55:26 UTC+1, Peter J. Holzer wrote: > > > I think you are trying to use Python in a way contrary to its nature.

Re: help(list[int]) → TypeError

2020-12-04 Thread Julio Di Egidio
On Thursday, 3 December 2020 at 19:28:19 UTC+1, Paul Bryan wrote: > Is this the correct behavior? > > Python 3.9.0 (default, Oct 7 2020, 23:09:01) > [GCC 10.2.0] on linux > Type "help", "copyright", "credits" or "license" for more information. > >>> help(list[int]) > Traceback (most recent ca

Re: Lambda in parameters

2020-12-18 Thread Julio Di Egidio
On Friday, 18 December 2020 at 15:20:59 UTC+1, Abdur-Rahmaan Janhangeer wrote: > The Question: > > # --- > This problem was asked by Jane Street. > > cons(a, b) constructs a pair, and car(pair) and cdr(pair) returns the first > and last element of that pair. For example, car(cons(3, 4)) retur

Re: How do you find what exceptions a class can throw?

2020-12-20 Thread Julio Di Egidio
On Sunday, 20 December 2020 at 18:18:26 UTC+1, Chris Green wrote: > If I ignore the exception then the > program just exits, if I want the program to do something useful about > it (like try again) then I have to catch the specific exception as I > don't want to try again with other exceptions.

Re: Re: How do you find what exceptions a class can throw?

2020-12-20 Thread Julio Di Egidio
On Sunday, 20 December 2020 at 19:35:21 UTC+1, Karsten Hilbert wrote: > > If it's a timeout exception I'm going to delay a little while and then > > try again. The timeout is probably because the server is busy. > > So what you are looking for is the form of a potential > "timeout exception" (s

Re: Re: Re: How do you find what exceptions a class can throw?

2020-12-20 Thread Julio Di Egidio
On Sunday, 20 December 2020 at 19:54:08 UTC+1, Karsten Hilbert wrote: > > > So what you are looking for is the form of a potential > > > "timeout exception" (say, exception name) ? > > > > > > Provoke one and have a look. > > > > > > Then catch what you saw. > > > >

Re: How do you find what exceptions a class can throw?

2020-12-20 Thread Julio Di Egidio
On Sunday, 20 December 2020 at 23:16:10 UTC+1, cameron...@gmail.com wrote: > On 20Dec2020 20:34, Karsten Hilbert wrote: > >> Trust me: it takes 100x getting anything done plus keep up with your > >> prayers, and it takes 100^100x learning anything solid, as in just forget > >> about it. Indeed,