[issue35406] calendar.nextmonth and calendar.prevmonth functions doesn't check if the month is valid
New submission from Şahin : import calendar calendar.nextmonth(2018, 11) returns (2018, 12) which is OK. calendar.nextmonth(2018, 12) returns (2019, 1) which is also OK. calendar.nextmonth(2018, 13) returns (2018, 14). It would make more sense if this was raise calendar.IllegalMonthError. -- components: Library (Lib) messages: 331031 nosy: asocia priority: normal severity: normal status: open title: calendar.nextmonth and calendar.prevmonth functions doesn't check if the month is valid ___ Python tracker <https://bugs.python.org/issue35406> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue35406] calendar.nextmonth and calendar.prevmonth functions doesn't check if the month is valid
Change by Şahin : -- keywords: +patch pull_requests: +10128 stage: -> patch review ___ Python tracker <https://bugs.python.org/issue35406> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue35406] calendar.nextmonth and calendar.prevmonth functions doesn't check if the month is valid
Şahin added the comment: I understand you but i still think these functions need to check it. As an end-user, I shouldn't see these functions to work with no errors for illegal months. -- ___ Python tracker <https://bugs.python.org/issue35406> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue35406] calendar.nextmonth and calendar.prevmonth functions doesn't check if the month is valid
Şahin added the comment: I'm suggesting this idea to consistency. Why an IllegalMonthError exists in calendar module if we don't raise this error when required? What would you say if I asked you to "What is the month number coming after 156th month?" Would you say 157 or prefer to inform me that I'm doing something wrong? >>> import calendar >>> calendar.nextmonth(2018, 12) (2019, 1) If Python is smart enough to jump next year's first month and not say (2018, 13) blindly, it should also check if the given month is valid. But: >>> calendar.nextmonth(2018, 157) (2018, 158) I think this is clearly a bug in the code. --- I'll wander away from the this issue but some of the functions in calendar module also not consistent with each other: >>> calendar.monthcalendar(2018, 12) # Runs with no problem. >>> calendar.monthcalendar(2018, 0) # Raises IllegalMonthError. >>> calendar.monthcalendar(2018, 13) # Raises IllegalMonthError. >>> calendar.month(2018, 12) # Runs with no problem. >>> calendar.month(2018, 0) # Raises IllegalMonthError. >>> calendar.month(2018, 13) # Raises IndexError??? Why? Wouldn't it be more reasonable if the last one also had raised IllegalMonthError? >>> calendar.monthrange(2018, 12) # Runs with no problem. >>> calendar.monthrange(2018, 0) # Raises IllegalMonthError. >>> calendar.monthrange(2018, 13) # Raises IllegalMonthError. >>> calendar.prmonth(2018, 12) # Runs with no problem. >>> calendar.prmonth(2018, 0) # Raises IllegalMonthError. >>> calendar.prmonth(2018, 13) # Raises IndexError. -- ___ Python tracker <https://bugs.python.org/issue35406> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue35406] calendar.nextmonth and calendar.prevmonth functions doesn't check if the month is valid
Şahin added the comment: OK now it isn't a problem if we shouldn't use this function directly but how am i going to understand if a function is public API or not? In classes, we are using single or double underscore to indicate that the function or variable we're declaring is intended to be private. Is there anything similar to this for "public API functions" or am I in the wrong way? -- ___ Python tracker <https://bugs.python.org/issue35406> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue35406] calendar.nextmonth and calendar.prevmonth functions doesn't check if the month is valid
Şahin added the comment: OK, thank you all for information. It's now clear for me too why this is not an issue. I'll try to close this issue by selecting status as close but if it isn't working with this way (I'm new, I don't know how) anyone can close this. -- stage: patch review -> resolved status: open -> closed ___ Python tracker <https://bugs.python.org/issue35406> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue34723] lower() on Turkish letter "İ" returns a 2-chars-long string
Şahin Kureta added the comment: I know it is not finalized and released yet but are you going to implement Version 14.0.0 of the Unicode Standard? It finally solves the issue of Turkish lower/upper case 'I' and 'i'. [Here is the document](https://www.unicode.org/Public/14.0.0/ucd/NamesList-14.0.0d1.txt) > 0049 LATIN CAPITAL LETTER I * Turkish and Azerbaijani use 0131 for lowercase > 0069 LATIN SMALL LETTER I * Turkish and Azerbaijani use 0130 for uppercase -- nosy: +Şahin Kureta ___ Python tracker <https://bugs.python.org/issue34723> ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com