12.09.21 07:48, Ram Krishna пише:
> I guess having subclass for implementation errors to distinguish will be very
> helpful, Typeerror has become very generic and finding solution is like
> searching a needle in haystack for the new developers.
>
> Eg- TypeError: ‘int’ object is not iterable
>
> students=int(input('Please enter the number of students in the class: '))
>
> for number in students:
> math_grade=(input("Enter student's Maths grade: "))
> science_grade=(input("Enter student's Science grade: "))
> social_grade=(input("Enter student's Scoial grade: "))
>
> Common homeworks/tutorial for beginners who find difficult to understand why
> this error occurred. So a fine grained exception would be lot easier to
> understand and resolve quickly.
My proposition does not change the type of exception here. It is a
vanilla TypeError: you use a value of improper type in operation.
A new implementation error would be raised if you implement your own
iterable class and return int in __iter__(). Most beginners will never
see such errors because it is an advanced topic.
_______________________________________________
Python-ideas mailing list -- [email protected]
To unsubscribe send an email to [email protected]
https://mail.python.org/mailman3/lists/python-ideas.python.org/
Message archived at
https://mail.python.org/archives/list/[email protected]/message/3BUU5NQNGJKO4V2JROS3XVCCMTZ7EIMZ/
Code of Conduct: http://python.org/psf/codeofconduct/