[ovs-dev] [python 08/31] python: Avoid using 'tuple' as a variable name.

Ethan Jackson ethan at nicira.com
Wed Aug 24 19:13:47 UTC 2011


I think the first step would actually be deciding on a python style
for OVS.  pylint can be IMO extremely draconian on certain issues.  I
personally have a configuration file which disables quite a few of
it's less reasonable checks.  I wonder if we should publish something
like this.

Ethan

On Wed, Aug 24, 2011 at 12:02, Ben Pfaff <blp at nicira.com> wrote:
> I'm becoming a big fan of running checks automatically on every build,
> as we do with "sparse" on C code when C=1 is provided on the command
> line.  Probably we'd need to first fix all the existing pylint
> problems though.
>
> On Tue, Aug 23, 2011 at 11:57:42PM -0700, Justin Pettit wrote:
>> pylint will complain about some of these things.  It would be good
>> to kick it off, when available, when builds are run (or at least on
>> a "make check").  I've had it on my to-do list for a while, but
>> haven't gotten around to it...
>>
>> --Justin
>>
>>
>> On Aug 23, 2011, at 2:05 PM, Ben Pfaff wrote:
>>
>> > 'tuple' is a Python built-in function, so it's best to avoid using it as a
>> > variable name.
>> >
>> > Suggested-by: Reid Price <reid at nicira.com>
>> > ---
>> > python/ovs/stream.py |    7 +++----
>> > 1 files changed, 3 insertions(+), 4 deletions(-)
>> >
>> > diff --git a/python/ovs/stream.py b/python/ovs/stream.py
>> > index c1ce422..16e383a 100644
>> > --- a/python/ovs/stream.py
>> > +++ b/python/ovs/stream.py
>> > @@ -88,15 +88,14 @@ class Stream(object):
>> >             return 0, Stream(sock, name, bind_path, status)
>> >
>> >     @staticmethod
>> > -    def open_block(tuple):
>> > +    def open_block((error, stream)):
>> >         """Blocks until a Stream completes its connection attempt, either
>> > -        succeeding or failing.  'tuple' should be the tuple returned by
>> > +        succeeding or failing.  (error, stream) should be the tuple returned by
>> >         Stream.open().  Returns a tuple of the same form.
>> >
>> >         Typical usage:
>> > -        error, stream = Stream.open_block(Stream.open("tcp:1.2.3.4:5"))"""
>> > +        error, stream = Stream.open_block(Stream.open("unix:/tmp/socket"))"""
>> >
>> > -        error, stream = tuple
>> >         if not error:
>> >             while True:
>> >                 error = stream.connect()
>> > --
>> > 1.7.4.4
>> >
>> > _______________________________________________
>> > dev mailing list
>> > dev at openvswitch.org
>> > http://openvswitch.org/mailman/listinfo/dev
>>
> _______________________________________________
> dev mailing list
> dev at openvswitch.org
> http://openvswitch.org/mailman/listinfo/dev
>



More information about the dev mailing list