On 09/11/09 21:08, James Teh wrote:
On 10/11/2009 2:33 AM, Michael Whapples wrote:The last point raises the question should we may be have another function call:def list_tables(locale="whatever the system default is", grade=2, dots=6):"""Returns a list of the tables matching the criteria with the best match first""" ... In that when I say best match I mean it will put the most recent revision of the code firstI think this is a good idea.You can do this in CC++, but not pure C. We'd probably just need to accept NULL/-1 and treat it as default. You got it, precisely what I was thinkig of, the feature may not exist but defaults can be done with accepting NULLs and setting it to a value if NULL.and as we have defaults (a python feature although must be possible to do something similar in C)
I agree here too. This reduces complexity by only having one call. The only catch is that in C, you'll need to allocate an array ahead of time, so you'll have to call it first to get the length. The alternative is to have it malloc the memory itself, but this is probably frowned upon, as it means you can't control your own memory allocation. You raise a good point and probably the sort of thing which fustrates me around C programs. I guess a C version could accept a table_info[] array and a length, this would then mean that the call could return up to that many matches, possibly a feature from a limitation?Alternatively why not have this behavior as the single call, so if you aren't interested in giving the user options then take the first table in the list (check list length is not 0). That also handles the case of no matching table.
Michael Whapples
Jamie
For a description of the software and to download it go to http://www.jjb-software.com