Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #74718

Re: I need an idea for practise!

Newsgroups comp.lang.python
Date 2014-07-17 20:07 -0700
References <6239bcaa-828f-499b-936d-69d022bb94ac@googlegroups.com> <467108ec-19e7-4089-8d5f-53a80244adaf@googlegroups.com> <mailman.11933.1405617616.18130.python-list@python.org> <b38e352c-e125-46ca-af04-3e0de345009a@googlegroups.com> <mailman.11974.1405649023.18130.python-list@python.org>
Message-ID <a6a835d3-e39a-4a06-b6e9-e8370152a4fd@googlegroups.com> (permalink)
Subject Re: I need an idea for practise!
From Rick Johnson <rantingrickjohnson@gmail.com>

Show all headers | View raw


On Thursday, July 17, 2014 9:03:40 PM UTC-5, Chris Angelico wrote:
> [colorizers] might well be able to *utilize* regexps [...]
> but very few modern programming languages can be fully and
> correctly defined within the limits of regexp syntax.

We're not talking about "defining" or "interpreting"
languages Chris, we're simply talking about "colorizers" --
which simply search for lexical patterns and apply *COLOR*
to the resulting matches!
    
    PAY ATTENTION!
 
> For instance, how can you recognize and thus colorize
> assignments differently from name references, to
> distinguish between "foo = 1" and "foo == 1"?

First of all, why the heck would want to colorize something
like that? And if your intention is "highlight" cases where a
programmer uses "==" in a condition, then you need to use a
"source code analyzer", like Pylint!

Secondly, as the number of colorizer targets increases, the
effectiveness of colored text decreases -- from a "human
comprehension" perspective that is. For me, only the
following targets need colorizing:

      Keywords
      Built-ins
      Terminated Strings
      Un-terminated Strings
      Comments
      Annotations
      
That's it! Anymore color and your code starts to resemble a
Pollock drip painting.

Now, finally, if you cannot write a regexp that matches:

  1. One or more alphanumeric chars(or the US) followed by
  zero or more spaces followed by two equals chars followed
  by zero or more spaces followed by one or more alphanumeric
  chars(or the US)
      
or
    
  2. One or more alphanumeric_chars(or the US) followed by
  zero or more spaces followed by one equals char followed
  by zero or more spaces, followed by one or more
  alphanumeric chars(or the US)
  
    
Then you are either joking or trolling or you need to read
the Python re docs.

    https://docs.python.org/2/library/re.html#module-re

Back to comp.lang.python | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

I need an idea for practise! Nicholas Cannon <nicholascannon1@gmail.com> - 2014-07-17 02:59 -0700
  Re: I need an idea for practise! alister <alister.nospam.ware@ntlworld.com> - 2014-07-17 10:13 +0000
  Re: I need an idea for practise! Abhiram R <abhi.darkness@gmail.com> - 2014-07-17 19:03 +0530
  Re: I need an idea for practise! Chris Angelico <rosuav@gmail.com> - 2014-07-18 00:20 +1000
  Re: I need an idea for practise! Rick Johnson <rantingrickjohnson@gmail.com> - 2014-07-17 09:34 -0700
    Re: I need an idea for practise! Chris Angelico <rosuav@gmail.com> - 2014-07-18 03:20 +1000
      Re: I need an idea for practise! Rick Johnson <rantingrickjohnson@gmail.com> - 2014-07-17 12:30 -0700
        Re: I need an idea for practise! Paul McNett <paul@mcnettware.com> - 2014-07-17 13:21 -0700
        Re: I need an idea for practise! Chris Angelico <rosuav@gmail.com> - 2014-07-18 12:03 +1000
          Re: I need an idea for practise! Rick Johnson <rantingrickjohnson@gmail.com> - 2014-07-17 20:07 -0700
            Re: I need an idea for practise! Chris Angelico <rosuav@gmail.com> - 2014-07-18 13:23 +1000
              Re: I need an idea for practise! Rick Johnson <rantingrickjohnson@gmail.com> - 2014-07-17 21:06 -0700
                Re: I need an idea for practise! Chris Angelico <rosuav@gmail.com> - 2014-07-18 16:00 +1000
    Re: I need an idea for practise! Terry Reedy <tjreedy@udel.edu> - 2014-07-17 17:46 -0400
    Re: I need an idea for practise! Chris Angelico <rosuav@gmail.com> - 2014-07-18 12:04 +1000
  Re: I need an idea for practise! Orochi <kartikjagdale11@gmail.com> - 2014-07-17 11:05 -0700
    Re: I need an idea for practise! AudreyJean <iamAudreyJean@gmail.com> - 2014-07-18 08:42 -0700
  Re: I need an idea for practise! Nicholas Cannon <nicholascannon1@gmail.com> - 2014-07-17 19:03 -0700

csiph-web