We are currently working on new rules for what content should and shouldn't be allowed on this website, and are looking for feedback! See Esolang:2026 topicality proposal to view and give feedback on the current draft.

pythOwO

From Esolang
Jump to navigation Jump to search
This article is not detailed enough and needs to be expanded. Please help us by adding some more information.
pythOwO
Paradigm(s) imperative
Designed by virejdasani
Appeared in 2022
Type system duck, dynamic
Memory system variable-based
Computational class Turing complete
Reference implementation pythOwO
Major implementations PythOwOn-cpp
Influenced by Python
File extension(s) .pyowo

pythOwO (or pythOwOn) is a programming language with UwU syntax made by virejdasani in 2022 inspired by a Reddit post from r/ProgrammerHumor.[1]

Syntax

Despite being intended as an UwUfied derivative of Python, pythOwO's syntax is more like BASIC, using uppercase keywords everywhere instead of indentation and lowercase keywords. (See § Criticism)

In pythOwO, most constructs are expressions that return a value, other than WETURN (return), BWEAK (break), and CONTINUWU (continue) which are all considered statements.[2]

Expressions

This section is not detailed enough and needs to be expanded. Please help us by adding some more information.

Expressions in pythOwO are mostly the same as Python expressions, with the exception of augmented assignment operators being missing and IF, WHILE, FOR, FWUNCTION, and pwease being expressions.

Variables

Variables are defined with pwease name = value and are assigned to the same way as in other non-esoteric languages with variable = new_value.

pwease pie = 4 # enginewu lowogic
# cowwect pie vawue
pie = 3.14

Functions

Functions are defined with the following syntax:

FWUNCTION name(param1, param2, param3)
    <statements>
END

The newline after the parameter list is necessary and not having it will result in a syntax error.

The function name may be omitted, resulting in an anonymous function.[3]

Additionally, single-expression functions can be made by replacing the newline after the parameter list with -> and omitting the END keyword.

Control flow

If/elif/else in pythOwO looks like this:

IF <condition> THWEN
    <insert statements here>
EWIF <condition> THWEN
    <insert statements here>
EWSE
    <insert statements here>
END

EWIF is completely optional and an if/elif/else expression may have multiple EWIF branches.

While loops can be done with a block body using the below syntax:

WHILE <condition> THWEN
    <statements>
END

Or with a single-line syntax by not having a newline after the THWEN keyword, as shown below.

pwease i = 0
WHILE i < 10 THWEN i = i + 1

For loops can be done with:

FOR <var> = <start value> TO <end value> THWEN
    <statements>
END

Just like while loops, the newline after THWEN and the END keyword may be omitted for a single-statement body. Additionally, a loop parameter STWEP may be specified after the end value with STWEP <step value>. This specifies the increment/decrement of the iteration variable.

Built-ins

pythOwO has a handful of built-ins borrowed from davidcallanan/py-myopl-code.

Constants
Constants Value Description
nwull 0[4] "Null"[4] value.
twue 1[4] Truthy value.
fawse 0[4] Falsy value.
mwath_pwi Approximation of the mathematical constant (3.14159265358979...) A function that runs a file at the path.
Functions
Function Parameters Action
pwint any value Prints the argument to standard output.
pwint_ret any value Converts the value into a string.
inpwt none Receives a string from the user.
inpwt_int none Receives an integer from the user. If the user inputted an invalid integer, an error is thrown.
cwear and cls none Clears standard output.
is_nwm any value Returns twue if the value is a number.
is_stwr any value Returns twue if the value is a string.
is_wist any value Returns twue if the value is a list.
is_fwn any value Returns twue if the value is a function.
appwend list, any value Appends a value to a list.
pwp list, index (number) Removes the element at position index from the list. Errors if the index is out of bounds.
extwend list, list Appends all of the values from the second list to the first list.
lwen list Returns the length of the list.
rwun file path (string) Runs the file at the specified path.

Criticism

PythOwO is criticized for not being Pythonic enough, if at all — the syntax resembles BASIC instead of Python as keywords are all capitalized and the off-side rule does not exist.

Using the truth machine example listed in the Examples section below, a more Pythonic implementation of pythOwO would look like this:

pwease inpuwut = inpwt()
if inpuwut == "twue" thwen
    while Twue do
         pwint("UwU")
ewif inpuwut == "fawse" thwen
    pwint("OwO")
ewse
    pwint("UwU invawid inpuwut!")

Here is another example with the Fibonacci sequence example.

fuwunction fibonacci(n)
    if n < 2 thwen
        wetuwurn 1
    ewse
        wetuwurn fibonacci(n - 1) + fibonacci(n - 2)

pwease fib_num = inpwt_int()

pwint(fibonacci(fib_num))

Additionally, the reference implementation is just a fork of davidcallanan/py-myopl-code but UwUfied and the official repository admits it.[5]

Examples

Hello world

This program prints "Hewwo Wowrld!" to the standard output.

pwint("Hewwo Wowrld!")

(Fake) ternary operator

pythOwO doesn't have a ternary operator, but IF/EWIF/EWSE is an expression.

pwease tehe = 500
pwease var = IF tehe == 501 THWEN "tehe is 501" EWIF tehe == 500 THWEN "tehe is 500" EWSE "tehe is not 500 or 501"
pwint(var)

Outpuwut:

tehe is 500

Functions

The code is bad for the purpose of showing multi-statement function bodies.

FWUNCTION say(inpuwut)
    IF inpuwut == 1 THWEN
        pwint("UwU")
        WETURN 0
    END
    IF inpuwut == 2 THWEN
        pwint("OwO")
        WETURN 1
    END
    pwint("TwT")
    WETURN 2
END

say(1) # UwU
say(2) # OwO
say(2147483647) # TwT

Truth Machine

pwease inpuwut = inpwt() # receives stwing
IF inpuwut == "twue" THWEN
    WHILE twue THWEN
        pwint("UwU")
    END
EWIF inpuwut == "false" THWEN
    pwint("OwO")
EWSE
    pwint("OwO invawid inpuwut!")
END

Fibonacci sequence

This uses a single-expression function. This works because IF-EWIF-EWSE is an expression, unlike in other languages where it is a statement.

FWUNCTION fibonacci(n) ->
    IF n < 2 THWEN
        WETURN 1
    EWSE
        WETURN fibonacci(n - 1) + fibonacci(n - 2)
    END

pwease fib_num = inpwt_int()

pwint(fibonacci(fib_num))

See also

External resources

References

  1. https://www.reddit.com/r/ProgrammerHumor/comments/vkkyyv/say_hello_to_pythowo_make_sure_to_treat_her_well/ The original post with the pythOwO logo, the one that inspired the creation of this language.
  2. In pythowo.py line 681 in commit 57ee3e3 where statements are parsed, the only statements present are the return, break, and continue statements. At https://github.com/virejdasani/pythOwO/blob/57ee3e3d9a4c50dbc642ae77776ace66d1e47aed/pythowo.py#L912 in the atom (primary expression) parsing function, the rest of the "statements" such as if/else, while, and for are handled. pwease is handled in expr, meaning it is the lowest precedence "operator".
  3. pythowo.py line 1,342 in commit 57ee3e3 has code that allows function definitions to not have names.
  4. 4.0 4.1 4.2 4.3 nwull, twue, and fawse are defined in pythowo.py line 1,710 in commit 57ee3e3 and they are all instances of Number
  5. pythowo.py line 1 in commit 57ee3e3 has a comment that says # cowode stowlen shamewesswy fwom: https://github.com/davidcallanan/py-myopl-code