Python Forum
language feature i'd like to have
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
language feature i'd like to have
#1
ages ago i wrote a macro system for IBM mainframe S/360 S/370 assembler language. one of its features was if you wanted to do a comparison for either an if test or a loop test, you could express the two data sources once, then simply express one data source thereafter and each comparison with one source would insert assembler code as if it were coded with two sources, using the missing source position from the previous comparison. i'd like to see something like that in Python.
    if data_array[data_index[usage_factor[1]]] == '(':
        ...
    elif == ')':
        ...
    elif == '|':
        ...
    else:
        ...
because of the way conditionals were separated from code structures in the system i created in that macro language, this feature could also be used on complex loops. i have heard that Python has some kind of redundancy reduction in comparisons but i have been unable to find it. so maybe this would be useful.
    if data_array[data_index[usage_factor[1]]] == '(' == 'a' or == 'b' or == 'c':
        ...
    else:
        ...
thoughts?

* Skaperen ducks behind the red couch
Tradition is peer pressure from dead people

What do you call someone who speaks three languages? Trilingual. Two languages? Bilingual. One language? American.
Reply
#2
that is virtually switch/case statement disguised as if...else
same reasoning apply https://www.python.org/dev/peps/pep-3103/
Reply
#3
Please stop trying to uglify (new word) python. Python is python, not 'C'.
Reply
#4
then i guess i need to ask if some idea makes ugly or non-pythonic code. so it is not ugly if a complicated expression is repeated, or do i need to do the detail work myself of "caching" it in another variable myself? a compiler or interpreter can detect that the expression is the same and has no side effects and cache it itself but readers of the code then have to visually compare each expression to be sure there is no subtle difference. at least in assembly language we had no complex expressions. but i am now long past assembly language (it wasn't very portable) and more oriented to code readability and abstract expression (and hopefully, portable).
Tradition is peer pressure from dead people

What do you call someone who speaks three languages? Trilingual. Two languages? Bilingual. One language? American.
Reply
#5
A long time ago (2004), there was an innovative python module named "logix". With it, the very syntax of the language could be modified easily. I guess it won't run on any modern python interpreter but I have kept three links that could be of interest for you link1 link2 link3
Reply
#6
interesting. i have to find some more time to do some reading. can you guys push stuff westward to help extend the time the earth rotates?
Tradition is peer pressure from dead people

What do you call someone who speaks three languages? Trilingual. Two languages? Bilingual. One language? American.
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  Is python an interpreted language or a compiled language? GouravDas 1 1,983 Jun-23-2020, 10:38 AM
Last Post: Gribouillis

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020