the input is height and width. if height>width the orientation is portrait, and if width>height - orientation is Landscape. No matter if user calls page_info(height=297, width=210) or page_info(height=210, width = 297) it is A4 size. So, I take height and width and create tuple with first element the bigger of the height/width and second element - the other one. that is p-dimensions that I use as key. Of course I don't order page_size - I don't need to sorted dict. As you know dict is unordered by design up untill 3.6.
I know my dict is not exhaustive for all possible page sizes - it's up the OP to implement full nomenclature if s/he wants to do so. but for page sizes A0-A4 it's OK and if at least one of the dimensions is not standard one it will return unknown size. I have provided an example for 4 possible combinations and all work fine.
I know my dict is not exhaustive for all possible page sizes - it's up the OP to implement full nomenclature if s/he wants to do so. but for page sizes A0-A4 it's OK and if at least one of the dimensions is not standard one it will return unknown size. I have provided an example for 4 possible combinations and all work fine.