unicode as valid naming symbols

T

Tim Chase

There is nothing useful
you can do with a name that is the U+1F4A9 character that you can't
do just as easily with alphanumeric identifiers like pile_of_poo (or
куча_фекалий if one prefers; that's auto-translated, so don't blame
me if it's a poor translation). The kinds of symbols that we're
talking about here aren't part of any writing systems, and so to
incorporate them in *names* as if they were is an abuse of Unicode.

It does get more complex though, when you could have things like

黄金屎 = "\U0001f4a9"

Like you, I don't expect to ever encounter something like this in the
wild, but they are indeed symbols used in a writing system. :)

-tkc
 
I

Ian Kelly

It does get more complex though, when you could have things like

黄金屎 = "\U0001f4a9"

Like you, I don't expect to ever encounter something like this in the
wild, but they are indeed symbols used in a writing system. :)

That's already a legal identifier, though. The constituent ideographs
are categorized as "Letter, Other", not symbols.
 
A

Antoon Pardon

Op 31-03-14 19:40, Ian Kelly schreef:
Do you think that the ability to write this would be an improvement?

import ⌺
⌚ = ⌺.╩░
⑥ = 5*⌺.⋨⋩
â¹ = â‘¥ - 1
â™…âš•âš› = [⌺.✱✳**⌺.â‡*â¹{â ª|⌚.∣} for â ª in ⌺.⣚]
⌺.˘˜¨´՛՜(♅⚕⚛)

Steven, you're killing me here; argument by analogy does not work!
[ ------ 8< ---------- ]
One of the things that Python is widely known for is its readability.
Allowing symbols such as √ to denote identifiers may be quite
expressive and appreciable to the person writing the code. However it
damages readability considerably, as seen in Steven's example above.
Personally I'm not interested in having to maintain another
programmer's code that arbitrarily uses ⌚ as a timer function, ╩ as
intersection or â–‘ as a matrix constructor.

I don't find Steven's example convincing. Sure it can be used in a way
that damages readability considerably however lots of things in python
can be abused in a way that damages readability considerably.

That you are not interested in having to maintain someone's code who
would use such symbols is irrelevant. IIRC people have used the exact
same kind of argument against decorators and the if-else operator.

It seems we are all consenting adults until someone doesn't like the
idea how it might influence his job. In that case it shouldn't be
allowed.

That was an exaggeration on my part. It wouldn't affect my job, as I
wouldn't expect to ever actually have to maintain anything like the
above. My greater point though is that it damages Python's
readability for no actual gain in my view. There is nothing useful
you can do with a name that is the U+1F4A9 character that you can't do
just as easily with alphanumeric identifiers like pile_of_poo (or
куча_фекалий if one prefers; that's auto-translated, so don't blame me
if it's a poor translation). The kinds of symbols that we're talking
about here aren't part of any writing systems, and so to incorporate
them in *names* as if they were is an abuse of Unicode.

Your argument doesn't has much weight. First of all it can be used
for just restricting names to the ascii range. Second of all I
think a good chosen symbolic name can be more readable than a
name in a character set you are not familiar with. A good chosen
symbol will evoke a meaning with a lot of people. A name in a
character set you are not familiar with is just gibberish to
you.
I don't think the comparisons to decorators and the if-else operator
are apt.

I didn't make such a comparison. I just noted the arguments against
were similar.
First, because while those may degrade readability, they do
so in a constrained way. A decorator application is just the @ symbol
and an identifier.

And if abused, can totally change the working of your function. There
is no guarantee that the function returned, has any relation with the
original function. If that can't be a night mare for readability,
I don't know what is.
The if-else is just three expressions separated by
keywords.

Yes but if used unrestrained in arbitrary expressions will make those
expressions hard to understand.
In the case of arbitrary Unicode identifiers, we're talking
about approximately doubling the number of different characters (out
of a continuously growing set) that could be used, many of which are
easily confused with other characters. Of course the potential for
confusion already exists, but that's no justification for aggravating
it.

So what if we double the number of different characters? I don't care
about the number of them, I care about how meaningful they are. And
as you say confusion is already possible. A good programmer knows
how to deal with such a possible confusion, that the number of
cases increases, doesn't need to be a problem for those that care
about this.
Second, at least in the case of decorators, while I don't dispute that
they can harm readability, I think that in the majority of cases they
actually help it.

But that is not a fair comparison now, is it. What you are doing here
is comparing actual use, to a worst case doom scenario.
 
T

Terry Reedy

Second, at least in the case of decorators, while I don't dispute that
they can harm readability, I think that in the majority of cases they
actually help it. That's because the @ syntax placed before a
function or class clearly denotes that the construct is being
decorated by something. The alternative to the syntax is to place an
assignment like "f = decorate(f)" *after* the definition, where it is
much less prominent.

Plus, it means writing and reading the name 3 times instead of 1. This
is not much of an issue for 'f', but it is for names like
'modify_x07_with_qz46pt'. Names like this occur when interfacing to
external systems that dictate the names needed (as when interfacing
Python to Objective-C on Macs).
 
T

Terry Reedy

Op 31-03-14 19:40, Ian Kelly schreef:

And if abused, can totally change the working of your function. There
is no guarantee that the function returned, has any relation with the
original function. If that can't be a night mare for readability,
I don't know what is.

This is a matter of the wrapping function, not the decorator syntax
abbreviation.

@twist_the_function_meaning
def f: return clear_expression

is no worse in this regard than the written out form

def f: return clear_expression
f = twist_the_function_meaning(f)
 
M

Marko Rauhamaa

Terry Reedy said:
@twist_the_function_meaning
def f: return clear_expression

is no worse in this regard than the written out form

def f: return clear_expression
f = twist_the_function_meaning(f)

I don't remember feeling the need for either.

I have written wrappers of all sorts, but somehow that pattern just
feels alien to me so far.


Marko
 
I

Ian Kelly

Op 31-03-14 19:40, Ian Kelly schreef:

Your argument doesn't has much weight. First of all it can be used
for just restricting names to the ascii range.

I disagree. Non-ASCII written names are useful to anybody who prefers
not to do all their programming in English.
Second of all I
think a good chosen symbolic name can be more readable than a
name in a character set you are not familiar with. A good chosen
symbol will evoke a meaning with a lot of people. A name in a
character set you are not familiar with is just gibberish to
you.

Well, this is the path taken by APL. It has its supporters. It's not
known for being readable.
I didn't make such a comparison. I just noted the arguments against
were similar.

That's the comparison to which I was referring.
And if abused, can totally change the working of your function. There
is no guarantee that the function returned, has any relation with the
original function. If that can't be a night mare for readability,
I don't know what is.

As Terry Reedy noted, this has nothing to do with the decorator
syntax, so it isn't much of an argument against having such syntax.
Yes but if used unrestrained in arbitrary expressions will make those
expressions hard to understand.

I don't disagree. I hardly ever use it myself, certainly only if it
can fit comfortably into one line, which is rare. But it's still
quite limited in syntactic scope.
So what if we double the number of different characters? I don't care
about the number of them, I care about how meaningful they are. And
as you say confusion is already possible. A good programmer knows
how to deal with such a possible confusion, that the number of
cases increases, doesn't need to be a problem for those that care
about this.

So tell me then, how would you deal with it? In the case of script
identifiers, it's often not hard to discern from context whether a
particular character is e.g. a Latin h or a Cyrillic Ò». Assuming the
original author wasn't being intentionally obfuscatory, if the rest of
the identifier is Cyrillic then the character is probably also
Cyrillic. If it's a one-character identifier, then hopefully the rest
of the module is consistent and you can guess from that. If the
identifier in question is just one symbol though, then you have a lot
less context.
But that is not a fair comparison now, is it. What you are doing here
is comparing actual use, to a worst case doom scenario.

I contend that there is no scenario with arbitrary Unicode identifiers
where readability is improved.
 
A

Antoon Pardon

I disagree. Non-ASCII written names are useful to anybody who prefers
not to do all their programming in English.

Symbols that carry a meaning among different languages are more useful
because they are meaningful to more people and so make the program
readable to more people.

Well, this is the path taken by APL. It has its supporters. It's not
known for being readable.

No that is not the path taken by APL. AFAICS identifiers in APL are just
like identifiers in python. The path taken by APL was that there were
a lot more operators available that used non-alphanumeric characters.

AFICS APL programs tend to be unreadable because they are mostly written
in a very concise style.

I think this is more the path taken by lisp-like languages where '+' is
a name just like 'alpha' or 'r2d2'. In scheme I can just do the following.

(define √ sqrt)
(√ 4)

Which will give me the normal result. Maybe I missed it but I haven't heard
scheme being called an unreadable language.

As Terry Reedy noted, this has nothing to do with the decorator
syntax, so it isn't much of an argument against having such syntax.

Point taken.
I don't disagree. I hardly ever use it myself, certainly only if it
can fit comfortably into one line, which is rare. But it's still
quite limited in syntactic scope.

Non alphanumeric characters in names is even more limited in syntatic
scope. It doesn't even play at the syntatic level but only at the lexical
level.


So tell me then, how would you deal with it? In the case of script
identifiers, it's often not hard to discern from context whether a
particular character is e.g. a Latin h or a Cyrillic Ò». Assuming the
original author wasn't being intentionally obfuscatory, if the rest of
the identifier is Cyrillic then the character is probably also
Cyrillic. If it's a one-character identifier, then hopefully the rest
of the module is consistent and you can guess from that. If the
identifier in question is just one symbol though, then you have a lot
less context.

I deal with it, just the way I deal with it now. I generally trust the
programmer to know what he is doing and to have done a good faith effort
So that I don't have to worry about him having both a variable 'NO' and 'N0'
I see no reason to be more paranoïd about this just because there are more
possibilities.
Second, at least in the case of decorators, while I don't dispute that
they can harm readability, I think that in the majority of cases they
actually help it.
I contend that there is no scenario with arbitrary Unicode identifiers
where readability is improved.

At this moment I see no reason to just accept this.
 
I

Ian Kelly

No that is not the path taken by APL. AFAICS identifiers in APL are just
like identifiers in python. The path taken by APL was that there were
a lot more operators available that used non-alphanumeric characters.

AFICS APL programs tend to be unreadable because they are mostly written
in a very concise style.

I think this is more the path taken by lisp-like languages where '+' is
a name just like 'alpha' or 'r2d2'. In scheme I can just do the following..

(define √ sqrt)
(√ 4)

You're still using the symbol as the name of an operation, though, so
I see no practical difference from the APL style. The operation just
happens to be user-defined rather than built-in. Granted that in
Scheme or in Python-with-arbitrary-Unicode-identifiers you could just
as easily name a variable √, but I don't think that is what you are
proposing in terms of choosing symbols to evoke meaning.
Which will give me the normal result. Maybe I missed it but I haven't heard
scheme being called an unreadable language.

Well, I have, but I think that usually has more to do with an excess
of parentheses.
 
M

Marko Rauhamaa

Ian Kelly said:
Well, I have, but I think that usually has more to do with an excess
of parentheses.

If you count braces as parentheses, there are about the same number of
parentheses in scheme and C:

int main()
{
printf("Hello world\n");
return 0;
}

(define (main)
(format #t "Hello world\n")
0)

C: 6
Scheme: 6


Marko
 
I

Ian Kelly

If you count braces as parentheses, there are about the same number of
parentheses in scheme and C:

int main()
{
printf("Hello world\n");
return 0;
}

(define (main)
(format #t "Hello world\n")
0)

C: 6
Scheme: 6

On the other hand, you recently posted this snippet to the list:

((let ((n 3))
(let ((f (lambda () n)))
(set! n 7)
f)))

Setting aside the fact that C doesn't have anonymous functions, I'll
approximate it as best I can:

static int n = 3;

int f()
{
return n;
}

int main()
{
n = 7;
return f();
}

C: 10
Scheme: 20
 
A

Antoon Pardon

You're still using the symbol as the name of an operation, though, so
I see no practical difference from the APL style. The operation just
happens to be user-defined rather than built-in.

Python also uses symbols for names of operations, like '+'. And when
someone suggested python might consider increasing the number of
operations and gave some symbols for those extra operations, nobody
suggested that would make python unreadable, though it would be far
more like the path taken by APL then what we are discussing now.

But the idea we are discussing here has nothing to do with introducing
more operators and use symbolic characters for that and as such wouldn't
make python more APL like. You only bring up APL because it uses a number
of unfamilar symbols and you attribute the unreadabilty of APL programs
mostly to that. But regarding the functionality we are talking here
APL doesn't have it. So we are not talking about the path taken by
APL.
 
C

Chris Angelico

Setting aside the fact that C doesn't have anonymous functions, I'll
approximate it as best I can:

static int n = 3;

int f()
{
return n;
}

int main()
{
n = 7;
return f();
}

C: 10
Scheme: 20

And the less trivial the example, the more difference you'll see. This
is Scheme inside LilyPond, a little translator that lets me input
lyrics in a tidy way that can then be turned into something that works
well with both MIDI Karaoke and printed score:

#(define (bang2slashn lst) (
cond ((null? lst) 0)
(else (begin
(if (equal? (ly:music-property (car lst) 'name) 'LyricEvent)
(let ((txt (ly:music-property (car lst) 'text)))
(if (equal? (string-ref txt 0) #\!) (begin
; Debugging display
; (display (ly:music-property (car lst) 'name)) (display "
- ") (display txt) (newline)
; Prepend a newline instead of the exclamation mark -
works for both MIDI Karaoke and page layout
(ly:music-set-property! (car lst) 'text (string-append
"\n" (substring txt 1 (string-length txt))))
))))
(bang2slashn (ly:music-property (car lst) 'elements))
(bang2slashn (cdr lst))
))
))
% Call the above recursive function
lyr=#(define-music-function (parser location lyrics) (ly:music?)
(bang2slashn (ly:music-property lyrics 'elements))
lyrics
)

Now, this was written by a non-Scheme programmer, so it's not going to
be optimal code, but I doubt it's going to lose a huge number of
parentheses. Not counting the commented-out debugging line, that's 41
pairs of them in a short but non-trivial piece of code. Translating it
to C isn't easy, in the same way that it's hard to explain how to do
client-side web form validation in Lua; but here's an attempt. It
assumes a broadly C-like structure to LilyPond (eg that the elements
are passed as a structure; they are a tree already, as you can see by
the double-recursive function above), which is of course not the case,
but here goes:

void bang2slashn(struct element *lst)
{
while (lst)
{
if (!strcmp(lst->name, "LyricEvent"))
{
char *text = music_property(lst, "text");
/* Okay, C doesn't have string manipulation, so I cheat here */
/* If this were C++ or Pike, some notation nearer to the
original would work */
if (*text == '!') music_set_property(lst, "text", "\n" + text[1..]);
}
bang2slashn(lst->elements);
lst = lst->next;
}
}

DEFINE_MUSIC_FUNCTION(PARSER_LOCATION_LYRICS, bang2slashn);


That's nine pair parens, three braces, and one square. I assume a lot
about the supposed C-like interface to LilyPond, but I think anyone
who knows both C and Scheme would agree that I haven't been
horrendously unfair in the translation. (Though I will accept an
alternate implementation of the Scheme version. If you can cut it down
to just 26 pair parens, you'll achieve the 2:1 ratio that Ian
mentioned. And if you can cut it down to 13 pairs, you've equalled my
count.) The only way to have the C figure come up approximately equal
is to count a semicolon as if it were a pair of parens - Scheme has an
extra set of parens doing the job of separating one function call from
another. But that adds only another 5, bringing C up to a total of 18
(plus a few more if I used functions to do my string manipulation, so
let's say about 20-25) where Scheme is still at roughly twice that.

ChrisA
 
C

Chris Angelico

Python also uses symbols for names of operations, like '+'. And when
someone suggested python might consider increasing the number of
operations and gave some symbols for those extra operations, nobody
suggested that would make python unreadable, though it would be far
more like the path taken by APL then what we are discussing now.

Actually, people did. But mainly the thread (look up "Time we switched
to unicode?") went off looking at how hard it'd be to type those
operators, and therefore the more serious point that there would
either be hard-to-type language elements or duplicate syntactic tokens
("lambda" as well as "λ", etc). That isn't an issue with names,
because any name has only one, well, name. If you choose to use both
"alpha" and "α" as names, that's fine, and they're distinct names. You
can make your code unreadable, and it doesn't impact my code at all.
Language-level features like operators have stronger concerns.

But because, in the future, Python may choose to create new operators,
the simplest and safest way to ensure safety is to put a boundary on
what can be operators and what can be names; Unicode character classes
are perfect for this. It's also possible that all Unicode whitespace
characters might become legal for indentation and separation (maybe
they are already??), so obviously they're ruled out as identifiers;
anyway, I honestly do not think people would want to use U+2007 FIGURE
SPACE inside a name. So if we deny whitespace, and accept letters and
digits, it makes good sense to deny mathematical symbols so as to keep
them available for operators. (It also makes reasonable sense to
*permit* mathematical symbols, thus allowing you to use them for
functions/methods, in the same way that you can use "n", "o", and "t",
but not "not"; but with word operators, the entire word has to be used
as-is before it's a collision - with a symbolic one, any instance of
that symbol inside a name will change parsing entirely. It's a
trade-off, and Python's made a decision one way and not the other.)

ChrisA
 
A

Antoon Pardon

But because, in the future, Python may choose to create new operators,
the simplest and safest way to ensure safety is to put a boundary on
what can be operators and what can be names; Unicode character classes
are perfect for this. It's also possible that all Unicode whitespace
characters might become legal for indentation and separation (maybe
they are already??), so obviously they're ruled out as identifiers;
anyway, I honestly do not think people would want to use U+2007 FIGURE
SPACE inside a name. So if we deny whitespace, and accept letters and
digits, it makes good sense to deny mathematical symbols so as to keep
them available for operators. (It also makes reasonable sense to
*permit* mathematical symbols, thus allowing you to use them for
functions/methods, in the same way that you can use "n", "o", and "t",
but not "not"; but with word operators, the entire word has to be used
as-is before it's a collision - with a symbolic one, any instance of
that symbol inside a name will change parsing entirely. It's a
trade-off, and Python's made a decision one way and not the other.)

This mostly makes sense to me. The only caveat I have is that since we
also allow _ (U+005F LOW LINE) in names which belongs to the category
<puctuation, connector>, we should allow other symbols within this
category in a name.

But I confess that is mostly personal taste, since I find names_like_this
ugly. Names-like-this look better to me but that wouldn't be workable
in python. But maybe there is some connector that would be aestetically
pleasing and not causing other problems.
 
M

Marko Rauhamaa

Ian Kelly said:
Setting aside the fact that C doesn't have anonymous functions, I'll
approximate it as best I can:

[...]

C: 10
Scheme: 20

It is true that scheme needs parentheses for operators and assignments
so the ratio is probably in the order of 2:1. Whether that is excess or
not is a matter of taste.

For example:

========================================================================
#include<stdio.h>

int main()
{
int n, i = 3, count, c;

printf("Enter the number of prime numbers required\n");
scanf("%d",&n);

if ( n >= 1 )
{
printf("First %d prime numbers are :\n",n);
printf("2\n");
}

for ( count = 2 ; count <= n ; )
{
for ( c = 2 ; c <= i - 1 ; c++ )
{
if ( i%c == 0 )
break;
}
if ( c == i )
{
printf("%d\n",i);
count++;
}
i++;
}

return 0;
}
========================================================================
(<URL: http://www.programmingsimplified.com/c/source-code/
c-program-for-prime-number>)

is rendered in scheme as follows:

========================================================================
(define (main)
(format #t "Enter the number of prime numbers required\n")
(let ((n (read)))
(if (>= n 1)
(begin
(format #t "First ~S prime numbers are :\n" n)
(format #t "2\n")))
(let display-primes ((count 2) (i 3))
(if (<= count n)
(let find-divisor ((c 2))
(cond
((= c i)
(format #t "~S\n" i)
(display-primes (1+ count) (1+ i)))
((= (remainder i c) 0)
(display-primes count (1+ i)))
(else
(find-divisor (1+ c)))))))))

(main)
========================================================================

The scheme translation has 37 parenthesis pairs, while the C version has
16. Which one is easier on the eye?


Marko
 
R

Roy Smith

Antoon Pardon said:
This mostly makes sense to me. The only caveat I have is that since we
also allow _ (U+005F LOW LINE) in names which belongs to the category
<puctuation, connector>, we should allow other symbols within this
category in a name.

But I confess that is mostly personal taste, since I find names_like_this
ugly. Names-like-this look better to me but that wouldn't be workable
in python. But maybe there is some connector that would be aestetically
pleasing and not causing other problems.

Semi-seriously, let me suggest (names like this). It's not valid syntax
now, so it can't break any existing code. It reuses existing
punctuation in a way which is a logical extension of its traditional
meaning, i.e. "group these things together".
 
C

Chris Angelico

========================================================================
#include<stdio.h>

int main()
{
int n, i = 3, count, c;

printf("Enter the number of prime numbers required\n");
scanf("%d",&n);

if ( n >= 1 )
{
printf("First %d prime numbers are :\n",n);
printf("2\n");
}

for ( count = 2 ; count <= n ; )
{
for ( c = 2 ; c <= i - 1 ; c++ )
{
if ( i%c == 0 )
break;
}
if ( c == i )
{
printf("%d\n",i);
count++;
}
i++;
}

return 0;
}
========================================================================
(<URL: http://www.programmingsimplified.com/c/source-code/
c-program-for-prime-number>)

Here's my tweaked version of that:

========================================================================
#include <stdio.h>

int main()
{
int i = 3, count, factor;

printf("Enter the number of prime numbers required\n");
scanf("%d",&count);

if ( count >= 1 )
{
printf("First %d prime numbers are:\n",count);
printf("2\n");
}

while (count > 1)
{
/* This is a pretty stupid algorithm */
for ( factor = 2 ; factor <= i - 1 ; factor++ )
if ( i%factor == 0 ) break;
if ( factor == i )
{
printf("%d\n",i);
count--;
}
i++;
}

return 0;
}
========================================================================

Doesn't change the parenthesis count (other than that I dropped an
unnecessary pair of braces; some people would prefer to keep them, but
I find they're quite superfluous), but improves readability. (Why use
a for loop when you could use a simple while?) As to the question of
whether this is more or less readable than the Scheme version... I
guess that partly depends on the reader's relative familiarity with C
and Scheme, but it's crystal clear to me what the C version is doing -
and that it's doing something stupid. I don't find it more readable to
cast something as recursive; compare these two tight loops:

(let find-divisor ((c 2))
(cond
((= c i)
(format #t "~S\n" i)
(display-primes (1+ count) (1+ i)))
((= (remainder i c) 0)
(display-primes count (1+ i)))
(else
(find-divisor (1+ c)))))))))

for ( factor = 2 ; factor <= i - 1 ; factor++ )
if ( i%factor == 0 ) break;
if ( factor == i )
{
printf("%d\n",i);
count--;
}

In the first one, you start doing something, and if you don't have a
termination point, you recurse - which means you have to name this
loop as a function. In the second, you simply iterate, and then at the
end, decide whether you have the termination condition or not. It's
easy to see what the loop condition is; it's easy to see that it will
always end by one or other termination rule, and then it acts based on
that. Actually, if you switch the conditions, it would look a bit more
like the Scheme version:

for ( factor = 2 ; i%factor ; factor++ )
{
if ( factor == i )
{
printf("%d\n",i);
count--;
break;
}
}

I wouldn't say this makes the code notably more readable, and it
doesn't change the parenthesis count (apart from making more people
want to put the outer braces in - they're still technically optional,
and that was only an optional reduction in the first place), but it's
a closer equivalent and that might make comparison easier.

My view is definitely that the C version is WAY more readable than the
Scheme one.

ChrisA
 
C

Chris Angelico

This mostly makes sense to me. The only caveat I have is that since we
also allow _ (U+005F LOW LINE) in names which belongs to the category
<puctuation, connector>, we should allow other symbols within this
category in a name.

But I confess that is mostly personal taste, since I find names_like_this
ugly. Names-like-this look better to me but that wouldn't be workable
in python. But maybe there is some connector that would be aestetically
pleasing and not causing other problems.

That's reasonable. The Pc category doesn't have much in it:

http://www.fileformat.info/info/unicode/category/Pc/list.htm

If the definition of "characters permitted in identifiers" is derived
exclusively from the Unicode categories, including Pc would make fine
sense. Probably the definition should be: First character is L* or Pc,
subsequent characters are L*, N*, or Pc, and either Mn or M*
(combining characters). Or something like that.

ChrisA
 
C

Chris Angelico

Semi-seriously, let me suggest (names like this). It's not valid syntax
now, so it can't break any existing code. It reuses existing
punctuation in a way which is a logical extension of its traditional
meaning, i.e. "group these things together".

I'd really rather not have a drastically different concept of "name"
to every other language's definition! Reading over COBOL code is
confusing in ways that reading, say, Ruby code isn't; the ? and !
suffixes aren't nearly as confusing as:

http://www.math-cs.gordon.edu/courses/cs323/COBOL/cobol.html
"""
COBOL identifers are 1-30 alphanumeric characters, at least one of
which must be non-numeric.
In certain contexts it is permissible to use a totally numeric
identifier; however, that usage
is discouraged. Hyphens may be included in an identifier anywhere
except the first of last
character.
"""

Hyphens in names! Ugh! That means subtraction! :)

But there is a solution! You can have *anything you want* in your
identifiers. Watch:

v = {}

v["names like this"] = 42
print(v["names like this"])

Yes, that's a five-character delimiter/marker. But it works!!

ChrisA
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,995
Messages
2,570,228
Members
46,817
Latest member
AdalbertoT

Latest Threads

Top