On Sat, Jan 22, 2022 at 11:36:01AM +0100, Luca Weiss wrote: > Hi Simon, > > On Dienstag, 28. Dezember 2021 09:34:57 CET Simon Glass wrote: > > Hi Luca, > > > > On Sat, 25 Dec 2021 at 06:26, Luca Weiss <luca@xxxxxxxxx> wrote: > > > Add a new method that doesn't throw an exception when a property isn't > > > found but returns None instead. > > > > > > Also add a test for the new method. > > > > You can use > > > > getprop(node, prop, quiet=QUIET_NOTFOUND) > > > > This returns -1 when not found which I found quite un-pythonic (not that > pylibfdt is currently super pythonic ;) ). > Having None returned if not found is much nicer to use and much more clear to > use > > if foobar is None: > > instead of having to use > > if foobar == -QUIET_NOTFOUND: > > > Are there any changes I can do for you to reconsider your position on this > patch? So, you're absolutely right that the current interface is non-pythonic. The question is simply whether that ugliness is enough to outweight the complexity of introducing an extra interface. > > Regards > Luca > > > > Signed-off-by: Luca Weiss <luca@xxxxxxxxx> > > > --- > > > > > > pylibfdt/libfdt.i | 10 ++++++++++ > > > tests/pylibfdt_tests.py | 2 ++ > > > 2 files changed, 12 insertions(+) > > > > Regards, > > Simon > > > > -- David Gibson | I'll have my music baroque, and my code david AT gibson.dropbear.id.au | minimalist, thank you. NOT _the_ _other_ | _way_ _around_! http://www.ozlabs.org/~dgibson
Attachment:
signature.asc
Description: PGP signature