Python Forum
shortening an elif construct
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
shortening an elif construct
#11
in my utf-8 conversion function i use several powers of 2 but coded them like
    two16 = 2**16
    two21 = 2**21
    two26 = 2**26
    ...
    ...
    ...
    elif u < two16: # 2 octets
        ...
    elif u < two21: # 3 octets
        ...
    elif u < two26: # 4 octets
and so on.

when i get the code complete, tested working, and ready to release, i will post it.
Tradition is peer pressure from dead people

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


Possibly Related Threads…
Thread Author Replies Views Last Post
  Why is the if construct not calculating correctly? egemynet 21 3,860 Mar-21-2022, 01:20 PM
Last Post: deanhystad
  Building command in a looping construct DennisT 3 1,876 Sep-08-2020, 06:32 PM
Last Post: DennisT
  Whats the right way to refactor this Big if/elif/elif ? pitosalas 1 2,238 Jul-28-2019, 05:52 PM
Last Post: ichabod801
  Best construct? Array, class, other? PappaBear 1 2,967 May-10-2017, 06:02 PM
Last Post: nilamo

Forum Jump:

User Panel Messages

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