Changes between Initial Version and Version 24 of Ticket #13110


Ignore:
Timestamp:
10/16/14 17:38:09 (7 years ago)
Author:
jdemeyer
Comment:

Legend:

Unmodified
Added
Removed
Modified
  • Ticket #13110

    • Property Status changed from new to needs_work
    • Property Authors changed from to Travis Scrimshaw
    • Property Component changed from numerical to coercion
    • Property Summary changed from ComplexNumber should be able to accept the Python complex type to Allow coercion complex -> CC
    • Property Milestone changed from sage-5.11 to sage-6.4
    • Property Keywords complex beginner added
  • Ticket #13110 – Description

    initial v24  
    1 `ComplexNumber` does not know how to convert from the Python `complex` type:
     1This works fine:
     2{{{
     3sage: CC(complex('13.8+6.2j'))
     413.8000000000000 + 6.20000000000000*I
     5sage: CDF(complex('13.8+6.2j'))
     613.8 + 6.2*I
     7}}}
    28
     9However, it is a ''conversion'' while it should be a ''coercion''.
    310{{{
    4 sage: ComplexNumber(complex('13.8+6.2j'))
    5 TypeError: unable to coerce to a ComplexNumber: <type 'str'>
     11sage: CC.has_coerce_map_from(complex)
     12False
    613}}}
     14This is inconsistent with
     15{{{
     16sage: CC.has_coerce_map_from(float)
     17True
     18}}}