#ot2-the-original-pubsta
652 messages ยท Page 6 of 1
@radiant socket
hey
sure
Code/ Help 2?
code/help 1
i'm not voice verified
ah, voice gate
yes
yeah, just text then
well, just pick a chat and ping me in it
Ok
Woooah codeblock highlighting on android is a thing!!!
@dim marsh
decided to pull out the server and clean it up a bit (pls donโt judge cable management)
me trying to understand what im seeing
I got that same T-Force ram, it's fast
Woooah codeblock highlighting on android is a thing!!!
Not for me :(
I think I'm on the android beta so that may be why
import foo from bar
a = 'hello'
for i in range(100):
if i % 2 == 0:
print(a)
That's what it looks like for me
Same. On android discord v49.12
Import from 
lol
yikes
Feels like this is more like english grammar compared to from ... import ...
the non-monospace font with syntax highlighting is probably worse than monospace without syntax highlighting
Hey I'm in a screenshot! Sweet, my dream of being famous is going good
the non-monospace font with syntax highlighting is probably worse than monospace without syntax highlighting
@full summit disagree, I literally cannot read the code on mobile wihout highlighting
without monospace font, at least it's readable for me with highlighting
you're using ancient replies
ikr? That's so 30 minutes ago
hahahahaha
lol
Vestergurkans class class
@nova ember teach me oop
Bruh
As soon as I started learning javascript
(Since 3 days ago)
I dont want to even touch python anymore because it is just
So simple
๐คข
But javascript
people like what they like, I suppose
Javascript is hard
is it time to learn oop with @nova ember ?
you're using ancient replies
@full summit they're not available on my client yet lol
shitcord being shitcord
ctrl+r to reload and you should get them
JavaScript isn't any more complex than python imo @somber night
Javascript is as easy as python
for loops in js look crazy dude
How?
for(var i = 0; i < 10; i++) {do something 9 times}
for(const foo of iterable) { iterate over iterable}
iterable.forEach(function(foo) {iterate over iterable});
I'm not sure if arrays are the only iterable with forEach ๐ค
well, forEach is a method, so not all iterables support it
I thought so
Map definitely supports it, but, to remind us that it's in fact JavaScript, it does it backwards
myMap.forEach((value, key) => ...)
it passes the key and value in reverse order
What f?
your nickname
Who said it was python 

finally the reply feature!
Oh reply feaature in this server coool
replyyyy!!
replied!!

I guess no class today ๐ฆ lol
why
he does, I wanted this ot name and asked who likes teaching people about classes
I want to learn classes from him
OOP is the best, the reason i love python
python OOP 
I am still trying to learn them
I know the basics just want to know more about the special methods and inheritance
pyoop
yeah i love oop, really epic
niceee

Ikr
And replies are nice ngl

:+1:
@flint pike
Where did you run it?
cmd
import colorama
colorama.init(convert=True)
print(colorama.Fore.LIGHTMAGENTA_EX, 'Something like pink?')
these flex with nitros smh
ikr
๐
closes his eyes
lol
btw are you sure your name is appropriate? @dusk citrus
respect brail
is this braily
yes
I encrypted it and it was something not nice xd
!ban braille bad username
hey @slow valve, we need u over in #ot0-fear-of-python, you volunteered to sacrifice yourself
!ban fisher
NO GO AWAY
haha

lol
damn everyone i know are colorful now
โน๏ธ
this is the way
I am white still

on wednesday we wear pink
its thursday if you live on the greatest coast in the greatest country
Boost the server so you can be cyan
hm
Me in Friday gang
you guys live in the future... what happens on friday?
11/20 soon
I'm guessing you have different formatting lol

We live on the greatest coast in the greatest country
omg
Absolutely nothing
that emoji is literally cancer
?
that is actually good to hear
the think move one lol
time for you to build up the courage @storm birch
lol
maybe tomorrow will be the day? you never know
you know what i mean though fisher
LOLOL I know
good luck 
@slow valve u are western
you pinged the wrong guy
i know
nani
if I could even say "hello" without my hands trembling, it would be nothing short of a miracle LOL

the nitro flex be getting real
F
okay
lol
let's sacrafice vinam instead of u arnav
I am in an English Class so boring
hhahah
lol I used some GIF maker online
next level s***
a hypnotic gif indeed
Class will start in 120 hours. Get everyone ready lol
Yes, of course soonโข๏ธ
๐งโ๐ ๐ฅ
looking forward to it!
Hahahah
Gearing
I think itโs quite funny with a Ves and Vest OT-name at the same time
class started?
is it 120min?
Hours hahah
Hahah, weโll see
okie
hey @cedar leaf
you know you told me to not watch that Rudy Giuliani press conference?
good thing i did
because it was fucking hilarious
Donald Trump's personal attorney and former New York mayor, Rudy Giuliani, was sweating profusely during a press conference on Thursday.
Giuliani made a variety of claims about the election saying Trump won a landslide, Biden knew about a plot to steal the election, and that China, Cuba and Venezuela were involved, though he provided no evidenc...
his fucking hair dye ran
:D:D:D
It was uhhhhhhhh a press conference alright
Poor guy, this thumbnail doesnโt help
Haha
these are all press conference shots, what with him being a stupid public figure
It's just.... like I want it to be satire so badly. How does the onion even compete with reality at this point?
people were like "oh now this lot are in power comedy should be easy"
but you hear a lot of late night writers complaining that they've had to completely scrap scripts and start over because of some shit that happened
that'd be maddening. writing your show then finding out at 4pm you've gotta start a whole section from scratch
Sketch writer: "Wouldn't it be so over the top if X happened?"
News: "And today X happened"
Sketch writer: "Oh come on!"
beyond satire
@jovial island this was getting a bit off-topic, but you also need to be over 18 to create a developer account and submit apps to the App Store
If your friend is simply looking for a calculator app, there are many great ones out there
I'm over 18
But I don't like Apple
How do you guys feel about this new reply thing?
I think it's poopy
I am very ยฏ_(ใ)_/ยฏ so far
I don't like it with codeblocks
I like it more than quotes
I don't like that it's not on android yet apparently
I just see a pencil
you're hacking tho
How do you even get that
I've got quote and that's it
Has anyone here used python in integration with Arduino?.... Just wanted to know what were the possibilities and how was it overall?
I would like to a ML model with python and arducam for my remote plant monitoring system
And if there are any better ways for my idea to be implemented please let me know
Thanks
I've got
quoteand that's it
@Bepis#1445sure lol
@Arnav#9429 that's not how you ping
ik lol I didn't want to ping you
I should rlly get back to studies from tomorrow lol
otherwise I am doomed
I don't know if this is the correc place, so sorry if doesn't, but I would like to share this article:
https://physics.aps.org/articles/v13/179?fbclid=IwAR0GGLpyOK-1JdYx2mswGeTlUkMOR8-mm8kb60El7TsVS6HNsXrB2F6KBFQ
Right???
she looks like she came up with the idea while puffing a joint with her ml friends
I've picked it up too early
Someone on my team studied ML in college and now does nothing related to it, lol
I picked it up when I started (read) coding because that's one one of the reasons why I started
but I was new so it was mostly copy paste
I kinda had an idea how the thing worked
Makes sense
It would have benefitted you more if you had a stronger foundational knowledge?
if I had a stronger knowledge on how the code itself woroked
worked
can we not have this convo here please
thanks
Why python developer wear gkasses
because he can't c#
I don't?
I always wear glasses btw
I wear my glasses
just not the ones that help me see better
๐
๐ Wow
Cool
thank
Imagine coding with sunglasses haha
๐
But for me its medical

best text editor
fight me
๐
Imma
atom is best
it looks nice
and there are plugins
you can use
to make it better
like kite
Is this goos for blind people
sublime pretty decent
it doesn't look the best
it's not the best
but
it's pretty fine
Emm
eivl used sublime for a really long time
once you find something diffrent you don't really go back to it
I just woke up now and i cant detect colors
Lol
He switched to Pycharm only because his team is using it
pycharm is
idk it just doesn't look that nice to me tbh
plus it's python only
and idr like switching between diffrent ides deppending on what I'm writting in
more so with something like flask
It's so close
In atom even you can write your plugin
yeah
the only thing is
there's nothing for syntax and errors
you can write your own plugin in sublime too
you can change your theme in atom
and stuff like that
Not Pycharm
it's more customizable
Isnt it
I was in the python server and everytime I'd bring up that I used atom they'd be like oh no you should use pycharm or at least sublime it's so much better
I understand why it is
but
I don't really need those extra things
just a nice looking text editor and stuff is good enough
Oomm to be honest
yes?
Its ramkiller too
which?
pycharm and atom
PC is cool
and I prolly don't have the best computer for stuff that uses a lot of ram
And I have the pro edition for free
Im not sure atom is
student license?
Pydis?
wdym us?
Github user i have connected to once by
I have github connected so I look smart in front of my dumb friends
also what's wrong with github?
Idk really
JetBrains does sponsor some of the events that PyDis does, most notably the code jams.
That's how we're able to give out PyCharm licenses as prizes
yeah
lol
Some very kind soul in this server gifted me a month of Nitro today :')
Thank you once again @solemn thistle
!self
Class instance
When calling a method from a class instance (ie. instance.method()), the instance itself will automatically be passed as the first argument implicitly. By convention, we call this self, but it could technically be called any valid variable name.
class Foo:
def bar(self):
print('bar')
def spam(self, eggs):
print(eggs)
foo = Foo()
If we call foo.bar(), it is equivalent to doing Foo.bar(foo). Our instance foo is passed for us to the bar function, so while we initially gave zero arguments, it is actually called with one.
Similarly if we call foo.spam('ham'), it is equivalent to
doing Foo.spam(foo, 'ham').
Why is this useful?
Methods do not inherently have access to attributes defined in the class. In order for any one method to be able to access other methods or variables defined in the class, it must have access to the instance.
Consider if outside the class, we tried to do this: spam(foo, 'ham'). This would give an error, because we don't have access to the spam method directly, we have to call it by doing foo.spam('ham'). This is also the case inside of the class. If we wanted to call the bar method inside the spam method, we'd have to do self.bar(), just doing bar() would give an error.
Here are some interesting things about class instances (check the embed above as well)
One thing that helped me understand the concept was knowing that self can actually be called anything. Itโs simply an argument just like all other ones, which happens to have a very clear naming convention
When you do something like this: ```py
class Foo:
... def init(self, a, b):
... self.a = a
... self.b = b
... def test(self):
... print("Hello")
...
foo = Foo(5, 7)
foo.a
5
foo.b = 1000
foo.b
1000
When you do something like this, youโre simply assigning foo.a and foo.b to different values inside __init__. Whenever you say self inside the methods, youโre simply saying foo โ the instance that youโre using
The wonderful thing about OOP in python is how it passes the instance automatically for you. Itโs the same as if you wouldโve done something like this: ```py
Foo.test(foo)
It simply passes `foo` (the instance you created) as the first argument, without you needing to do anything. You simply say `foo.method` and it will pass `foo` as the positional argument `self` to the method!
Itโs really quite pretty and the things I explained above is exactly why you can technically call self whatever you want to. Itโs just a naming convention that makes like much easier for programmers, but itโs not enforced by python itself
The importance of conventions is great, but thatโs a topic for the next Vestergurkanโs OOP class
@slow valve @rotund swallow @gentle escarp @upbeat sandal class dismissed. Glad you could attend
The mad man did it...
Let's do this again next time this ot name happens
Oh yes, letโs do it.
Just as some feedback, if you had defined a class named Foo with at least one non-init method my_method, you could have illustrated your pseudocode point in real Python
f = Foo()
Foo.my_method(f, a, b)
Yeahh, I know. Maybe I should add it
Talking about random python lessons, here's one I made earlier <#help-cherries message>. I spent ages writing that and the person never replied so now I feel obliged to show it at every opportunity possible to show how selfless, helpful, and just amazing in general I am.
No need to thank me
@upbeat sandal done. Itโs updated to use real code now
perfect
@neat light very nice. I like the images as well. Itโs always nice to make things a bit more visual
thank you wookie
Pythontutor is very cool
I said no need to thank me 
Thank you @neat light

Btw pls ping me if this it name comes up again and you do this again @nova ember lol
I like random things
You mean the ot name?
Yeah
Vestergurkanโs OOP classes ping wookie
Thatโs a note to myself when I reach for old messages with clues
It could be a while before a name is repeated though, ...unless I remove all the ot names apart from this 
For sure. Weโll have to loop through all of them before it can be selected again
remove them
foo
bar
:)
Wow heap sorts
now I need to put the ot title in a bitmap of a stegasaurus
I'm fairly sure there is or was a chicken business called Steggles.
This ot-name sounds a lot like a code jam team name
!foo
Metasyntactic variables
A specific word or set of words identified as a placeholder used in programming. They are used to name entities such as variables, functions, etc, whose exact identity is unimportant and serve only to demonstrate a concept, which is useful for teaching programming.
Common examples include foobar, foo, bar, baz, and qux.
Python has its own metasyntactic variables, namely spam, eggs, and bacon. This is a reference to a Monty Python sketch (the eponym of the language).
More information:
โข History of foobar
โข Monty Python sketch
@zealous tide just like @unreal sigil said. Hereโs a tag to explain it as well ^
We have a tag for foo ๐
thanks guys :D
lel
i just noticed my keyboard has two Cmd/Start/Mod keys
ITS SWEATER WEATHER. today it was 5 c (41 f) the low is 0c 32f.
iโm in a sweater in my house
my nitro is expiring today yay
buy a new plan
What lol
@ancient whale lol, I just found out two of my all time favorite songs use the exact same chord progression for their chorus
just in a diff key
wow. 8/25, that's a long time ago
there should probably be a channel for something like that, where you get to share cool stuff you made related to python (or OT)
it seems like i have missed the OT name, could you tell me what it was? now im kind of interested because im seeing a lot of people talking about the channel name that was here
Vestergurkan's class class
We had that and it wasn't popular. Try reddit.
i would agree
That isn't to say that we don't want to see peoples projects. Discord just isn't the platform
maybe like a !resources but for smaller lessons as messages? you could react with something like ๐ and it would display the lessons on the site in relation to how many reactions it's got and how new it is? you could then search
though i should probably put this in #community-meta or something
!rangelen
Iterating over range(len(...)) is a common approach to accessing each item in an ordered collection.
for i in range(len(my_list)):
do_something(my_list[i])
The pythonic syntax is much simpler, and is guaranteed to produce elements in the same order:
for item in my_list:
do_something(item)
Python has other solutions for cases when the index itself might be needed. To get the element at the same index from two or more lists, use zip. To get both the index and the element at that index, use enumerate.
that is a tag
It's a tiny lesson
I thought what we had was special
or a better idea, a feed for python lessons/tips
friendship is still magic! I was just ashamed to say it without the strikethrough
oh u changed your pfp @storm birch
with great power comes great responsibility
yes, thanks to @kutiekat for the massively better photo editing skills than my own
you could put some tags in the message with you could then search in in:python-tips <tag>

What about the python tips book?
But it's a for-profit book
hm
not many want to sit down and read a book.. my idea was for it to be an easy tip you may not know about that is about the same size of a tag
it could be daily
or every 12 hours
I should write a python tips book. But with hot takes instead of tips
i feel like that would give the reader burn-out to keep watch on the channel
I updated my pfp again, this time with enhancementsโข๏ธ
but my nightlight is on, so almost impossible to tell what the colors look like
it still looks blinding on my end
oh nice pfp ๐
haha, ty
u got that hat perfect!
bUt YoU dIdNt mAke iT YouRsElf
kutiekat got the hat.
here is the edit LOL
this is how like every husky on instagram edits their photos lolol
oof i want to pat your doggo 
oh nice, i added hat to mine, and it looks like it is a giant's hat taking the front of forehead to back of your head
wait, you live beside the sea?
lol, my doggo hates pets
your dog?

yuck racism frog
this photo is on the "delta" here.
it is where the freshwater from rivers meets with the ocean, so this is freshwater.
Im like an hour from the ocean sadly
o
my dog is also an emoji 
oh lovely

Aww that doggo is so cute!
nice pfp fisher
ty haha
ty to both
its remarkable to think that in a few hundred years every work i have done will be forgotten
what sequence of events caused the earth to be formed, for life to exist, for a cell to eat another but not kill, for more complex organisms to form, for humans to live
could it all have been prevented in the beggining of the universe by simply adding some more atoms?
@proper python so if i understood correctly, 'for cell to eat another but not kill' means endosymbiosis which gave rise to eukaryotes and 'for more complex organisms to form' means multicellularity which gave rise to organisms such as humans. and for the question, the answer is idk.
hmmm idk if it is remarkable. most works will be forgotten after you die unless youre a famous person in history
Does turing machines only accept formal languages ?

that's a lot of pikachus
ummm........Hi!
what song and what progression
it's either the standard 4-chord Am F C G or some other weird one that just happens to line up
learning css is both annoying, sad and fun
for me it is annoying and sad
for me it is pain too
I'm going to cry
what is mypy??
oh maybe
ya no mypy doesn't like my custom types
is it a linter?
type hinter ya
huh
Mypy is an optional static type checker for Python.
this is confusing the shit out of me tho
Optional[type] is the same as Union[None, type] and I've got 2 overloaded cases that return Item
@shadow elk are you free?
@ancient whale How did you define your overloads?
@overload
def get_item(self, item: str, index: Literal[None], copy: bool) -> ItemType: ...
@overload
def get_item(self, item: Literal[None], index: int, copy: bool) -> ItemType: ...
@overload
def get_item(self, item: Literal[None], index: Literal[None], copy: bool) -> None:
raise NoSelection
def get_item(self, item: Optional[str], index: Optional[int], copy: bool) -> Optional[ItemType]:
"""
iterate through items in bag to get specified item
:param Optional[str] item: item name
:param Optional[int] index: index of item in bag (1-based index)
:param bool copy: whether or not to copy item for display
"""
...
I've got the function defined in the last one
@shadow elk
@ancient whale Well, this is what it's saying:
"You can call this function in the following ways:
get_item("item", None, <bool>)
get_item(None, 5, <bool>)
get_item(None, None, <bool>)
```"
I am?
Well, this is what your overloads say
do I need defaults for the args?
that's what I'm looking for I just don't know why the error is coming up
I would do this:
@overload
def get_item(self, *, item: str, copy: bool) -> ItemType: ...
@overload
def get_item(self, *, index: int, copy: bool) -> ItemType: ...
@overload
def get_item(self, *, copy: bool) -> ItemType: ...
It means that you can call it like this:
self.get_item(item="hello", copy=True)
self.get_item(index=5, copy=False)
With your current overloads, you specified that you're requried to pass three arguments
...I would actually do this:
@overload
def get_item(self, *, item: str) -> ItemType: ...
@overload
def get_item(self, *, index: int) -> ItemType: ...
@overload
def get_item(self) -> ItemType: ...
and make copy a method of the Item, because that's where it belongs, if I understand what you're doing correctly
even with it it's still doing the same thing
hm idk how I'd do that:
if copy:
temp_item = item
self.bag.put(temp_itemp)
return item```
that's all it does
Can you hover over the variable you're assigning the expression to and see its type?
no, like, can you hover over the variable to which you're assigning the call to
I hope that mypy understands overloads ๐ค
uhh
wait, is the top warning from the Pycharm linter or from mypy?
If you're using mypy, you should probably disable the native Pycharm warnings
It seems that it works fine with mypy
it is the python ones?
yes, I suppose. Try turning them off. That stuff should be covered by mypy
sick that got rid of like half the errors
Well, it seems that pycharm doesn't like overload ๐
so it would seem
ok lemme overload this last method and I'll push a branch, idk how to oop this together, I've got 3 inv classes but I can't call the main one as a parent because the other 2 are reliant on eachother to some degree
ok
Bruh what are all these terms I don't understand shit
Push a branch?
3 inv classes parent
Wtf I have so much to learn
I didn't want to push the changes to the main branch because I've got a functional version already there and this one is not
So I've created a new branch and pushed the changes there
@bronze rapids terminology of the git version control. Makes working in groups a lot easier.
Different branches have different versions of the same project. A project might have a prod branch, the version shipped to clients, a main/master branch - containing a working version - and a dev branch, a version used for testing all kinds of stuff out. It is also recommended to create a new branch for a feature and delete that branch once the feature is added. This makes it easier to revert changes in case the feature has bugs.
lmao np
@bronze rapids https://learngitbranching.js.org/
this is a cool website @ pure linked a while ago
oh woops apparently i had an existential crisis last night
it was in this channel
unless you've got that Microsoft glass archive thingy
I honestly want to know the story behind this otn
monty python #community-meta message
thx
I need to rewatch it.
My high-school also did a live action version of one of the monty python films years ago
amazing the school was okay with that -- even more so if it was "the life of brian"
and this is strange women in ponds distributing swords
I have it, I refunded it LOL. But now I have it again
Great idea: Make a programming language that interprets any amount of gibberish in a single line as an undeclared and type-less variable
Ask the fishes
๐
fisher fishes fishin
Can you image if the USA switched from pounds to kilograms overnight.
There would be mass confusion!
๐ ๐คฆโโ๏ธ ๐
What if we stopped using cups and spoonfuls as measurement overnight?
honestly i just dont understand pounds, farenheit, miles, yards
Dr: "How's the kid doing that swallowed those coins".
Nurse:" No change yet."
I try to being a little humor!
8
|
|
8. Tolerate
how long is a foot? Put 12 thumb's width together, and you'll find out
Aww the formatting messed up..
classic pun
You won't believe it, someone actually used "the length of an AR-15" to describe something to me
Honestly, we will use quite litteraly anything but the metric system
another one being the height of a hamburger
wow, when i read that hamburger a deep voice said hamburger inside my head
iirc it was a meme or smth, idk
Well I can safely tell you that a 2020 mirage is about the length of 3 washing machines
Maybe 4

Probably the weight of 17 though
Well I guess more like 14. Since a mirage is about 2000
that is almost the size of 370 big gulps
And if my math is right, you can fit almost 75k goofballs inside the car
Goofballs*
...
Golfballs
goofballs
that car could easily fit 63 vinams

It has 103.3 cu ft of passenger space. 1728 cu inches is 1 cu ft. A golf ball is roughly 2.42 cu in
Wtf phone
I know I'm not that drunk still
I cant type with autocorrect anymore lol
im totally sober now so I better be good with typing!
doubt
hahaha
doubt
doubt 3
Doubtfire
lol
i'm a frickin idiot
Pneufuckthisshit
Neo Monia
LOL, I found that funnier than I would have if I was sober.
But I am sober... so who knows
Monia is of Old Greek origin and it is used mainly in Italian. It is derived from the word monos which is of the meaning 'single, only'. In addition, Monia is a variant of Monica (English, Italian, Portuguese, and Spanish).
doubt again
wow thats so random
I did spell it though! Some would say I spelled it the absolute best. I'm sure the experts at webster's dictionary would agree
idk how to spell diahrea lol
@storm birch sober suber slobber
^very insightful
I'm legit betting my entire life on that I'll stop using auto correct and make sure I can spell everything, by the time I do the SAT essay
SAT ez
no
!sleep
I pray
you have learned well
SAT is where you sit
no sit is where you sat
I barely studied for the sat tbh
wait
and sane. We are programmers, we like being mentally challenged.
I'm 30, I'm weak if I don't sleep. Plus, no one wants a cranky 30 yr old women delivering food. It's not a good combo
mind if I ask what u got?
oh, ye 2400 format
You were so close to perfection
yeah, they changed it
6 off
i WISH 1776
good morning
Me 4
I shall sleep soon
good morning fisher
nah i just thought i can trick your mind into waking up instead of sleeping
jk go to sleep
LOL
i just claimed the hacktoberfest tshirt is it too late now?
I didnt even get it
๐
i got it, but i didnt recieve the tracking email still
i wonder if i am even gonna get it
I... forgot about completing the hacktoberfest?
The 2019 t-shirt is way slicker anyway
@shadow elk got time for Helping Numpy figure out how to refactor his code cause he's partially incompetent pt 3 out of _โข๏ธ?
I see that you're coming up with expressive names ๐ (not necessarily accurate)
@ancient whale yes, I'm free now, you can open a help channel
I figured I should give it a title considering it's a recurring series ๐
oh you right I haven't actually got a license for it
can I promote my dumbass livestream here? lol its weird but whatever lol
lol I dont know lol lol
its just my music with some weird ass video visual lol any ezquir3 on twitch, I won't spam the link but you can find me there
how do i install OS windows on a new pc i built myself if im in an all mac household
okely dokely
@shadow elk ok so I'm pretty much done but idk how to access persistence from display, should I be passing it as a dataclass attr?
or ig it's technically an init arg
Why does display need to access persistence? ๐
unequip/drop
Well, yes, you can pass it in the __init__
Have you thought about an event system? For example, you could make the display emit an event like ("item_unequipped", 6), and then you could make another object listen to "item_unequipped" events and do whatever they need to do. If you do that, you won't need to intertwine all the systems directly, and you can split the system into many smaller pieces
!e
from dataclasses import dataclass
class EventBus:
def __init__(self):
self.listeners = {}
def listen(self, event_type, callback):
if event_type not in self.listeners:
self.listeners[event_type] = []
self.listeners[event_type].append(callback)
def emit(self, event_type, payload):
for listener in self.listeners.get(event_type, []):
listener(payload)
@dataclass
class Inventory:
bus: EventBus
items: list
def __post_init__(self):
self.bus.listen("add_item", self.add_item)
self.bus.listen("game_started", lambda _: self.bus.emit("update_inventory_display", self.items))
def add_item(self, item: str):
self.items.append(item)
self.bus.emit("update_inventory_display", self.items)
@dataclass
class Menu:
bus: EventBus
def __post_init__(self):
self.bus.listen("game_started", lambda _: print("Menu initialized..."))
def add_ducky(self):
self.bus.emit("add_item", "ducky")
@dataclass
class InventoryDisplay:
bus: EventBus
def __post_init__(self):
self.bus.listen("update_inventory_display", self.update)
def update(self, new_items):
print("Items:", new_items)
bus = EventBus()
menu = Menu(bus)
inv = Inventory(bus, items=["snake"])
inv_display = InventoryDisplay(bus)
bus.emit("game_started", None)
menu.add_ducky()
@shadow elk :white_check_mark: Your eval job has completed with return code 0.
001 | Menu initialized...
002 | Items: ['snake']
003 | Items: ['snake', 'ducky']
oh jesus
If you want, you could keep a global bus object instead of passing it to literally every object in your game
oh ok ya that makes a bit more sense, I'm just going to save that and try to implement it later
I've got a couple more errors to iron out first
well, yes
it seems that your game has mainly lots of events happening, that's why I thought it was a decent idea
You could make little state machines (for example, one object could keep track of what location you're in) that change their state and emit some events when they receive some event.
oh ok so instead of having displacement as a single class, send directions to the listener and emit the direction to print?
also the .Objects._ didn't work I had to change it to Objects._
maybe you should claim a help channel, I'm free now
sure
and this is joe loves graphs
@grim seal we want graphs. Again.
You should share the love โค๏ธ
Wouldnโt it be sad if you kept it all to yourself?
@nova ember 14d?
14d
lmao
Lol
what about diagrams and charts?
#ot2-the-original-pubsta message
we've been tricked
Bamboozled if you will
Has joe been to las vegas recently?
based on every movie I've seen about las vegas, he probably gambled away the graphs, and is going on a mission to get them back
Hello
check my dm
what if graphs love joe and joe is mind controlled by graphs
Live and die by the graphs
๐ +๐ฅ =๐ ๐
๐+๐ = ๐

๐ + ๐ = ๐
bruh lol
+
= 
uh no
No, this is wrong ๐ right is ๐+ ๐ + glue = ๐
I disagree
+

bruhh
Lol
+ โฑ๏ธ = 
+

lol you guys still continuing it



+

@nova ember i like the new pfp
i just dont know how you fit it inside a small circle
i see
sneaky
sneaky gurkan
Thankssss
@storm birch go to bed
bed is too soft. If I go to it, I will be soft
Just flip the mattress
besides, its not time for bed. Its time for sad boi hour
so i was seeing some of my old codes
and every time i come to the yes or no in this code
sublime randomly crashes
import random
print('Rock,Paper,Scissors!')
while True:
selected=''
selected=input('Would you like to chose Rock [R], Paper [P] or Scissors [S]?')
selected=selected.lower()
if selected=='r':
print('You chose Rock!')
elif selected=='p':
print('You chose Paper!')
elif selected=='s':
print('You chose Scissors!')
else:
print('Please chose between [R] or [P] or [S]')
continue
x=random.randint(1,3)
comp_selected=''
if x==1:
comp_selected='r'
print('comp chose Rock!!')
elif x==2:
comp_selected='p'
print('comp chose Paper!!')
elif x==3:
comp_selected='s'
print('comp chose Scissors!!')
if comp_selected==selected:
print("It is a tie")
continue
elif comp_selected=='r' and selected=='s' or comp_selected=='p' and selected=='r' or comp_selected=='s' and selected=='p':
print('Comp won!!')
elif selected=='r' and comp_selected=='s' or selected=='p' and comp_selected=='r' or selected=='s' and comp_selected=='p':
print('You won!!')
cont=input('Do you want to continue?[Y] or [N]')
cont=cont.upper()
while True:
if cont=='Y':
continue
elif cont=='N':
break
else:
print('Please chose Y or N')
continue```
can anyone run it and see once
sublime cannot handle inputs by default
i am using sublime repl
so it will either crash or the code will not run
You are already soft
I know :C
And slightly drunk on beer lol
softboi
LOL, I am sober! :C
you may as well call me "pillsbury"
because I am a doughy boi
oh nvm
apparently it printed a whole bunch of stuff in an infinite loop
which kept crashing sublime
Thatโs what a drunk person would say, isnโt it?
potato comp problems
i see you know
LOLOL, I have flight stuff tomorrow, so I am very sober. Also there is no beer.
Also: I barely drink haha
I kinda wish there was beer
Thatโs what a drunk person would say
LOL
โI barely drinkโ
And
โI kinda wish there was beerโ
Iโm spotting some plot holes
trust me, If I was drunk, I would be bragging about it.
Then be slightly disappointed in myself for doing so
Sounds just about right
why is the beer always gone
he is bragging that he isnt drunk hmmm ๐ฎ
But... thatโs what a drunk person would say
Plot twist, it's in the apple cider bottle.
mmmmm cider
The plot holes are just growing and growing
you guys are going to drive me to drink LOL
Plot twist, I'm the bottle.
you wish LOL
wat
Would that mean...
I guess he really is sober.
mhm?
I think you can put together the pieces yourself
oh no
I put it together
Iโm sorry for you
Draw a straight line and send us a picture of that line fisher
We'll see if you're actually sober
Punny. A straight line
that is not fair, I failed design drafting
.>
just send us
Cheater!
Straight as it gets
@nova ember CHEATER
Shush
hmmmmmmmm
always
Nah, honestly that's an okay-ish line
he just admitted that he is
I make that joke so often, it is not even an inconvenience anymore, I have props lying around everywhere for it
Haha, try a bunch of straight lines, drafting a crane hook.
ok, well that is maybe the best line I have ever drawn
- == t
^
oh i se
my handwriting is atrocious
are you @lucid girder ?
He is part of the legendary bot trio.
Firstly
god dammit your handwriting is good
!ban @nova ember self bot
what
There we go, less gurkans in the server
my handwriting is the best
whom'st've'd has summoned the almighty one
vestergrukan
no more gurkan!
Thanksss
don't type!
IM BACK. No one can ban the alrighty
@tranquil ridge wow we almost have the same handwriting
whom'st've'd's
No you're not!
lul
go away!
D:
"the alrighty"
i think akarys and vester have met in real life









+
= ๐จโ๐ป
+ 
+
