span8
span4
span8
span4
Ideabydavid_r··fmeobjectspythonlists
It would be helpful if thefmeobjectsAPI had better support for complex lists.Consider the list:
_list{0}.id = '502' _list{0}.text = 'abc' _list{1}.id = '36' _list{1}.text = 'xyz'
The followingfmeobjectsmethod currently returns None:
items = feature.getAttribute('_list{}')
To access child elements, you currently have to access them invidudually and then assemble them into an appropriate structure yourself.
It would be very handy if thegetAttribute()method could return a nested Python dictionary containing the entire list with its elements, e.g.using the sample list above:
items = {0: {'id': '502', 'text': 'abc'}, 1: {'id': '36', 'text': 'xyz'}}
This would get rid of a lot of boilerplate code in Python scripts dealing with FME lists, as we could access individual list items using syntax like:
>>> print items[1]['text'] 'xyz'
takashicommented·
That's a nice idea.It might also be good that the return value is a list containing dictionaries as its elements, similar to a JSON array.e.g.
>>> print items [{'id': '502', 'text': 'abc'}, {'id': '36', 'text': 'xyz'}] >>> print items[0]['id'] 502
Share your great idea, or help out by voting for other people's ideas.
Raster cell support in fmeobjects
Improved Integration of Scripted Parameters
New/modified GUI type for nested list parameters
Python-function to extract absolute path
Custom reprojection using Python API
Make Data Inspector Table View to Expose List Elements
Add Rejected-port to the PythonCaller
Custom purge script to run when "Purge Temporary Files" is called
© 2020 Safe Software Inc |Legal