views:

94

answers:

8

I am a perfectionist and need a good name for a function that parses data that has this type of format:

userID:12,year:2010,active:1

Maybe perhaps

parse_meta_data()

I'm not sure what the correct name for this type of data format is. Please advise! Thanks for your time.

A: 
parse_tagged_csv()

parse_csv()

parse_structured_csv()

parse_csv_with_attributes()

parse csvattr()
DigitalRoss
parse_csv_with_colon_separated_keys_and_values() ;)
phoebus
+1  A: 

Except for the lack of braces and the quotes around the keys, it looks like either JSON or a Python dict.

Ignacio Vazquez-Abrams
A: 

If it’s a proprietary data format, you can name it whatever you want. But it would be good to use a common term like serialized data or mapping list.

Gumbo
+1  A: 

parse_dict or parse_map

Nicolas Buduroi
I went with the naming convention dict or dictionary, thanks!
Axsuul
A: 

If it's just a list of simple items, each of which has a name and a value, then "key-value pairs" is probably the right term.

Matthew Slattery
A: 

I would go with:

parse_named_records()
e.James
A: 

ParseCommaSeparatedNameValuePairs()

ParseDelimitedNameValuePairs()

ParseCommaSeparatedKeyValuePairs()

ParseDelimitedKeyValuePairs()

Mark Redman
Its funny that everyone has their own ideal structues in their brain.
Mark Redman
A: 

From the one line you gave, ParseJson() seems appropriate

Chris S