Python Forum
whuch is easiest to read?
Poll: which is easiest to read?
You do not have permission to vote in this poll.
#0
0%
0 0%
#1
0%
0 0%
#2
0%
0 0%
#3
0%
0 0%
Total 0 vote(s) 0%
* You voted for this item. [Show Results]

Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
whuch is easiest to read?
#1
which of these is easiest to read?

#0
        if t is str:
            return ''.join([chr(c) for c in o])
        if t is unicode:
            return unicode(''.join([chr(c) for c in o]))
        if t is list:
            return o
        if t is tuple:
            return tuple(o)
        if t is set:
            return set(o)
        if t is bytearray:
            return bytearray(o)
        if t is bytes:
            return bytes(bytearray(o))
#1
        s = ''.join([chr(c) for c in o])
        if t is str:       return s
        if t is unicode:   return unicode(s)
        if t is list:      return o
        if t is tuple:     return tuple(o)
        if t is set:       return set(o)
        a = bytearray(o)
        if t is bytearray: return a
        if t is bytes:     return bytes(a)
#2
        s = ''.join([chr(c) for c in o])
        if t is str: return s
        if t is unicode: return unicode(s)
        if t is list: return o
        if t is tuple: return tuple(o)
        if t is set: return set(o)
        a = bytearray(o)
        if t is bytearray: return a
        if t is bytes: return bytes(a)
#3
        if t is str:
                           return ''.join([chr(c) for c in o])
        if t is unicode:
                           return unicode(''.join([chr(c) for c in o]))
        if t is list:
                           return o
        if t is tuple:
                           return tuple(o)
        if t is set:
                           return set(o)
        if t is bytearray:
                           return bytearray(o)
        if t is bytes:
                           return bytes(bytearray(o))
Tradition is peer pressure from dead people

What do you call someone who speaks three languages? Trilingual. Two languages? Bilingual. One language? American.
Reply


Messages In This Thread
whuch is easiest to read? - by Skaperen - Jul-24-2018, 08:21 PM
RE: whuch is easiest to read? - by nilamo - Jul-24-2018, 08:30 PM
RE: whuch is easiest to read? - by Skaperen - Jul-25-2018, 12:24 AM

Possibly Related Threads…
Thread Author Replies Views Last Post
  What Is Best/Easiest IDE To Install? abrogard 12 6,522 Aug-14-2018, 09:50 PM
Last Post: Larz60+

Forum Jump:

User Panel Messages

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