I'm porting a piece of Ruby to Python. I've ported the majority of the code except the following. I can't really figure out what it does.
the variable rest would be a string representing a phone number. Its only really the
country_handler = splitter_mapping[i][presumed_cc]
Which I find confusing. I realise I could probably use kwargs in python but I'm not really sure.
Any ideas?
module Phony
class CountryCodes
attr_reader :splitter_mapping
def split_cc rest
presumed_cc = ''
1.upto(3) do |i|
presumed_cc << rest.slice!(0..0)
country_handler = splitter_mapping[i][presumed_cc]
return [country_handler, presumed_cc, rest] if country_handler
end
# This line is never reached as CCs are in prefix code.
end