Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Python > Other notes

Reply
Thread Tools

Other notes

 
 
Mike Meyer
Guest
Posts: n/a
 
      12-30-2004
Steve Holden <(E-Mail Removed)> writes:

> Mike Meyer wrote:
>
>> Steve Holden <(E-Mail Removed)> writes:
>>

> [...]
>>>
>>>Well, perhaps you can explain how a change that's made at run time
>>>(calling the decorator) can affect the parser's compile time behavior,
>>>then. At the moment, IIRC, the only way Python code can affect the
>>>parser's behavior is in the __future__ module, which must be imported
>>>at the very head of a module.

>> By modifying the parsers grammer at runtime. After all, it's just a
>> data structure that's internal to the compiler.
>>

> But the parser executes before the compiled program runs, was my
> point. What strange mixture of compilation and interpretation are you
> going to use so the parser actually understands that ".." (say) is an
> operator before the operator definition has been executed?


Ok, current decorators won't do. Clearly, any support for adding infix
operators is going to require compiler support.

<mike
--
Mike Meyer <(E-Mail Removed)> http://www.mired.org/home/mwm/
Independent WWW/Perforce/FreeBSD/Unix consultant, email for more information.
 
Reply With Quote
 
 
 
 
Mike Meyer
Guest
Posts: n/a
 
      12-30-2004
"Terry Reedy" <(E-Mail Removed)> writes:

> "Mike Meyer" <(E-Mail Removed)> wrote in message
> news:(E-Mail Removed)...
>> Steve Holden <(E-Mail Removed)> writes:
>>> Well, perhaps you can explain how a change that's made at run time
>>> (calling the decorator) can affect the parser's compile time behavior,
>>> then. At the moment, IIRC, the only way Python code can affect the
>>> parser's behavior is in the __future__ module, which must be imported
>>> at the very head of a module.

>>
>> By modifying the parsers grammer at runtime. After all, it's just a
>> data structure that's internal to the compiler.

>
> Given that xx.py is parsed in its entirety *before* runtime, that answer is
> no answer at all. Runtime parser changes (far, far from trivial) could
> only affect the result of exec and eval.


and import. I.e., you could do:

import french
import python_with_french_keywords

<mike
--
Mike Meyer <(E-Mail Removed)> http://www.mired.org/home/mwm/
Independent WWW/Perforce/FreeBSD/Unix consultant, email for more information.
 
Reply With Quote
 
 
 
 
beliavsky@aol.com
Guest
Posts: n/a
 
      01-08-2005
Bengt Richter wrote:

>OTOH, there is precedent in e.g. fortran (IIRC) for named operators of

the
>form .XX. -- e.g., .GE. for >= so maybe there could be room for both.


Yes, but in Fortran 90 "==", ">=" etc. are equivalent to ".EQ." and
".GE.". It is also possible to define operators on native and
user-defined types, so that

Y = A .tx. B

can be written instead of the expression with the F90 intrinsic
functions

Y = matmul(transpose(A),B)

The Fortran 95 package Matran at
http://www.cs.umd.edu/~stewart/matran/Matran.html uses this approach to
simplify the interface of the Lapack library and provide syntax similar
to that of Matlab and Octave.

I don't know if the syntax of your idea clashes with Python, but it is
viable in general.

 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Lotus Notes inotes/webmail Ron P Firefox 1 08-31-2007 03:41 PM
C# 2.0 (Lotus Notes 6 & 7) Create mail document in draft folder for Lotus Notes SteveM ASP .Net 5 08-28-2007 04:16 PM
Accessing email from Notes-mail-server without Lotus Notes installed Bjorn Jensen Perl 0 03-22-2005 01:44 PM
AM-Deadlink notes MsOsWin@anon.com Firefox 0 01-13-2005 12:41 AM
Re: Other notes Jp Calderone Python 11 01-08-2005 10:55 AM



Advertisments