2013/1/2 Dagobert Michelsen <[email protected]>:
> It works now, so I guess I'll also commit the changes so it looks like I
> did the fix :-)

Cool. Sorry for not providing a 100% complete patch, I had little time
to respond, so I opted for a quick imperfect response rather than no
response at all.

The problem was a general dilemma in programming: when you query for
something and it's not there, should you return nothing or should you
throw an error? Maybe you should return nothing (None / null / empty
string / zero, etc) to let the program run further? But maybe you
should throw an error, to make a distinction between e.g. an empty
string and there not being anything at all? I think that the current
API, which throws a HTTP exception when you ask for a name of a
package, is a bad API, but I have to rethink the whole thing before I
start to make any further changes in the code. I think I'll create a
new exception class in the rest.py file and throw that. And/or maybe
I'll add an option that instructs what do you want when the object
you're looking for is missing, e.g.

rest_client.GetFooBySomething(something="its name", on_missing=rest.RETURN_NONE)

vs

rest_client.GetFooBySomething(something="its name",
on_missing=rest.THROW_EXCEPTION)

The question is not language specific, so I'd like to ask Pythonistas
as well as other language enthusiasts, what behavior and API would you
prefer?

Maciej
_______________________________________________
maintainers mailing list
[email protected]
https://lists.opencsw.org/mailman/listinfo/maintainers
.:: This mailing list's archive is public. ::.

Reply via email to