May-11-2023, 02:53 AM
in many cases i need to go both ways in references held by a dictionary. i very often use the same one dictionary when i know the keys each way will not collide. for example my current project involves a file inode and that file's content digest. the digest is always a list of bytes and the inode is always an int. so i can just do the lookup with either and i'll get what i need. the value for inode is actually a list of inodes.
what i am looking around for is a simple way to iterate over one particular type of key and exclude the other. of course i can just test the key types:
what i am looking around for is a simple way to iterate over one particular type of key and exclude the other. of course i can just test the key types:
# iterate digests for k in bigdict.keys(): if isinstance(k,int): continue ...but i would like some simpler way to structure this.
Tradition is peer pressure from dead people
What do you call someone who speaks three languages? Trilingual. Two languages? Bilingual. One language? American.
What do you call someone who speaks three languages? Trilingual. Two languages? Bilingual. One language? American.