Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #109095

Re: Spurious issue in CPython 2.7.5

From Dennis Lee Bieber <wlfraed@ix.netcom.com>
Newsgroups comp.lang.python
Subject Re: Spurious issue in CPython 2.7.5
Date 2016-05-24 20:19 -0400
Organization IISS Elusive Unicorn
Message-ID <mailman.73.1464135591.20402.python-list@python.org> (permalink)
References <779717266.18172.1464085350716.JavaMail.open-xchange@ox.netsite.dk> <dmr9kbl3adkg28ajovipa8m48m7ljvrr3b@4ax.com>

Show all headers | View raw


On Tue, 24 May 2016 12:22:30 +0200 (CEST), "thomas povtal.org"
<thomas@povtal.org> declaimed the following:

>   Hi,
>
>   Please excuse me if this is not the right place, but I have some issues
>   with CPython on a NUMA machine.
>
>   1: I get "RuntimeWarning: tp_compare didn't return -1 or -2 for
>   exception". It's a line like:
>
>   "if Foo = False:" where Foo is a global variable (global Foo).
>
	Well, the first problem is that you can not do assignments there...

	Comparison would be

		if Foo == False:

OR

		if not Foo:

(Python considers: 0, False, [], {}, "" all to be "false" so a comparison
to the constant False is seldom needed... And when it is, it may be better
to use identity check
		if Foo is False:
)

-- 
	Wulfraed                 Dennis Lee Bieber         AF6VN
    wlfraed@ix.netcom.com    HTTP://wlfraed.home.netcom.com/

Back to comp.lang.python | Previous | Next | Find similar | Unroll thread


Thread

Re: Spurious issue in CPython 2.7.5 Dennis Lee Bieber <wlfraed@ix.netcom.com> - 2016-05-24 20:19 -0400

csiph-web