Discussion List Archives

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [ddlm-group] Simon's elide proposal

Dear all

Having cluttered the forum yesterday with thoughts that reflected my ignorance of python,
today it might be appropriate to summarize my position:

I recognise the need to address the issue of enabling a string containing all the CIF delimiters
to be represented in the CIF, even if this is a relatively unlikely requirement in practice.

I also believe that a line-folding protocol should be part of the specification, given that the specification
limits line length (again the need will be rare in practice).

Any mechanism to address these issues should have a minimal impact on CIF syntax.

Hence, my minimal proposal F.

James has proposed an even simpler variation: F'
\<newline> only when not preceded by \

which I prefer.


Others would prefer to adopt the syntax used by python to address these issues.

Let's assume we were starting with CIF2 that included a minimal scheme like F'.
What then would be gained by adopting the full python specification of string literals?

1) "Cleaner" presentation in the very rare cases that the eliding system would be needed in order
to accommodate delimiters within the value. This is purely a matter of taste.

2) Ability to include raw strings using the 'r' prefix. But in CIF2 as it stands, all strings are 'raw'.

Perhaps others can add to this list?

Cheers

Simon


From: Herbert J. Bernstein <yaya@bernstein-plus-sons.com>
To: Group finalising DDLm and associated dictionaries <ddlm-group@iucr.org>
Sent: Thursday, 13 January, 2011 0:58:43
Subject: Re: [ddlm-group] Simon's elide proposal

Here is a Python Idle session
>>> print """"\
"""
"
>>> print """\\"""
\
>>> print r"""\\"""
\\
>>> print """\\
"""
\

>>>

This seems to agree with most of what Simon has suggested
except the r""" gives us the ability to restore visibility
of the elides for applications that want to process them
differently.

=====================================================
Herbert J. Bernstein, Professor of Computer Science
  Dowling College, Kramer Science Center, KSC 121
        Idle Hour Blvd, Oakdale, NY, 11769

                +1-631-244-3035
                yaya@dowling.edu
=====================================================

On Wed, 12 Jan 2011, SIMON WESTRIP wrote:

> Sorry, I've just sent messages stating that my proposal doesnt fit with
> python
> in the way that elides are read - but maybe I am wrong - I will have to
> consult the python
> documentation about post-elides.
>
> Simon
>
> ____________________________________________________________________________
> From: Herbert J. Bernstein <yaya@bernstein-plus-sons.com>
> To: Group finalising DDLm and associated dictionaries <ddlm-group@iucr.org>
> Sent: Wednesday, 12 January, 2011 21:02:13
> Subject: Re: [ddlm-group] Simon's elide proposal
>
> To simplify:
>
> Under Ralf's proposal there would be two alternate elides
> for a quote mark \" or "\\n for double quote and \' or '\\n
> for single quote (pre and post elides).  Under Simon's proposal
> there would be only "\\n and '\\n (post elides).  James is
> right, either one will work, but I suspect users will find
> the pre elides easier to read.
>
> =====================================================
>   Herbert J. Bernstein, Professor of Computer Science
>     Dowling College, Kramer Science Center, KSC 121
>         Idle Hour Blvd, Oakdale, NY, 11769
>
>                   +1-631-244-3035
>                   yaya@dowling.edu
> =====================================================
>
> On Wed, 12 Jan 2011, Herbert J. Bernstein wrote:
>
> > My thanks for John for giving these translations into
> > Simon's proposal. They are similar to what we have
> > had to do for many years with the line folding protocol
> > in CIF1 and semi-colon-delimited string.
> >
> > Correcting my typos and summarizing thre first couple of
> > examples, it appears that we are being presented with the following
> choice.
> > Ralf, Simon and John, please correct me for what
> > I have misunderstood.  If I have this right, Ralf's proposal
> > seems a cleaner way to do each task, but Simon's does
> > seem able to cope.  I have verified that Simon's proposal
> > is a valid non-conflicting subset of Ralf's proposal, even
> > including the end-of-line elide to post elide the extra
> > quote marks.  All the more reason to support the proposed
> > compromise -- start with Simon's proposal and then explore
> > fully extending to the cleaner whole of Ralf's proposal.
> > Note that the r"""...""" and r'''...''' constructs would
> > do a particularly neat job of preserving elides to be
> > passed on to higher levels.
> >
> > A.  Ralf's proposal:
> >
> > One way to deliver " to an application would be """\""""
> > One way to deliver ' to an application would be '''\''''
> > An alternative, is, of course '"' in the first case, and "'"
> > in the second, but if we are working with both, as in say,
> > to deliver '"O'" to an application we could use """'"O'\""""
> > or '''\'"O'"'''
> >
> > One way to deliver \" to an application for its own elide
> > processing would be r"""\""""
> > One way to deliver \' to an application for its own elide
> > processing would be r'''\''''
> > An alternative, is, of course '\"' in the first case, and
> > "\'" in the second, but if we are working with both, as in
> > say to deliver '"O'\" to an application we could use
> > r"""'"O'\"""".
> >
> > B.  Simon's proposal
> >
> > One way to deliver " to an application would be """"\\n"""
> > One way to deliver ' to an application would be ''''\\n'''
> > An ternative is, of course '"' in the first case, and "'"
> > in the second, but is we are working with both, as in say
> > to deliver '"O'" to an application we could use
> > """'"O'"\n""" or ''''\n"I'"'''
> >
> > One way to deliver \" to an application for its own elide
> > processing would be """\\\"\\n"""
> > One way to deliver \' to an application for its own elide
> > processing would be '''\\\'\\n'''
> > An alternative, is, of course '\"' in the first case, and
> > "\'" in the second, but if we are working with both, as in
> > say to deliver '"O'\" to an application we could use
> > """'"O'\\\"\\n""".
> >
> >
> >
> > =====================================================
> > Herbert J. Bernstein, Professor of Computer Science
> >  Dowling College, Kramer Science Center, KSC 121
> >        Idle Hour Blvd, Oakdale, NY, 11769
> >
> >                +1-631-244-3035
> >                yaya@dowling.edu
> > =====================================================
> >
> > On Wed, 12 Jan 2011, Bollinger, John C wrote:
> >
> >> On Wednesday, January 12, 2011 7:39 AM, Herbert J. Bernstein wrote:
> >>
> >>> Please state the proposal F handling of the following strings, both
> syntax
> >>> and semantics, here presented in their python form
> >>
> >> I take this as a response to James's invitation, but inasmuch as he is (I
> >> hope) sleeping at the moment, I will endeavor to pick up the flag.
> >>
> >>> """\""""
> >>> '''\''''
> >>
> >> Taking the first of these as representative of this pair:
> >>
> >> This is a string containing one quote character.  The best elision under
> >> proposal F would be
> >> """"\
> >> """
> >> Easier, however, would be to write it as one of these:
> >> '"'
> >> '''"'''
> >>
> >>> r"""\"'''
> >>> r'''\''''
> >>
> >> Supposing that you mean r"""\"""" in the former case, and taking the
> second
> >> as representative of the pair:
> >>
> >> This is a string containing a backslash character followed by an
> apostrophe
> >> character.  The best proposal F elision would be
> >> '''\'\
> >> '''
> >> Simpler representations would be
> >> '\"'
> >> '''\"'''
> >>
> >>
> >>> """\
> >>> \"\
> >>> """
> >>
> >> The string contains one quote character, just like the first example. 
> The
> >> elision is therefore the same.
> >>
> >>> r"""\
> >>> \"\
> >>> """
> >>
> >> This is a string containing six characters: backslash, newline,
> backslash,
> >> quote, backslash, newline.  The best elision for this string under
> proposal
> >> F would be:
> >> """\\
> >> \\"\\
> >> """
> >> There is an equivalent form using ''', but it is no simpler.
> >>
> >>
> >> Cheers,
> >>
> >> John
> >> --
> >> John C. Bollinger, Ph.D.
> >> Department of Structural Biology
> >> St. Jude Children's Research Hospital
> >>
> >>
> >>
> >>
> >> Email Disclaimer:  www.stjude.org/emaildisclaimer
> >>
> >> _______________________________________________
> >> ddlm-group mailing list
> >> ddlm-group@iucr.org
> >> http://scripts.iucr.org/mailman/listinfo/ddlm-group
> >>
> >
> _______________________________________________
> ddlm-group mailing list
> ddlm-group@iucr.org
> http://scripts.iucr.org/mailman/listinfo/ddlm-group
>
>
_______________________________________________
ddlm-group mailing list
ddlm-group@iucr.org
http://scripts.iucr.org/mailman/listinfo/ddlm-group

Reply to: [list | sender only]
International Union of Crystallography

Scientific Union Member of the International Science Council (admitted 1947). Member of CODATA, the ISC Committee on Data. Partner with UNESCO, the United Nations Educational, Scientific and Cultural Organization in the International Year of Crystallography 2014.

International Science Council Scientific Freedom Policy

The IUCr observes the basic policy of non-discrimination and affirms the right and freedom of scientists to associate in international scientific activity without regard to such factors as ethnic origin, religion, citizenship, language, political stance, gender, sex or age, in accordance with the Statutes of the International Council for Science.