Skip to main content

A programming language that transpiles to python.

Project description

ColonPython

A programming language that transpiles to python. It has extremely similar syntax, but you are also able to call functions with only one argument using a colon (:) using the following syntax:

function:argument

This allows for statements such as this in ColonPython:

print:"hello"

or:

str:1234

It allows you to call single-argument functions whilst shortening the time it takes to write them.

To use ColonPython, first install it using:

pip3 install colonpython

Then, to use it in your program, create a new python file and before putting in any code write:

import colonpython

Please note that sometimes Python will detect what it thinks are syntax errors, even though the code will run. This means that some things are not possible. This problem has caused this project to split into two. ColonPython and ArrowPython. ColonPython is this project: adding a way to call functions with an argument using a colon (:), and is used by importing the module and running the code in the file. As python identifies incorrect python syntax before runtime and raises errors, ArrowPython intead lets you run code on external files. It has more non-Python features. If I could use them in the same was as ColonPython, I would, but I cannot as far as I am aware.

Sometimes, you may run into issues. The following code will run fine:

indexes = ("hello", "world")

print(indexes[0:1]) # This returns the string "hello".

However, the following code will not:

indexes = ("hello", "world")

start = 0
end = 1

print(indexes[start:end]) # Raises error.

Because of this I would reccomend the following:

indexes = ("hello", "world")

start = 0
end = 1

print(indexes[slice(start:end)]) # Does not raise an error, returns the string "hello".

With that out of the way, this is an example of the popular FizzBuzz program in ColonPython:

import colonpython

def fizbuzz:num:
    for fizzbuzz in range:num:
        if fizzbuzz % 3 == 0 and fizzbuzz % 5 == 0:
            print:"fizzbuzz"
            continue
        elif fizzbuzz % 3 == 0:
            print:"fizz"
            continue
        elif fizzbuzz % 5 == 0:
            print:"buzz"
            continue
        print:fizzbuzz

fizbuzz:51

Have fun coding!

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

colonpython-0.0.1.tar.gz (3.4 kB view details)

Uploaded Source

Built Distribution

colonpython-0.0.1-py3-none-any.whl (3.6 kB view details)

Uploaded Python 3

File details

Details for the file colonpython-0.0.1.tar.gz.

File metadata

  • Download URL: colonpython-0.0.1.tar.gz
  • Upload date:
  • Size: 3.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.11.2

File hashes

Hashes for colonpython-0.0.1.tar.gz
Algorithm Hash digest
SHA256 6f187b2aa534891e69cb9d36fe74023c2ec0926f88b049bcdfea52cee6546a74
MD5 c93ab027bcd6f40a17b80231c98e67af
BLAKE2b-256 ccb3de5da8eedee74062aa8d434f93015cd7effbcb96fb308153c72129101249

See more details on using hashes here.

File details

Details for the file colonpython-0.0.1-py3-none-any.whl.

File metadata

  • Download URL: colonpython-0.0.1-py3-none-any.whl
  • Upload date:
  • Size: 3.6 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.11.2

File hashes

Hashes for colonpython-0.0.1-py3-none-any.whl
Algorithm Hash digest
SHA256 0266cebf83d0ad9d5edc1b422ab271d11e82782b3b419b45decdd459f50e4974
MD5 8dbc863ba46c4d66692eae12dd03a5b9
BLAKE2b-256 e91b7c5864b333b8fabff60c36406eb69a924e596631a1dc10133962c771284a

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page