Python integers can get arbitrarily large - the amount of bytes they can take up is limited only by the available memory. As a result, you can store very large integers in dicts, just like any other type of variable.
Also note that python's types are behind the scenes. The same dict
can use almost anything as a key, and anything as a corresponding value. You don't need to declare it in advance.
For example:
large_dict = {
'a': 2**99**2,
'b': 3**99**2,
'c': 4**66**3,
'd': 5,
}
print(large_dict['a'])
# 24830616513292456149616454036974739771820938966442197939419359658089567202400780743905571137028486156486036903513607264042124719153572110201314197883546916952215606391372422139042592773840794323335212159700095246665013394384789465765464293679828325113232950453141468484569985222217035575296458501452872186378717438026640856834533121910412608973480242085881672164719912544082874072107422434390554486837170594217552352179217838815153995983301946373496587090616156896354994345352377952726227907079690576457293694283595586693944067261016834086680506973471228878547284373711902581003346534526356682248040411471279547066667078693613059243075566078841931213128462480543351921983621089668275721435948101887626265184182951445127840725828830209648532962314294583129458462587616879683621002666459872557839185108646816817833525155517060333482860732993614665277625489415502061774379920496929429602780585502167079135606858316403456987934488806952870800041077801533837170751376374861251329800483795256882616805854878581164361680226869833419669385928257122731195573904839938024027782370149377710658645650280419249518679276644090004956974913792951678647959778713113374754349884308332520403967474904860378939613020574276565212696855826404212709820546399167642334178336428555942563152453083892489382421641854517289230831100263608004179956903465008511600241582320500793382331980382057875456793451053160479393167189744446997815108094874623772314046414880967888630771591139242793679368373241262303020403503806741495927267535782756256226464827679171453103936982984219779689528492725634758390287762884938541414982295293195059435820985171981953652126800809143528930914867233895403413631144957773050572055247562723249843368842707168818290935719822151262157837630513192298577647355462098479363787742148415773842359155842482339588691450667863720967596151398289089712023294064255959682719606426598201025203109875583565132643670912933398263577545142697715765285834571917043394759092957857788427530930354248022105571235052694964834870559303479169142265964947215835534331232659231738844605321566863791868404356910674470711233474169254178106049934124965008926126859691353260188518891725702238011978956872340932416194028852429366663313267993063866935339039988538965602564065890425970977641916796977494816019907846068887159081996367805130377827078940214763737954464021880895504378918548182271578043448659561293769460226209756884091241789271212624443566823618854822556818054950921281495213677124939344997301596883289597036555187701021490864067003001042353911716339896584757966357696031609808169050800581900702426733604379398309018563404211559969917703040652231206637777868534421416141767113165973592413599591681134708842927135950028572565259146431359982767414698579766187600152269764793150959658673104646366308004593390529802053032008317417654941763892718192450423219923744313363894743858416682079171193877076995395458797611449453319718948222265568320631084026777091936418337638425034752
These should qualify as 'arbitrarily large integers', given that trying to print them overflows the size of my terminal window, and large_dict['c']
displays fine despite consuming about six times StackOverflow's character limit. Note that things might break when you try to convert them to float
ing point numbers, because those have a precision limit.
Python does support 'type hinting', where you can imply the type of a variable, but it doesn't actually affect anything you can do with the code. Regardless, here's how you would notate this:
# need to import Dict to type-hint about it
from typing import Dict
# hint that large_dict should use strings as keys and ints as values
# note that a 'character' is just a 1-length string, as far as python is concerned
# note also that this will not stop someone from putting a non-string in as a key,
# or a non-int in as a value
large_dict: Dict[str, int] = {
...
}