On Sat, Aug 29, 2009 at 10:10 AM, Jason Grout
<jason-s...@creativetrax.com>wrote:

>
> Fredrik Johansson wrote:
> > Hi,
> >
> > How about supporting n! as a shortcut for factorial(n)? This syntax is
> > very convenient and makes a huge difference for combinatorial
> > expressions with many factorials. M&M (Maple & Mathematica) allow this
> > notation, as do many scientific calculators.
> >
> > Although Python doesn't have any other postfix operators, I don't
> > think there's any ambiguity as ! is unused in Python except for the !=
> > operator. The worst I can come up with is x!=y, but given that =
> > denotes assignment and not equality, this still only has one possible
> > meaning.
> >
>
>
> In an attempt to find places that "!" could be used, I found the
> following interesting thing.
>
> sage: var('x!')
> x!
> sage: _^2
> x!^2
> sage: x!
> ------------------------------------------------------------
>    File "<ipython console>", line 1
>      x!
>       ^
> SyntaxError: invalid syntax
>
>
> Maybe Sage symbolic variables should be restricted to identifiers that
> are legal in python...


Yes, definitely +1 to that.  I think this used to be the case at some point.

William

--~--~---------~--~----~------------~-------~--~----~
To post to this group, send an email to sage-devel@googlegroups.com
To unsubscribe from this group, send an email to 
sage-devel-unsubscr...@googlegroups.com
For more options, visit this group at http://groups.google.com/group/sage-devel
URLs: http://www.sagemath.org
-~----------~----~----~----~------~----~------~--~---

Reply via email to