On Wed, May 4, 2016 at 4:06 PM, William Stein <wst...@gmail.com> wrote:
> On Wed, May 4, 2016 at 6:13 AM, Erik Bray <erik.m.b...@gmail.com> wrote:
> [...]
>> Anyways we can agree to disagree on this, and even within the Python
>> community you'll find different opinions, especially regarding things
>> like how much calculation should be done in the getter of a property,
>> or what kinds of exceptions should be raised.  But by and large you'll
>> find that the use of @property is considered "Pythonic", and explicit
>> mutator methods markedly less-so in *most* cases.  I feel that Sage is
>> already badly divorced from the rest of the Python community as it is.
>
> The Sage library tends to be used differently than a lot of Python
> code.    The distinction is that most Sage code is really meant to be
> used interactively from a command prompt.  This is why doctests work
> so well for us, instead of unit tests, which work much better than
> doctests for many other projects.   The typical usage pattern in Sage
> is (1) make foo, (2) foo.[tab], (3) foo.bar exists -- cool!  what does
> it do?  (4) foo.bar?.     This is dramatically different than the
> typical usage pattern of many Python libraries/programs (e.g., a
> django webserver).

That's how I try to write most code anyways, since most of the code I
write these days is for consumption of the unintentional developer.
They're "users" in so far as they only want to use my code to build
their own code to get some kind of result.  But they're still
developers because the interface I'm offering them is in the form of
objects they can manipulate using a general purpose programming
language.  It's good because it really does force you to think about
encapsulation in a practical way.  "What attributes and methods do I
want to expose?", "What are just implementation details?"

If anything I think "Pythonic" idioms work well for this kind of
usage. I don't see any contradiction here.

-- 
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.

Reply via email to