Python Forum
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
lookup tables
#3
i don't require contiguous bytes. but since all the items are < 256, then bytes are usable and they can be contiguous. a contiguous lookup would be faster than, for example, a list of ints, which was in earlier code prototypes. the bytes type does look good in Python3. but in Python2, bytes == str. in some places i split the code based on Python2 vs. Python3, while i try to make most of the code work in both Python2 and Python3. my goal for my UTF-8 code and my Escape Sequence code is to make everything work in 2.7 and 3.x as much as i can.

one thing i am putting some thought into is whether someone might want to get UTF-8 results back in a byte type but had to give Unicode data in a type that supports the full range of Unicode code points (a list of ints in both versions, str in Python3, unicode in Python2). originally i was going to return the same type as given. going from UTF-8 to Unicode is easier to see. even if the UTF-8 is given as bytes, the Unicode result probably can't be, so i will need to return something bigger. going the other way has a different issue. if the Unicode is given as some large type (which the caller usually must do), is that the type they want UTF-8 in? or do they want it in a byte type. so i'm thinking of adding support for a returntype= option to let the caller specify.
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
lookup tables - by Skaperen - Aug-11-2018, 01:40 AM
RE: lookup tables - by Gribouillis - Aug-11-2018, 06:42 AM
RE: lookup tables - by Skaperen - Aug-12-2018, 03:04 AM
RE: lookup tables - by Skaperen - Aug-12-2018, 10:31 PM
RE: lookup tables - by Gribouillis - Aug-13-2018, 06:43 AM

Possibly Related Threads…
Thread Author Replies Views Last Post
  2-dataframe, datetime lookup problem Mark17 0 1,286 Jan-27-2022, 01:02 AM
Last Post: Mark17
  Python VLookup? Lookup Table? Nu2Python 3 2,532 Oct-25-2021, 08:47 PM
Last Post: Nu2Python
  Can I replace IF statements with a key lookup ? jehoshua 3 2,622 Mar-05-2021, 10:24 PM
Last Post: jehoshua
  python 3 dns lookup private domain didact 1 2,655 Sep-19-2020, 06:01 PM
Last Post: bowlofred
  Partial key lookup in dictionary GaryNR 1 3,557 Jul-16-2020, 06:55 PM
Last Post: Gribouillis
  Encoding and mac-vendor-lookup library tuanjggaa 1 2,760 Mar-27-2020, 03:12 PM
Last Post: deanhystad
  Excel Lookup riteshprakash 0 1,845 Sep-11-2019, 12:43 PM
Last Post: riteshprakash
  fast lookup for array markB 3 4,146 May-13-2019, 12:11 AM
Last Post: scidam
  Lookup tables parrytoss 0 2,547 Feb-07-2018, 08:45 AM
Last Post: parrytoss
  Reading specific rows (lookup) rumbles 3 3,458 Jan-03-2018, 04:07 PM
Last Post: hshivaraj

Forum Jump:

User Panel Messages

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