[Top][All Lists]

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

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

From: teyrana
Subject: [gpsd-dev] [RFC] python client patch - reconnect to gpsd
Date: Mon, 12 Mar 2018 22:49:17 +0000

Hey Gary,

I've cleaned up the patch a fair bit: 
1.  now raises 'StopIteration' on any error
2. gps/ contains only the WATCH_* options 

Let me know what you think.

Daniel Williams
858-220-8134 (Mobile)

On Sat, Mar 10, 2018 at 7:49 PM, teyrana <address@hidden> wrote:
Okay; I'll implement the changes on monday, and resubmit.

On Sat, Mar 10, 2018, 7:18 PM Gary E. Miller <address@hidden> wrote:
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
> return?  The options seem to be:
> 1. On connection failure:
>     `raise StopIteration`
> 2.  On success:
>    2.a. `return`
>    2.b. `return self.response`
> 3. On failure:
>    ` 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.

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: 0001-feature-Client-side-libraries-may-automatically-reco.patch
Description: Source code patch

reply via email to

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