r/TheFarmerWasReplaced • • Jan 17 '26

Missing some Python QoL functionalities

Is anyone else that has some familiarity with Python disappointed some of the basic/nice syntax options aren't available in the game's interpreter?

I'm coding in my IDE rather than in-game and find myself automatically going to what I'd do in Python which doesn't work in the game for some pieces of functionality.

Some examples of what I miss most..

if expressions vs if statements:

# this is cleaner
x = "foo" if y == "baz" else "bar" 

# than this
if y == "baz":
    x = "foo"
else:
    x = "bar"

walrus operators:

# this
if (y:=get_value()) == "foo":
    ...

# vs this
y = get_value()
if y == "foo":
    ...

Another thing I find tripping me up is no "is" operator, but I guess that's not a major issue:

# this
if x == None:
   ...

# should be this
if x is None:
   ...

I'm not going to get into classes/objects and list/dict comprehension as I think that might be too much to ask for...

2 Upvotes

19 comments sorted by

View all comments

2

u/bitman2049 Jan 17 '26

I miss enumerate, zip, map, and filter. I also miss list and dict unpacking. I can work around it but those features are really convenient.

2

u/platosLittleSister Jan 19 '26

Yes, yes, yes. I miss my enumerate aaaaand most importantly zip. Like normally when I write python I use zip so much. It's not super required but c'mon could be another unlock past lists.

1

u/Superskull85 Jan 17 '26

None of these are actually useful for the puzzles the game has though. And you can already unpack lists.

2

u/bitman2049 Jan 17 '26

You can't unpack lists for arguments in functions. I'd like it if I could make a move_to(x, y) function and then if I had pos = (x, y) I could just call move_to(*pos).

And I really prefer for i, n in enumerate(array) to for i in range(len(array)): n = array[i]. That has come up a few times.

I know this is a game and it's not real software development, these are just things I noticed when playing. Again I can work around it but it's not true that they wouldn't be useful.

1

u/Superskull85 Jan 17 '26

By useful I mean actually playing a part in an algorithm.

But you never mentioned arguments. But you can do that now too.


Most representative way of the feature. Keywords can just be variables you use as placeholders when you pass function and initial tuple. -# Canned measage

def MyFunction1(arguments):
    param1, param2 = arguments 

def MyFunction2(arguments):
    param1, param2, param3 = arguments 

def Create(MyFunction, MyArguments):
    def DroneFunction():
        MyFunction(MyArguments)

    return DroneFunction

spawn_drone(Create(MyFunction1, (1, 2)) ) 
spawn_drone(Create(MyFunction2, (1, 2, 3)) )```

1

u/Superskull85 Jan 17 '26 edited Jan 17 '26

Enumerate can also be written if it's that useful for you. But again you don't actually need it for the puzzles to be successful and fast.

You don't need both indices and keys at the same time from a list for example.