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


Messages In This Thread
'b' prefix, python 2 vs 3 - by uromastix - Jul-26-2018, 02:45 PM
RE: 'b' prefix, python 2 vs 3 - by micseydel - Jul-26-2018, 04:09 PM

Possibly Related Threads…
Thread Author Replies Views Last Post
  Is a good practice naming user defined python functions with prefix udf_? meerkat 2 845 Mar-09-2024, 01:40 PM
Last Post: buran
  Request for [PyGTK] or [GTK] prefix in GUI forum Lomax 2 2,199 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