On Sat, Mar 5, 2011 at 12:26 AM, Simon King wrote:
> Hi Robert,
>
> On 4 Mrz., 22:18, Robert Bradshaw
> wrote:
>> ...
>> See the PyUnicode_IsIdentifier function.
>
> ... which soon refers to two other functions (_PyUnicode_IsXidStart
> and _PyUnicode_IsXidContinue) that test whether a character i
Hi Robert,
On 4 Mrz., 22:18, Robert Bradshaw
wrote:
> ...
> See the PyUnicode_IsIdentifier function.
... which soon refers to two other functions (_PyUnicode_IsXidStart
and _PyUnicode_IsXidContinue) that test whether a character is
acceptible at the beginning resp. in everything but the beginnin
On Fri, Mar 4, 2011 at 12:33 PM, Simon King wrote:
> Hi Robert,
>
> On 4 Mrz., 19:39, Robert Bradshaw
> wrote:
>> > How to test whether something is a valid identifier in Python3? I
>> > don't know.
>>
>> Fortunately, Python is open source :) I can't imagine it would be that
>> hard to figure out
Hi Robert,
On 4 Mrz., 19:39, Robert Bradshaw
wrote:
> > How to test whether something is a valid identifier in Python3? I
> > don't know.
>
> Fortunately, Python is open source :) I can't imagine it would be that
> hard to figure out.
I know where to find the Sage sources (although I tend to for
On Fri, Mar 4, 2011 at 12:45 AM, Simon King wrote:
> Hi Robert,
>
> On 4 Mrz., 09:30, Robert Bradshaw
> wrote:
>> So one would have to do
>>
>> alpha=var("α", validate_name=False)
>>
>> to avoid an error?
>
> Yes, that was the idea.
>
>> Also, I'd still like to avoid
>>
>> var("[]", ...)
Hi Robert,
On 4 Mrz., 09:30, Robert Bradshaw
wrote:
> So one would have to do
>
> alpha=var("α", validate_name=False)
>
> to avoid an error?
Yes, that was the idea.
> Also, I'd still like to avoid
>
> var("[]", ...)
>
> working at all. We could accept all valid Python3 identifiers, and
2011/3/4 Simon King :
> PS:
>
> On 4 Mrz., 09:06, Simon King wrote:
>> What about the following idea:
>> 1. var(s) only accept strings and lists of strings, and for backwards
>> compatibility one could also make it accept objects whose string
>> representation does not contain commas or whitespac
PS:
On 4 Mrz., 09:06, Simon King wrote:
> What about the following idea:
> 1. var(s) only accept strings and lists of strings, and for backwards
> compatibility one could also make it accept objects whose string
> representation does not contain commas or whitespace. So,
> var(QQ['t'].gen()) is
On 4 Mrz., 08:35, Jason Grout wrote:
> But you could do this:
>
> sage: alpha=var("α")
> sage: alpha
> α
Sure one could. But the point is that var is supposed to insert the
variable into the global name space, under the given name.
What about the following idea:
1. var(s) only accept strings an
On 3/4/11 12:52 AM, Simon King wrote:
Hi Robert,
On 3 Mrz., 22:48, Robert Bradshaw
wrote:
I think allowing letters like ç is just fine, what I'm opposed to is
letting our definition of valid symbol names vary from platform to
platform and local to local.
So, a useful definition would be to re
Hi Robert,
On 3 Mrz., 22:48, Robert Bradshaw
wrote:
> I think allowing letters like ç is just fine, what I'm opposed to is
> letting our definition of valid symbol names vary from platform to
> platform and local to local.
So, a useful definition would be to restrict to ASCII identifiers (no
uni
On Thu, Mar 3, 2011 at 1:23 PM, Simon King wrote:
> Hi Robert,
>
> On 3 Mrz., 20:02, Robert Bradshaw
> wrote:
>> On Thu, Mar 3, 2011 at 2:52 AM, Simon King wrote:
>> > Hi Burcin and all,
>>
>> > On 2 Mrz., 17:36, Burcin Erocal wrote:
>> >> People might want to use utf-8 strings which won't be v
Hi Robert,
On 3 Mrz., 20:02, Robert Bradshaw
wrote:
> On Thu, Mar 3, 2011 at 2:52 AM, Simon King wrote:
> > Hi Burcin and all,
>
> > On 2 Mrz., 17:36, Burcin Erocal wrote:
> >> People might want to use utf-8 strings which won't be valid under that
> >> condition. See #7496:
>
> >>http://trac.sa
> > What is needed to do in order to "localize" a regular expression?
>
> -100 for valid identifiers/sage variable names to be a function of the
> users locality.
Yeah, that could make sharing worksheets and/or code really tough.
--
To post to this group, send an email to sage-devel@googlegroup
On Thu, Mar 3, 2011 at 2:52 AM, Simon King wrote:
> Hi Burcin and all,
>
> On 2 Mrz., 17:36, Burcin Erocal wrote:
>> People might want to use utf-8 strings which won't be valid under that
>> condition. See #7496:
>>
>> http://trac.sagemath.org/sage_trac/ticket/7496
>
> I was reading in the Python
Hi Burcin and all,
On 2 Mrz., 17:36, Burcin Erocal wrote:
> People might want to use utf-8 strings which won't be valid under that
> condition. See #7496:
>
> http://trac.sagemath.org/sage_trac/ticket/7496
I was reading in the Python docs of the re module that the meaning of
\w depends on the lo
On 3 Mrz., 09:21, Simon King wrote:
> If it would work, I think the test above should be implemented as a
> function in sage.misc.defaults. In that way, it could also be used by
> normalize_variable_names.
I meant "used by sage.structure.parent_gens.normalize_names".
--
To post to this group, s
Hi Nils and all,
On 3 Mrz., 08:25, Nils Bruin wrote:
> A possibly somewhat heavyhanded approach:
>
> sage: import tokenize,StringIO
> sage: S="QQ['t'], a, a_2, for"
> sage: list((a[0],a[1]) for a in
> tokenize.generate_tokens(StringIO.StringIO(S).readline))
> [(1, 'QQ'), (51, '['), (3, "'t'"), (5
On Mar 2, 10:36 pm, Simon King wrote:
> Is there a standard Python function ("is_identifier" or so) that tests
> whether a string in whatever encoding is an identifier?
A possibly somewhat heavyhanded approach:
sage: import tokenize,StringIO
sage: S="QQ['t'], a, a_2, for"
sage: list((a[0],a[1])
Hi Jason and Robert,
On 3 Mrz., 00:36, Robert Bradshaw
wrote:
> ...
> > How about just following the Python convention for identifiers, minus the
> > keywords:
>
> >http://docs.python.org/reference/lexical_analysis.html#identifiers
>
> +1
+1
In fact this is what I meant when I wrote "alphanumer
On Wed, Mar 2, 2011 at 1:57 PM, Jason Grout wrote:
> On 3/2/11 2:37 PM, Robert Bradshaw wrote:
>>
>> On Wed, Mar 2, 2011 at 10:03 AM, D. S. McNeil wrote:
>
> For what reason is var(s) not raising an error if not s.isalnum()?
People might want to use utf-8 strings which won't be
On 3/2/11 2:37 PM, Robert Bradshaw wrote:
On Wed, Mar 2, 2011 at 10:03 AM, D. S. McNeil wrote:
For what reason is var(s) not raising an error if not s.isalnum()?
People might want to use utf-8 strings which won't be valid under that
condition.
Even "x_1" fails an alnum check.
It would mak
On Wed, Mar 2, 2011 at 10:03 AM, D. S. McNeil wrote:
>>> For what reason is var(s) not raising an error if not s.isalnum()?
>>
>> People might want to use utf-8 strings which won't be valid under that
>> condition.
>
> Even "x_1" fails an alnum check.
It would make sense to exclude some punctuati
>> For what reason is var(s) not raising an error if not s.isalnum()?
>
> People might want to use utf-8 strings which won't be valid under that
> condition.
Even "x_1" fails an alnum check.
Another issue with var is that Python allows trailing commas in the
definitions of lists, sets, and tuples
On Wed, 2 Mar 2011 06:09:30 -0800 (PST)
Simon King wrote:
> On 2 Mrz., 14:33, Florent Hivert wrote:
> > Wouldn't be better to raise an error ? Note that I can also write:
> >
> > sage: cos([]) = []
>
> The preparser does
> sage: preparse("parent([]) = []")
> '__tmp__=var("[]"); parent =
Hi Florent,
On 2 Mrz., 14:33, Florent Hivert wrote:
> Wouldn't be better to raise an error ? Note that I can also write:
>
> sage: cos([]) = []
The preparser does
sage: preparse("parent([]) = []")
'__tmp__=var("[]"); parent = symbolic_expression([]).function([])'
I find it a bit strange
26 matches
Mail list logo