collective / icalendar

icalendar parser library for Python

Home Page:https://icalendar.readthedocs.io/en/latest/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

to_ical() -> str|bytes inconsistency

niccokunzmann opened this issue · comments

@ennamarie19 added code in #581 (comment) to work around an inconsistency in the to_ical() functions: They return bytes or strings.
I am wondering: It seems like the library did not have major consistency changes since Python 2.7 and so I guess that bytes and strings might still be mixed because of that. I open this as a discussion about it but I think that it could also be an issue.

I assume that we rarely run into this issue because most people just use the icalendar.Calendar interface.

>>> import icalendar
>>> icalendar.Calendar().to_ical()
b'BEGIN:VCALENDAR\r\nEND:VCALENDAR\r\n'

This returns bytes.

What are your thoughts on this matter?