If no coercion is currently known, then coerce_map_from() calls _coerce_map_from_(). If _coerce_map_from_() returns a map, then that map becomes the coercion map. If it simply returns True, then the coercion map is constructed by using _element_constructor_() as the definition of the map. In either case, a coercion map is constructed and stored.
For has_coerce_map_from(), it simply checks if there is a coercion map (and constructs one if had not previously been constructed). So it always returns a boolean. Best, Travis On Thursday, January 5, 2017 at 4:39:34 AM UTC-6, Marc Mezzarobba wrote: > > Travis Scrimshaw wrote: > > That is not true. Note that Foo.has_coerce_map_from() is not > > Foo._coerce_map_from_(). The method has_coerce_map_from() calls > > _coerce_map_from_, which should either return a coercion map or True, > > and in the latter case, then it uses Foo(bar) to define the coercion > > (which really uses _element_constructor_). What has_coerce_map_from() > > does is it checks to see if _coerce_map_from_() returns something that > > is not False (or perhaps None, I forget off-hand). > > Sorry, I don't understand what you mean. As far as I can see, > has_coerce_map_from() calls _internal_coerce_map_from(), which first > looks in _coerce_from_hash and only then, if nothing is found, calls > discover_coerce_map_from() which eventually calls _coerce_map_from_(). > But _coerce_from_hash is also affected by _populate_coercion_lists_(), > via register_coercion(). > > -- > Marc > > -- 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.