Python 3000中的bool行为? [英] bool behavior in Python 3000?

查看:68
本文介绍了Python 3000中的bool行为?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

有没有关于在Python 3000中使用真正的布尔值b / b
的讨论?说一句

类型''bool''数组的numpy实现?


希望修复bool类型将被修复,

Alan Isaac

解决方案

Alan Isaac写道:


有没有关于在Python 3000中使用真正的布尔值b / b
的讨论?



我不确定我们现在所拥有的bool是不是真实的。


在数组的numpy实现中说出一些东西


$ b'类型''bool''?'


什么这方面你想要吗? stdlib数组的bool typecode

模块?


我可以猜到你可能想要的一些东西,但最好是

如果您解释了当前行为的示例以及您希望它是什么



-

Michael Hoffman


Alan Isaac写道:


有没有关于拥有真正的布尔的讨论
$ Python 3000中的b $ b?



我见过的最后一个是

http://mail.python.org/pipermail/pyt...ry/005284.html
< blockquote class =post_quotes>
希望修复bool类型将被修复,



你是否愿意解释什么是破碎的?


彼得


Peter Otten写道:


最后我看到的是
http ://mail.python.org/pipermail/pyt...ry/005284.html



好​​的。谢谢。


你是否愿意解释什么是坏的?



我想一个人要么发现算术运算的强制要求,要么是b / b或者不是。但这就是我的意思。


我的算术运算*,+, -

给出了标准解释两个元素

布尔代数:
http ://en.wikipedia.org/wiki/Two-ele...oolean_algebra

与上面的链接相比,

it并不打扰我用int和bools算术

产生整数。


干杯,

Alan Isaac


Is there any discussion of having real booleans
in Python 3000? Say something along the line
of the numpy implementation for arrays of type ''bool''?

Hoping the bool type will be fixed will be fixed,
Alan Isaac

解决方案

Alan Isaac wrote:

Is there any discussion of having real booleans
in Python 3000?

I''m not sure how the bools we have now are not "real."

Say something along the line of the numpy implementation for arrays

of type ''bool''?

What aspect of this do you want? A bool typecode for the stdlib array
module?

I can guess a number of things that you might mean, but it would be best
if you explained with an example of what current behavior is and what
you would like it to be.
--
Michael Hoffman


Alan Isaac wrote:

Is there any discussion of having real booleans
in Python 3000?

The last I have seen is

http://mail.python.org/pipermail/pyt...ry/005284.html

Hoping the bool type will be fixed will be fixed,

Do you care to explain what is broken?

Peter


Peter Otten wrote:

The last I have seen is
http://mail.python.org/pipermail/pyt...ry/005284.html

OK. Thanks.

Do you care to explain what is broken?

I suppose one either finds coercion of arithmetic operations to int
to be odd/broken or does not. But that''s all I meant.

My preference would be for the arithmetic operations *,+,-
to be given the standard interpretation for a two element
boolean algebra:
http://en.wikipedia.org/wiki/Two-ele...oolean_algebra

In contrast with the link above,
it does not bother me that arithmetic with ints and bools
produces ints.

Cheers,
Alan Isaac


这篇关于Python 3000中的bool行为?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆