Hey Volker,

On Thursday, August 1, 2013 5:45:34 AM UTC+9, Volker Braun wrote:
>
> On Wednesday, July 31, 2013 1:45:42 AM UTC-4, Travis Scrimshaw wrote:
>
>> I don't like factory functions since you call Permutations(blah) and get 
>> an object of type Permutations_class, which make the code more difficult to 
>> understand wrt type-checking.
>>
>
> First of all you shouldn't type check.
>

   Suppose you have an object that can take a composition and a subset (say 
given as a list) as possible inputs and because you need to process them 
differently, you need to type-check unless you want the (clunky IMO) syntax 
of the user having to tell the function what the input should be 
interpreted as. Basically we programmers have to run our own scheme of 
function overloading since Python is a weakly-typed language, so 
type-checking is necessary. :-/ Although if this was done in a 
strongly-typed language, we would have to have __classcall__() return a 
subclass, which is why I'm not against changing it that way.
   My big thing is if I input Permutation(blah) via the command-line, I 
couldn't do

isinstance(x, Permutation)

in my code (prior to #14772, which BTW Simon, I think I did some slight 
abuses in #14772 and #14101 too...), but instead have to know that it's 
Permutation_class which could confuse people who don't know/haven't looked 
at the source code but understand the naming convention (it confused me).

Best,
Travis

-- 
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 http://groups.google.com/group/sage-devel.
For more options, visit https://groups.google.com/groups/opt_out.


Reply via email to