Yooooooooo !

> Don't overload functions by return type. This is generally a bad idea.

Having general ideas is also a bad idea in general.

> If
> designs.orthogonal_array doesn't return some kind of array then it is
poorly
> named. Use three different functions, e.g. orthogonal_array() /
> is_constructible() / size_of_array()
>
> This basic design pattern also fixes your caching problem.

Yes, but it duplicates the code horribly. Because orthogonal_array is a
long sequence of tests and answers,and you do not want to find this long
collection of tests and answers copied and pasted into three different
functions, nor to find out that "for some reason" they are not always
consistent with each other.

More precisely :

> designs.orthogonal_array doesn't return some kind of array then it is
poorly named

No. Because if you want to build orthogonal arrays, you *will* find a
function named orthogonal_array. You may not find a function named
size_of_maximal_orthogonal_array.

Besides, this is pretty clear :

sage: designs.orthogonal_array(4,3,existence=True)
True

By the way, I love how nobody has a problem with

sage: designs.OrthogonalArray(4,3).exists()
True
sage: designs.OrthogonalArray(4,3).matrix()
BigMatrix

while on the other hand

sage: designs.orthogonal_array(4,3,existence=True)
True
sage: designs.orthogonal_array(4,3)
BigMatrix

is "clearly bad design". Come on guys, we write Python code ! The point is
not only to make our code dead slow, it is ALSO to use the advantages of
the language. Stop writing Java and C wrapped in Python ! Do you complain
when "wc -l" returns an integer and "wc" returns three integers and a
filename ? Do you prefer wc.complete_info() and
wc.just_the_number_of_lines() ?

Anyway, my question still stands. And if it does not seem "realistic", you
can imagine I hid the truth and asked "How can I only cache output when the
integer input is small, and not cache it otherwise" ?

... as this is a more "technically acceptable question" :-P

Nathann

-- 
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/d/optout.

Reply via email to