gpsd-dev
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [gpsd-dev] [RFC] python client patch - reconnect to gpsd


From: Gary E. Miller
Subject: Re: [gpsd-dev] [RFC] python client patch - reconnect to gpsd
Date: Sat, 10 Mar 2018 16:18:28 -0800

Yo teyrana!

On Sat, 10 Mar 2018 18:56:43 -0500
teyrana <address@hidden> wrote:

> >  
> > > But if the community has concerns, I could have the library raise
> > > an error on failure-to-connect, or just have a 'gps.is_connected'
> > > property to check. Thoughts?  
> > I do not think it is an Error, certainly a warning.  
> 
> 
> Well, was asking in the literal sense: what should gps.next()
> return?  The options seem to be:
> 1. On connection failure:
>     `raise StopIteration`
> 2.  On success:
>    2.a. `return self.data`
>    2.b. `return self.response`
> 3. On failure:
>    `self.data or self.response` ... but their (len == 0)

Ah, got you.  Personnaly, I prefer error codes, exceptions are just a
devious way to so the same thing in a confusing manner.  But it is
pythonic, so I can't really object.

Looks good to me.  Try and see if it actually works.

> If we want to preserve backwards compatibility, these return types
> would have to behave the same.

Well, the 3.18 ABI is already changed, so I'd not worry about back
compatibility too much.

> 
> So, I'm trying to think of another option, but the only choices I can
> see are either (#1) raise the exception on fail-to-connect,
> or return a zero-length response.

Or return an error code.  Zero length response is too easy to confuse,
so return an error code or an exception.

RGDS
GARY
---------------------------------------------------------------------------
Gary E. Miller Rellim 109 NW Wilmington Ave., Suite E, Bend, OR 97703
        address@hidden  Tel:+1 541 382 8588

            Veritas liberabit vos. -- Quid est veritas?
    "If you can’t measure it, you can’t improve it." - Lord Kelvin

Attachment: pgp2cyqJCAuFr.pgp
Description: OpenPGP digital signature


reply via email to

[Prev in Thread] Current Thread [Next in Thread]