1 | initial version |

The problem can be seen as follows:

```
sage: list(P(1))[0] == 1
False
sage: type(list(P(1))[0])
<type 'sage.rings.polynomial.pbori.BooleanMonomial'>
```

When you convert a `BooleanPolynomial`

to a list (which you do implicitly by iterating with `in`

), the elements are of type `BooleanMonomial`

, which apparently do not have rich comparison with integers implemented (which is probably not intentional but an oversight; I will report it).

A workaround is: when you want to compare with a constant (such as 1 or 0), first convert it into the right ring (or other parent object):

```
sage: list(P(1))[0] == P(1)
True
```

So the workaround is to compare to `P(1)`

instead of `1`

.

2 | No.2 Revision |

The problem can be seen as follows:

```
sage: list(P(1))[0] == 1
False
sage: type(list(P(1))[0])
<type 'sage.rings.polynomial.pbori.BooleanMonomial'>
```

When you convert a `BooleanPolynomial`

to a list (which you do implicitly by iterating with `in`

), the elements are of type `BooleanMonomial`

, which apparently do not have rich comparison with integers 0 and 1 implemented (which is probably not intentional but an oversight; I will report it).

A workaround is: when you want to compare with a constant (such as 1 or 0), first convert it into the right ring (or other parent object):

```
sage: list(P(1))[0] == P(1)
True
```

So the workaround is to compare to `P(1)`

instead of `1`

.

3 | No.3 Revision |

The problem can be seen as follows:

```
sage: list(P(1))
[1]
sage: list(P(1))[0]
1
sage: list(P(1))[0] == 1
False
sage: type(list(P(1))[0])
<type 'sage.rings.polynomial.pbori.BooleanMonomial'>
```

When you convert a `BooleanPolynomial`

to a list (which you do implicitly by iterating with `in`

), the elements are of type `BooleanMonomial`

, which apparently do not have rich comparison with integers 0 and 1 implemented (which is probably not intentional but an oversight; I will report it).

A workaround is: when you want to compare with a constant (such as 1 or 0), first convert it into the right ring (or other parent object):

```
sage: list(P(1))[0] == P(1)
True
```

So the workaround is to compare to `P(1)`

instead of `1`

.

4 | No.4 Revision |

The problem can be seen as follows:

```
sage: list(P(1))
[1]
sage: list(P(1))[0]
1
sage: list(P(1))[0] == 1
False
sage: type(list(P(1))[0])
<type 'sage.rings.polynomial.pbori.BooleanMonomial'>
```

When you convert a `BooleanPolynomial`

to a list (which you do implicitly by iterating with `in`

), the elements are of type `BooleanMonomial`

, which apparently do not have ~~rich ~~comparison with integers 0 and 1 implemented (which is probably not intentional but an oversight; I will report it).

```
sage: list(P(1))[0] == P(1)
True
```

So the workaround is to compare to `P(1)`

instead of `1`

.

5 | No.5 Revision |

The problem can be seen as follows:

```
sage: list(P(1))
[1]
sage: list(P(1))[0]
1
sage: list(P(1))[0] == 1
False
sage: type(list(P(1))[0])
<type 'sage.rings.polynomial.pbori.BooleanMonomial'>
```

When you convert a `BooleanPolynomial`

to a list (which you do implicitly by iterating with `in`

), the elements are of type `BooleanMonomial`

, which apparently do not have comparison with ~~integers 0 and ~~the integer 1 implemented (which is probably not intentional but an oversight; I will report it).

A workaround is: when you want to compare with a constant ~~(such ~~such as ~~1 or 0), ~~1, first convert it into the right ring (or other parent object):

```
sage: list(P(1))[0] == P(1)
True
```

So the workaround is to compare to `P(1)`

instead of `1`

.

6 | No.6 Revision |

The problem can be seen as follows:

```
sage: list(P(1))
[1]
sage: list(P(1))[0]
1
sage: list(P(1))[0] == 1
False
sage: type(list(P(1))[0])
<type 'sage.rings.polynomial.pbori.BooleanMonomial'>
```

When you convert a `BooleanPolynomial`

to a list (which you do implicitly by iterating with `in`

), the elements are of type `BooleanMonomial`

, which apparently do not have comparison with the integer 1 implemented (which is probably not intentional but an oversight; I will report it).

A workaround is: when you want to compare with a constant such as 1, first convert it into the right ring (or other parent object):

```
sage: list(P(1))[0] == P(1)
True
```

So the workaround is to compare to `P(1)`

instead of `1`

.

Edit: I submitted this as trac ticket #27019.

Copyright Sage, 2010. Some rights reserved under creative commons license. Content on this site is licensed under a Creative Commons Attribution Share Alike 3.0 license.