Python Forum
'b' prefix, python 2 vs 3
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
'b' prefix, python 2 vs 3
#1
Hi everyone,

I am making a suggestion to allow a no-op 'b' prefix for variables of type 'str' in python 2. Hopefully we can get this change in before python 2 is no longer supported.

Personally I make it a point to write code that is compatible with both python 2 and 3. This is very doable (even for the print statement as long as you only pass a single argument), but I still run into problem with open(..."b") and struct.pack in python 3 because of the new byte types. It would be great if I could write python 3 code with the 'b' prefix that also worked in python 2 (at least not crash from the syntax error).

Thanks!
Reply
#2
I just tested version 2.7.15 and found that your "suggestion" is already the case.

Also, we're not officially linked to the Python Software Foundation, so no one who matters for that kind of thing will see this post. They have mailing lists where you'd be more likely to be seen.
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  Is a good practice naming user defined python functions with prefix udf_? meerkat 2 299 Mar-09-2024, 01:40 PM
Last Post: buran
  Request for [PyGTK] or [GTK] prefix in GUI forum Lomax 2 1,981 Jan-30-2021, 12:06 AM
Last Post: Axel_Erfurt

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020