[sage-devel] Re: Can I clean up this copy pasted code? #23703

2017-08-25 Thread Simon Brandhorst
Thank you I was not aware of that.
Supporting my expectation: https://trac.sagemath.org/ticket/5525 
is the same bug in free_modules which was fixed 8! years ago. 

So I guess we should really clean up free_quadratic_module.py.
Is there a reason for all this copy pasting?

On Friday, August 25, 2017 at 10:37:37 AM UTC+2, Frédéric Chapoton wrote:
>
> Sorry, I was thinking to #23646
>
> Le vendredi 25 août 2017 10:35:59 UTC+2, Frédéric Chapoton a écrit :
>>
>> Beware the comparion in the modules folder has been recently cleaned-up 
>> for py3 compatibility in https://trac.sagemath.org/ticket/23251
>>
>> Do not do anything on that until this ticket is merged in the next beta 
>> release of sage.
>>
>> Frederic
>>
>> Le vendredi 25 août 2017 09:52:32 UTC+2, Simon Brandhorst a écrit :
>>>
>>> From sage.modules.free_module.py there is some code copy pasted to
>>> sage.modules.free_quadratic_module.py.
>>>
>>> One instance is the 
>>>
>>> class FreeQuadraticModule_submodule_with_basis_pid(
>>> free_module.FreeModule_submodule_with_basis_pid, 
>>> FreeQuadraticModule_generic_pid)
>>>
>>> where the __cmp__ method is copy pasted from its super class
>>> free_module.FreeModule_submodule_with_basis_pid
>>> well except for one line (checking the base rings). This missing line 
>>> causes some bugs. trac: #23703 
>>>
>>> So I expect that 
>>> free_module.FreeModule_submodule_with_basis_pid.__cmp__ had some bug and 
>>> it got fixed but that was after it was copy pasted. 
>>>
>>> That sounds pretty horrible to me. 
>>>
>>> So here is the question:
>>> Was the method __cmp__ copy pasted for a good reason?
>>>
>>> I see 3 possible fixes for my ticked:
>>>
>>> a) copy paste the missing line too :(
>>>
>>> b) delete the __cmp__ method completely so that it is inherited instead. 
>>> Not sure if this can cause trouble?
>>>
>>> c) rewrite the __cmp__ method to call explicitly 
>>> super(FreeModule_submodule_with_basis_pid,self).__cmp__()
>>>
>>>

-- 
You received this message because you are subscribed to the Google Groups 
"sage-devel" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to sage-devel+unsubscr...@googlegroups.com.
To post to this group, send email to sage-devel@googlegroups.com.
Visit this group at https://groups.google.com/group/sage-devel.
For more options, visit https://groups.google.com/d/optout.


[sage-devel] Re: Can I clean up this copy pasted code? #23703

2017-08-25 Thread Frédéric Chapoton
Sorry, I was thinking to #23646

Le vendredi 25 août 2017 10:35:59 UTC+2, Frédéric Chapoton a écrit :
>
> Beware the comparion in the modules folder has been recently cleaned-up 
> for py3 compatibility in https://trac.sagemath.org/ticket/23251
>
> Do not do anything on that until this ticket is merged in the next beta 
> release of sage.
>
> Frederic
>
> Le vendredi 25 août 2017 09:52:32 UTC+2, Simon Brandhorst a écrit :
>>
>> From sage.modules.free_module.py there is some code copy pasted to
>> sage.modules.free_quadratic_module.py.
>>
>> One instance is the 
>>
>> class FreeQuadraticModule_submodule_with_basis_pid(
>> free_module.FreeModule_submodule_with_basis_pid, 
>> FreeQuadraticModule_generic_pid)
>>
>> where the __cmp__ method is copy pasted from its super class
>> free_module.FreeModule_submodule_with_basis_pid
>> well except for one line (checking the base rings). This missing line 
>> causes some bugs. trac: #23703 
>>
>> So I expect that 
>> free_module.FreeModule_submodule_with_basis_pid.__cmp__ had some bug and 
>> it got fixed but that was after it was copy pasted. 
>>
>> That sounds pretty horrible to me. 
>>
>> So here is the question:
>> Was the method __cmp__ copy pasted for a good reason?
>>
>> I see 3 possible fixes for my ticked:
>>
>> a) copy paste the missing line too :(
>>
>> b) delete the __cmp__ method completely so that it is inherited instead. 
>> Not sure if this can cause trouble?
>>
>> c) rewrite the __cmp__ method to call explicitly 
>> super(FreeModule_submodule_with_basis_pid,self).__cmp__()
>>
>>

-- 
You received this message because you are subscribed to the Google Groups 
"sage-devel" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to sage-devel+unsubscr...@googlegroups.com.
To post to this group, send email to sage-devel@googlegroups.com.
Visit this group at https://groups.google.com/group/sage-devel.
For more options, visit https://groups.google.com/d/optout.


[sage-devel] Re: Can I clean up this copy pasted code? #23703

2017-08-25 Thread Frédéric Chapoton
Beware the comparion in the modules folder has been recently cleaned-up for 
py3 compatibility in https://trac.sagemath.org/ticket/23251

Do not do anything on that until this ticket is merged in the next beta 
release of sage.

Frederic

Le vendredi 25 août 2017 09:52:32 UTC+2, Simon Brandhorst a écrit :
>
> From sage.modules.free_module.py there is some code copy pasted to
> sage.modules.free_quadratic_module.py.
>
> One instance is the 
>
> class FreeQuadraticModule_submodule_with_basis_pid(
> free_module.FreeModule_submodule_with_basis_pid, 
> FreeQuadraticModule_generic_pid)
>
> where the __cmp__ method is copy pasted from its super class
> free_module.FreeModule_submodule_with_basis_pid
> well except for one line (checking the base rings). This missing line 
> causes some bugs. trac: #23703 
>
> So I expect that 
> free_module.FreeModule_submodule_with_basis_pid.__cmp__ had some bug and 
> it got fixed but that was after it was copy pasted. 
>
> That sounds pretty horrible to me. 
>
> So here is the question:
> Was the method __cmp__ copy pasted for a good reason?
>
> I see 3 possible fixes for my ticked:
>
> a) copy paste the missing line too :(
>
> b) delete the __cmp__ method completely so that it is inherited instead. 
> Not sure if this can cause trouble?
>
> c) rewrite the __cmp__ method to call explicitly 
> super(FreeModule_submodule_with_basis_pid,self).__cmp__()
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"sage-devel" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to sage-devel+unsubscr...@googlegroups.com.
To post to this group, send email to sage-devel@googlegroups.com.
Visit this group at https://groups.google.com/group/sage-devel.
For more options, visit https://groups.google.com/d/optout.