[issue23304] Unused Superclass in calendar.py

2015-01-22 Thread CliffM

New submission from CliffM:

calendar.py ( lines 17,18 )  is not used :

# Exception raised for bad input (with string parameter for details)
error = ValueError

This could either be deleted OR used as the superclass in the next two class 
declarations as the comment suggests.

--
components: Library (Lib), Tests
messages: 234513
nosy: CliffM
priority: normal
severity: normal
status: open
title: Unused Superclass in calendar.py
versions: Python 3.6

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue23304
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue19249] Enumeration.__eq__

2013-10-19 Thread CliffM

CliffM added the comment:

It is appropriate to modify the pickle-module to trap (a potential) the 
singletonicity-breaking event and raise a warning ? (I'm guessing an exception 
would be far too rude)

I like the idea of using identity-equality, but without the above trap one 
might get really weird bugs without a deep reading of the docs and/or code.

--

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue19249
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue19281] add __objclass__ to the docs

2013-10-18 Thread CliffM

Changes by CliffM cliffm1...@gmail.com:


--
nosy: +CliffM

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue19281
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue19252] Enum.py : Enum.__new__() : Test Coverage

2013-10-14 Thread CliffM

CliffM added the comment:

Sorry -- I could have been clearer :

The conditional:

 if member.value == value:

Is redundant as the tests stand.  If you comment it out -- everything works. So 
therefore we are missing a test.

The current test works, as red is the first value to pop out of the value() 
list.  

This makes the if-clause fragile for future maintenance.  So we need another 
test to ensure the loop is covered.

It's a coverage issue -- where although the code is executed by the test, and 
the code is correct, the test is not complete enough for the code.

--

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue19252
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue19252] Enum.py : Enum.__new__() : Test Coverage

2013-10-14 Thread CliffM

CliffM added the comment:

Yes it's purely a coverage issue.  I must try to be more explicit (rather than 
implicit).

--

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue19252
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue19263] enum.py : Enum.__new__(). __objclass__

2013-10-14 Thread CliffM

New submission from CliffM:

Is the assignment __objclass__ = enum_class  in enum.py(149) needed ?

I cannot find any other reference to it (even Google) and it seems that 
__class__ is already set to enum_class :


enum_member.__objclass__ = enum_class  not sure what this is doing 

I have attached a patch that forces the assignment, but would rather understand 
what is intended here -- and test for that.

--
components: Tests
files: enum.patch
keywords: patch
messages: 199964
nosy: CliffM, ethan.furman
priority: normal
severity: normal
status: open
title: enum.py : Enum.__new__(). __objclass__
type: enhancement
versions: Python 3.4
Added file: http://bugs.python.org/file32126/enum.patch

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue19263
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue19237] Proposal : LCM function to complement GCD

2013-10-13 Thread CliffM

CliffM added the comment:

I've handled a patch, and extended both lcm and gcd to take an arbitrary number 
of arguments -- via functools.reduce, as they are both multiplicative (in the 
first argument).

Also handled the zero case , so lcm(0,0) = 0 = gcd(0,0)

Use-case-wise, I do a reasonable amount of number-theoretic work and lcm and 
gcd are always popping up.  If gcd is defined, it's nice to find lcm too.  

For those less well versed in number-theory, the implementation of lcm is not 
so obvious, and many end up going down a tedious prime factorisation route -- 
if they get that far.

But is it all worth it in the fractions module ?  They should really be in the 
math module.

--
Added file: http://bugs.python.org/file32084/lcm2.patch

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue19237
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue19249] Enumeration.__eq__

2013-10-13 Thread CliffM

New submission from CliffM:

Given that enumeration members are Singletons, can we not rely on the default
__eq__() method ?  (FWIW the existing tests all pass if you delete it)

This might be confusing for a reader later, so needs documenting.  Although I 
think it should be documented (in enum.py) either way.

Maybe also add a singletoness test ?

def test_singleton(self):
class A(Enum):
X=1
Y=2

self.assertTrue(id(A.X)==id(A.X))


Of course there is good chance that there is a test-case I have not thought of 
that will defeat this.  I am thinking about :

a) weak-ref handling of Enums 

b) unpickling, say by a user of the ZODB

Which might break the singletonicity. ??  Any offers ??

--
components: Tests
messages: 199774
nosy: CliffM
priority: normal
severity: normal
status: open
title: Enumeration.__eq__
versions: Python 3.4

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue19249
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue19252] Enum.py : Enum.__new__() : Test Coverage

2013-10-13 Thread CliffM

New submission from CliffM:

test_nonhash_value tests the lookup of an Enum Member from a value.

The current test does not exercise the iteration over values completely -- the 
if-clause being redundant wrt the existing test.

My patch adds an additional test which requires the if-clause.

--
components: Extension Modules, Tests
files: enum.patch
keywords: patch
messages: 199800
nosy: CliffM
priority: normal
severity: normal
status: open
title: Enum.py : Enum.__new__() : Test Coverage
type: enhancement
versions: Python 3.4
Added file: http://bugs.python.org/file32099/enum.patch

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue19252
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue19237] Proposal : LCM function to complement GCD

2013-10-12 Thread CliffM

New submission from CliffM:

While implementing a Least-Common-Multiple function (LCM), I noticed that 
although python has a Greatest-Common-Divisor (GCD) function in the fractions 
module, the LCM, its counterpart is not there.

I've attached a patch which implements and tests LCM in the fractions module. 

It would really need documentation, but maybe GCD and LCD should be moved to 
the math module first ?

--
components: Extension Modules
files: lcm.patch
keywords: patch
messages: 199624
nosy: CliffM
priority: normal
severity: normal
status: open
title: Proposal : LCM function to complement GCD
type: enhancement
versions: Python 3.4
Added file: http://bugs.python.org/file32068/lcm.patch

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue19237
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue19169] random.py : simple tidying

2013-10-05 Thread CliffM

New submission from CliffM:

Standardising some name-shortening in the _randbelow() method.

--
components: Extension Modules
files: shorten.patch
keywords: patch
messages: 198984
nosy: CliffM
priority: normal
severity: normal
status: open
title: random.py : simple tidying
type: enhancement
versions: Python 3.4
Added file: http://bugs.python.org/file31961/shorten.patch

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue19169
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue19121] Documentation guidelines enhancements

2013-10-05 Thread CliffM

CliffM added the comment:

Improving documentation is a fine aim.  However,  finding the correct balance 
between reference, tuition and precis (i.e. overview) is tricky.

I would like to see more documentation laid out with the code and tests.  This 
at least binds the examples with running code.

I am sure this has been asked already, but has anyone done an analysis of the 
web-server log  for the documentation sites ?

--
nosy: +CliffM

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue19121
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue19156] Enum helper functions test-coverage

2013-10-03 Thread CliffM

New submission from CliffM:

Added some tests for the _is_sunder and _is_dunder helper functions in the enum 
module.

--
components: Tests
files: enum.patch
keywords: patch
messages: 198923
nosy: CliffM
priority: normal
severity: normal
status: open
title: Enum helper functions test-coverage
type: enhancement
versions: Python 3.4
Added file: http://bugs.python.org/file31955/enum.patch

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue19156
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com