#voice-chat-text-0

1 messages ยท Page 135 of 1

somber heath
#

The sun tried, bless its little cotton socks.

twin pond
#

Lol

warped raft
#

hello all

lofty crater
#

hi Shashank

warped raft
#

how are you all doing

lofty crater
#

we chiling buddy

warped raft
#

hey @midnight agate would you like to compete in some clash of code

#

@lofty crater

lofty crater
#

I am upto some stuff so I rather not

warped raft
#

should we start

#

didn't know what we had to do

#

share your code

#

marolo

#

@midnight agate

#

Wouold you like to joing

vocal basin
#

currently trying to solve some type system stuff

#

@lean pumice

lean pumice
#

So this is just a analogy. But say i am trying to create a project to maintain my email accounts. Say i have three emails, gmail, outlook, yahoomail.

Say i want to write program that might include things like to search email, read new emails, reply email etc. Naturally i dont want to create 3 programs to manage each of my accounts separately.

I was thinking of making a generic email class that impliments all the functionality i need. that i can use in my programs. And i was create a different class each of gmail, outlook and yahoo mail to write their logics. But i am not sure how do i link my generic class with say gmail class.

I want to know if there is a better way to structure this project or how can i link classes effectively.

Thanks.

vocal basin
#

there is #software-architecture channel for some questions of that sort
more of discussion rather than just help

#

I'd say "generic" not in formal sense

#

base class not generic class

#

find what functionality is inherent to all three classes

#
class EmailAccount:
    ...

class GmailAccount(EmailAccount):
    ...

class OutlookAccount(EmailAccount):
    ...

class YahooMailAccount(EmailAccount):
    ...
#

word "account" can be dropped

#

I'd prefer having an abstract method there

#

instead of reflection

#

NotImplementedError

vocal basin
#

!d NotImplementedError

wise cargoBOT
#

exception NotImplementedError```
This exception is derived from [`RuntimeError`](https://docs.python.org/3/library/exceptions.html#RuntimeError "RuntimeError"). In user defined base classes, abstract methods should raise this exception when they require derived classes to override the method, or while the class is being developed to indicate that the real implementation still needs to be added.

Note

It should not be used to indicate that an operator or method is not meant to be supported at all โ€“ in that case either leave the operator / method undefined or, if a subclass, set it to [`None`](https://docs.python.org/3/library/constants.html#None "None").

Note

`NotImplementedError` and `NotImplemented` are not interchangeable, even though they have similar names and purposes. See [`NotImplemented`](https://docs.python.org/3/library/constants.html#NotImplemented "NotImplemented") for details on when to use it.
vocal basin
#

@midnight agate also derive from ABC

#

it must be NotImplementedError not NotImplemented

#

there's actually three different errors related to abstractmethods

#

!e

from abc import ABC, abstractmethod

class Proper(ABC):
    @abstractmethod
    def example(self):
        raise NotImplementedError

class NotAbc:
    def example(self):
        raise NotImplementedError

class Typo:
    def example(self):
        raise NotImplemented

for class_ in [Proper, NotAbc, Typo]:
    try:
        class_().example()
    except Exception as e:
        print(repr(e))
wise cargoBOT
#

@vocal basin :white_check_mark: Your 3.11 eval job has completed with return code 0.

001 | TypeError("Can't instantiate abstract class Proper with abstract method example")
002 | NotImplementedError()
003 | TypeError('exceptions must derive from BaseException')
vocal basin
#

!e

from random import choice

class Fruit:
    def name(self):
        raise NotImplementedError

    def scream_name(self):
        print(self.name().upper())

class Apple(Fruit):
    def name(self):
        return "apple"

class Banana(Fruit):
    def name(self):
        return "banana"

fruit = choice([Apple(), Banana()])
# we no longer care which fruit it is
fruit.scream_name()
wise cargoBOT
#

@vocal basin :white_check_mark: Your 3.11 eval job has completed with return code 0.

APPLE
vocal basin
#

to simplify the code

#

it's about how we can use different classes without rewriting code for each class specifically

lean pumice
#

thanks @midnight agate @vocal basin

somber heath
#

@whole bear ๐Ÿ‘‹

whole bear
#

@somber heath hi

vocal basin
#

"still not sure whether or not I consider overloading a crime against common sense"

somber heath
#

@pure gale ๐Ÿ‘‹

somber heath
#

@lofty crater ๐Ÿ‘‹

vocal basin
#

haven't heard of it

somber heath
#

Nor I.

vocal basin
#

is it allowed by YT TOS?

somber heath
#

Terms of Service

vocal basin
#

you already can use YouTube without account on mobile:
browser

somber heath
#

Google gets fussy about people accessing YouTube in ways Google doesn't intend.

vocal basin
#

make a burner account, disable all tracking

#

youtube isn't even against it

#

it gives recommendations based on IP sometimes

#

find where you can tell google to stop and tell it

#

same network -> same external IP
usually

#

doesn't go the other way around because NAT can put multiple networks behind one IP

#

that's why, for example, IP bans and IP restrictions are not a good idea sometimes

pulsar island
#

I heard it, so you have to too

surreal cape
#

nice

vocal basin
#

it's not really a good principle, as some say

#

being strict in both input and output is often better

somber heath
#

@mellow kiln ๐Ÿ‘‹

#

@silent pike ๐Ÿ‘‹

silent pike
#

@somber heathyoo

#

@somber heath cant my mic is supressed

somber heath
#

!voice

wise cargoBOT
#
Voice verification

Canโ€™t talk in voice chat? Check out #voice-verification to get access. The criteria for verifying are specified there.

vocal basin
#

can do what?

somber heath
#

@haughty idol ๐Ÿ‘‹

haughty idol
#

hi

#

im new here

vocal basin
#

they said it will be a pop-up

#

whether it will actually be one -- idk

#

Once this change rolls out for you, weโ€™ll send a pop-up in-app for you to pick a new username.

velvet tartan
vocal basin
#

most of dust here is just walls falling apart

#

(and car dust coming through the open window)

somber heath
#

@bronze quiver ๐Ÿ‘‹

#

@crystal horizon ๐Ÿ‘‹

bronze quiver
#

hey opal whats this vc for ???

#

how can i get perms to talk in vc 0

somber heath
#

!voice

wise cargoBOT
#
Voice verification

Canโ€™t talk in voice chat? Check out #voice-verification to get access. The criteria for verifying are specified there.

bronze quiver
#

Hey any of ya'll participate in competitive programming competions using python?? If i should get voice verification and stop typing here lemme know pls-

vocal basin
#

what level of competitions are you talking about?

bronze quiver
#

any level

#

@somber heath are u professional, or student,or...?

#

thats dope

vocal basin
#

a couple of months ago I was playing clash of code (at codingame) but that's not really serious stuff

#

as for serious competitive programming, I stopped two years ago

#

as soon as the need for it ended

bronze quiver
#

like did u have a rank on codeforces

vocal basin
#

"regional" level
didn't make it to country finals

bronze quiver
#

you don't have to asnwer that if you don't want to- im new to discord servers

vocal basin
rugged tundra
#

!voice

wise cargoBOT
#
Voice verification

Canโ€™t talk in voice chat? Check out #voice-verification to get access. The criteria for verifying are specified there.

bronze quiver
vocal basin
#

fixed wing?

bronze quiver
#

sorry?

vocal basin
bronze quiver
#

gotcha

vocal basin
#

didn't hear "straight wing" term before in the context of aviation before

#

often it's "fixed-wing" and "rotary-wing"

#

discrete taxonomy for personalities works poorly, it's always gradients not categories

vocal basin
somber heath
#

@elfin harbor ๐Ÿ‘‹

bronze quiver
#

hahahaha its pretty fun

#

until you start losing your rank

elfin harbor
#

hello ๐Ÿ™‚

somber heath
#

@primal mountain ๐Ÿ‘‹

primal mountain
#

hi

vocal basin
#

mostly unsuccessful

bronze quiver
#

what are those

vocal basin
#

funny how account recovery is under "/amnesia/" path

bronze quiver
#

yo u a profesh or just a hobbyis

vocal basin
bronze quiver
#

ahh thats crazy

#

hard for me too

#

Im in my senior year of HS rn so i've competed in some hackathons

rugged tundra
bronze quiver
#

but not crazy hard stuff

#

@vocal basin

#

are u a professional?

vocal basin
#

not yet employed

somber heath
#

@whole bear ๐Ÿ‘‹

bronze quiver
#

just out of college?

vocal basin
#

dropped out of university because health

bronze quiver
#

oh, are u planning on joining back?

#

@somber heath do yall do this often or is it just a by chance thing when everyones free

vocal basin
bronze quiver
#

ahh ok ok

#

i gotta be here more

#

gotcha

somber heath
#

@wind radish ๐Ÿ‘‹

bronze quiver
#

im in india rn so weekend are prolly the only time imma get on- but hopefully i see yall around

desert wolf
surreal cape
rugged tundra
bronze quiver
#

@vocal basin if you ever get back to competitive programming, lemme know if you u wann help upsolve together- im looking to build a group of people who want to work on competitive programming together

desert wolf
#

phrasing

surreal cape
vocal basin
#

there needs to be a better acronym for that...

bronze quiver
desert wolf
#

o_o

vocal basin
#

SP, sports programming

surreal cape
#

Alborghetti

bronze quiver
surreal cape
#

will sit on the devil's lap

vocal basin
#

Russia happened to Venezuela

#

that might've contributed somewhat

somber heath
#

@paper stirrup ๐Ÿ‘‹

somber heath
#

@potent plank ๐Ÿ‘‹

surreal cape
#

parsed a tablature from the song Dont Fear the Reaper from Bue Oyster Cult, and ploted the exponential weighted mean of the notes from each string from the guitar tablature

surreal cape
# surreal cape

@rugged heron I guess something like this may feed a model, what do you think?

civic zephyr
vocal basin
#

please no

#

either use block if

#

or use messageable = ...

#

and then await messageable.send(response)

#

also having positional boolean flags is kind of meh

#

@wind raptor maybe closing too early?

#

or, like

#

disconnect server-side to fix that

#

close the session when the server receives the message

civic zephyr
vocal basin
#

are you sure you need to write this logic yourself?

vocal basin
#

so it doesn't respond to other bots

#

should it really be without await?

#

you're running with debug logs on, right?

#

@civic zephyr default doesn't include message content

civic zephyr
vocal basin
civic zephyr
vocal basin
#

change to all

#

default does not have message content intent

#

!intents

wise cargoBOT
#
Using intents in discord.py

Intents are a feature of Discord that tells the gateway exactly which events to send your bot. Various features of discord.py rely on having particular intents enabled, further detailed in its documentation. Since discord.py v2.0.0, it has become mandatory for developers to explicitly define the values of these intents in their code.

There are standard and privileged intents. To use privileged intents like Presences, Server Members, and Message Content, you have to first enable them in the Discord Developer Portal. In there, go to the Bot page of your application, scroll down to the Privileged Gateway Intents section, and enable the privileged intents that you need. Standard intents can be used without any changes in the developer portal.

Afterwards in your code, you need to set the intents you want to connect with in the bot's constructor using the intents keyword argument, like this:

from discord import Intents
from discord.ext import commands

# Enable all standard intents and message content
# (prefix commands generally require message content)
intents = Intents.default()
intents.message_content = True

bot = commands.Bot(command_prefix="!", intents=intents)

For more info about using intents, see discord.py's related guide, and for general information about them, see the Discord developer documentation on intents.

vocal basin
#
intents = Intents.default()
intents.message_content = True
tidal shard
civic zephyr
vocal basin
#

Bot can do everything Client can

#
  • some more
#

most importantly, Cogs support

#

you can have Bots without prefix

#

just with on_message

#

and Cogs allow to make multiple on_message handlers

#

@civic zephyr yes, it uses reflection

#

idk if you can define your own events

vocal basin
wind raptor
#

I did miss that

vocal basin
#

ugh
why do sockets need to be so difficult

wind raptor
#

indeed

#

It's not sending the disconnect

vocal basin
#

"good opportunity to learn ZeroMQ instead of raw sockets"

wind raptor
#

It's just a fun little project, I'm sure it's something dumb that I'm doing wrong

vocal basin
#

maybe it gets GC'd?

wind raptor
#

Maybe

#

sleeping should have fixed it though

vocal basin
#

!d asyncio.Queue

wise cargoBOT
#

class asyncio.Queue(maxsize=0)```
A first in, first out (FIFO) queue.

If *maxsize* is less than or equal to zero, the queue size is infinite. If it is an integer greater than `0`, then `await put()` blocks when the queue reaches *maxsize* until an item is removed by [`get()`](https://docs.python.org/3/library/asyncio-queue.html#asyncio.Queue.get "asyncio.Queue.get").

Unlike the standard library threading [`queue`](https://docs.python.org/3/library/queue.html#module-queue "queue: A synchronized queue class."), the size of the queue is always known and can be returned by calling the [`qsize()`](https://docs.python.org/3/library/asyncio-queue.html#asyncio.Queue.qsize "asyncio.Queue.qsize") method.

Changed in version 3.10: Removed the *loop* parameter.

This class is [not thread safe](https://docs.python.org/3/library/asyncio-dev.html#asyncio-multithreading).
vocal basin
#
civic zephyr
vocal basin
vocal basin
#

like

#

proper async sockets

#

oh

#

wait

#

eh

#

do sockets you're already using have wait_closed?

#

if you want multithreaded async, then use Rust

#

ECDHE

#

last e being ephemeral, iirc

#

@whole bear RSA is often used for long-term keys
though there's no strong reason to choose it over EC

whole bear
#

agreed

whole bear
#

Stuff I wrote down lol @civic zephyr

#

testing the limits of my memory

bronze quiver
#

@whole bear can't u do that on youtube- thats what i try and do

civic zephyr
wind raptor
#

g2g for a bit cheers

vocal basin
#

!paste

wise cargoBOT
#
Pasting large amounts of code

If your code is too long to fit in a codeblock in Discord, you can paste your code here:
https://paste.pythondiscord.com/

After pasting your code, save it by clicking the floppy disk icon in the top right, or by typing ctrl + S. After doing that, the URL should change. Copy the URL and post it here so others can see it.

vocal basin
turbid sandal
surreal cape
vocal basin
#

not sure if this is an appropriate diagram type

surreal cape
#

yes it is not

#

I just selected the more fastest i could draw

#

just to make more illustrative

vocal basin
bronze quiver
#

ohh i thought he was talking about the leetcode question

vocal basin
#

these are heterogeneous (doing different stuff), right?
(as in, they are not replicas of each other like workers)

surreal cape
#

let me try to explain

The lowest actors are devices deployed on field with sensors which communicate with each other in low range radio layers in the mesh network, until the message reache the main device (COO - stands for Coordinator) .

The coordinator is a more complex hardware that has a woreless communication to sends the data to a broker through the internet.

On the web layer there is a web service listening to the broker that receive and decompiles the transmission, queueing the message to specific queues that are cosumed by specific microservices responsible for processing this kind of data

#

of course in this middle process the data is saved in databases, to be queried by the client

vocal basin
#

@tepid edge
I forgot what that question was

#

this, I assume

#

ah

#

yes, I'm not calculating adequately, I know

#

there are mathematical optimisations

#

there is no need to store the sequence

tepid edge
vocal basin
turbid sandal
#

class Solution:
def fizzBuzz(self, n: int) -> List[str]:
list = []
for i in range(n):
if i % 3 == 0:
list.append("Fizz")
elif i % 5 == 0:
list.append("Buzz")
elif i % 3 == 0 and i % 5 == 0:
list.append("FizzBuzz")
else:
list.append(str(i))
print(list)

dawn stag
#

is it any difference between "for i in range(1, n+1)" and "for i in range(n)"?

vocal basin
#

I'll try to rewrite mine first

#

rewritten

def allowed(delta):
    return delta in [-1, 1]

def total(sequence_first, sequence_last):
    n = abs(sequence_first-sequence_last) + 1
    return (sequence_first+sequence_last) * (n**3+3*n*n+2*n) // 12

def sequence_sums(arr):
    arr = iter(arr)
    last = next(arr)
    sequence_first = last
    sequence_last = last
    last_delta = None
    for x in arr:
        delta = x - last
        if last_delta is None or delta == last_delta and allowed(last_delta):
            sequence_last = x
        else:
            yield total(sequence_first, sequence_last)
            sequence_first = last if allowed(delta) else x
            sequence_last = x
        last = x
        last_delta = delta
    yield total(sequence_first, sequence_last)

def solution(arr):
    return sum(sequence_sums(arr))
#

knowing first and last elements of a continuous sequence is enough to get the sum

#

(sum of all sums of all subsequences)

#

polynomial fit of experimental data
(guessing)

#

by brain can't parse DSA as something other than Digital Signature Algorithm

vocal basin
turbid sandal
#

class Solution:
def fizzBuzz(self, n: int) -> List[str]:
list = []
for i in range(n):
if i == 0:
pass

        elif i == 1:
            list.append(str(i))

        elif i % 3 == 0 and i % 5 == 0:
            list.append("FizzBuzz")

        elif i % 3 == 0:
            list.append("Fizz")

        elif i % 5 == 0:
            list.append("Buzz")
        else:
            list.append(str(i))
    print(list)
vocal basin
#

!code

wise cargoBOT
#
Formatting code on discord

Here's how to format Python code on Discord:

```py
print('Hello world!')
```

These are backticks, not quotes. Check this out if you can't find the backtick key.

For long code samples, you can use our pastebin.

turbid sandal
#
class Solution:
    def fizzBuzz(self, n: int) -> List[str]:
        list = []
        for i in range(n):
            if i == 0:
                pass

            elif i == 1:
                list.append(str(i))

            elif i % 3 == 0 and i % 5 == 0:
                list.append("FizzBuzz")

            elif i % 3 == 0:
                list.append("Fizz")

            elif i % 5 == 0:
                list.append("Buzz")
            else:
                list.append(str(i))
        print(list)
                

vocal basin
#

use proper range bounds instead of checking for 0

#
range(1, n)
#

this if is totally unnecessary

#

because it's already covered by the default case

dawn stag
#

try range(1, n+1)

vocal basin
#

!e

from operator import add
from itertools import starmap, cycle, count
or_ = lambda x, y: x or y
fizzes = cycle(["", "", "Fizz"])
buzzes = cycle(["", "", "", "", "Buzz"])
numbers = map(str, count(1))
solution = starmap(or_, zip(starmap(add, zip(fizzes, buzzes)), numbers))
print(" ".join(next(solution) for _ in range(100)))
wise cargoBOT
#

@vocal basin :white_check_mark: Your 3.11 eval job has completed with return code 0.

1 2 Fizz 4 Buzz Fizz 7 8 Fizz Buzz 11 Fizz 13 14 FizzBuzz 16 17 Fizz 19 Buzz Fizz 22 23 Fizz Buzz 26 Fizz 28 29 FizzBuzz 31 32 Fizz 34 Buzz Fizz 37 38 Fizz Buzz 41 Fizz 43 44 FizzBuzz 46 47 Fizz 49 Buzz Fizz 52 53 Fizz Buzz 56 Fizz 58 59 FizzBuzz 61 62 Fizz 64 Buzz Fizz 67 68 Fizz Buzz 71 Fizz 73 74 FizzBuzz 76 77 Fizz 79 Buzz Fizz 82 83 Fizz Buzz 86 Fizz 88 89 FizzBuzz 91 92 Fizz 94 Buzz Fizz 97 98 Fizz Buzz
vocal basin
#

so, apart from import errors, it worked first try

vocal basin
slate light
#

def logo(): where_are_they=( 'building','pubblic_structure','space','home','city','natural locatrion','office') sx=random.choice(where_are_they) if sx=='city': city=['phone box' 'office', 'parking lot', 'public library', 'art gallery', 'zoo', 'bookstore', 'cafรฉ', 'truck', 'marina', 'port', 'town square', 'vineyard', 'cinema', 'market', 'strip club','dark streat', 'bank','gym', 'hotel', 'motel', 'bus', 'car', 'restaurant', 'fast food', 'swimming pool', 'main hall', 'stadium', 'pubblic toilet',] fc=random.choice(city)

#

a=['home','hotel']

#

if a=='home':

#

alien
english
coats
Snowboard coat
Republic
Telepathy
Kevlar
Internet-connected appliances
Gin
Hot
Jet pack
Ice Helm
Jasmine
Tonfa
classes
Punk
classes
community center
futuristic

slate light
surreal cape
#

so

#

@dawn stag

dawn stag
#

yeah yeah

surreal cape
#

after some messages here

#

youll be able to verify

#

what your doing?

dawn stag
#

im studying web development

#

django

surreal cape
#

nice

#

very nice

#

django โค๏ธ

dawn stag
#

and trying to write telegram/discord bots

#

what about u?

#

i heard u working

surreal cape
#

just chilling

dawn stag
#

oh right now

#

yeah me too

surreal cape
#

you are using django as backend for the bots?

dawn stag
#

no, just for websites

surreal cape
#

so, theres an idea you can use

#

and django API

#

and bots that communicate withe API to store data

dawn stag
#

oh that would be cool

#

but i think right now too hard for me

surreal cape
#

storing a lot of messages and let parallel jobs running to generate statistics like word clouds, word frequencies, sentiment analysis, data mining, etc

#

so the bots doesnt nees do do the heavy work in runtime and leave thu user waiting for a response while the bor processes a lot of data

surreal cape
dawn stag
#

thats right

#

i have an idea

#

to build a website

surreal cape
#

but is only an idea of course ๐Ÿ˜„

dawn stag
#

like a blog

#

and try your idea

#

i think it would be a huge improvement

surreal cape
#

so, imagine, the same django API that feeds the bots, may feeds a website

#

but I got your point, your planning a monolith, right? ๐Ÿ˜œ

dawn stag
#

im sorry, dont really know what is monolith ducky_australia

surreal cape
#

monolith is a all in one system

#

a webpage, a server, a database all together in the same project, running in the same environment

dawn stag
#

oh yes

#

not a big project so

surreal cape
#

yes, if is a small prject is a good pick

#

otherwise, if one small part of the system fails, the entire system goes down ๐Ÿ˜ฆ

vocal basin
#

use a message queue to connect web API and the bot

surreal cape
#

what kind of queue you intend to use?

vocal basin
vocal basin
surreal cape
#

but doesnt makes more sense to build just right and Web API to comunicate with the Bots intead of it? ๐Ÿค”

vocal basin
#

how are you going to make an API request to the bot?

surreal cape
#

I have chatbots that works like that, communicating with backend APIs

vocal basin
#

hosting HTTP API in the same process as the bot isn't very good

surreal cape
#

but also, I have discord buts that does not communicate with any backend at all, just store data directly at a mysql host without need of API processing

#

I guess it will depends what your intention

vocal basin
surreal cape
#

actually, if you are intended to use a bot for telegram or discord, you dont make requests to the bot "directy"

#

although you can

#

but the platform does it for you

#

you do not do this from the server side

vocal basin
#

example:
discord bot that has a website to access some of its data

#

it can be done without involving the bot, if you're only querying

#

it becomes difficult when the bot needs to do stuff in response to web requests

surreal cape
#

so, in this case, I suggest you do something like I said

the discord interface interact with the bot,
the bot send the data to the django API
the django store data on database

website can query data from API
bot can query data from API throu bot command
mobile app can query data from API too if you develop an app

#

all of it communicate with a single core

#

which manage, process and secure all the data

vocal basin
#

how do you get the request from the browser to the bot?

surreal cape
#

with an http request

vocal basin
surreal cape
#

do you wat to see? I show you on dm since you cant speak on voice here

#

Ah sorry

#

Alisa can

vocal basin
#

bot can't "ask" for the request
polling periodically is inefficient

surreal cape
#

I think I was still talking to the party guy

#

the bot can ask yes

dawn stag
#

im just noting things

#

because dont know much about all that

surreal cape
#

Ill ask you again, if you can see I share screen on dm with you because here I cant share screen

#

and its not polling

#

is on demmand

vocal basin
queen lagoon
#

@surreal cape to ask for streaming permissions, go via ModMail. I only saw your DM because I was trying to send one myselfโ€ฆotherwise it would have sat there for days!

vocal basin
#

request is made by the browser, not by a bot command

surreal cape
vocal basin
#

there is no message

#

request originates in the browser

#

which makes a request to the service which has a bot associated with it

#

this model works sometimes, but has drawbacks, mostly regarding reliability

surreal cape
#

it said that created a thread

surreal cape
#

a discord bot?

vocal basin
#

yes

#

discord bot + website

surreal cape
#

so how the request is made by the browser?

#

and what difference does it makes?

#

its an http request to a backend anyway

#

if you need to query information, you query information, if you need to save information, you save information

vocal basin
#

minimal example:
website has two features

  • login (via discord)
  • if logged in, a button that if pressed sends "test" from the bot account to the user
surreal cape
#

and then is sent by the internet over the http/https protocol

#

as it is expected if is this were the method you programed the software to behave

#

if you used another method like opening a websocket it will work as well over ws/wss protocoll

vocal basin
# vocal basin

so, okay, what is the full route that the request takes from the browser to the bot in this case?

#

does HTTP API service somehow call the bot?

surreal cape
#

if you programmed to subscribe.publish to a AMQP queuing system it will pubsub to a rabbit queue

surreal cape
#

the discord interface interact with the bot code which send the http request to the API

#

the API only return a response of a request made by the bot or website or mobile app, or desktop application or whatever application

vocal basin
#

with dependencies like this

surreal cape
#

THEN bot will receive response but because the API CALL the bot but because the bt will be LISTENING our SUBSCRIBED to a QUEUE or TOPIC system

#

unless you implement an API server or grpc on the bot application

#

then you can eceute calls from anywhere to the bot application :hide_the_pain_harold:

vocal basin
surreal cape
#

I like rabbitmq

#

actually I gotta move my ass someday and start to play with kafka sometime

vocal basin
#

interestingly, more reliable patterns even in the broken paradigm of how, for example, python async works, involve queues too
so, getting thinks to work correctly in async gets things easier to transfer over to multiple service architecture

dawn stag
#

so rabbitmq is broker right?

surreal cape
#

Yes, have ever used?

dawn stag
#

never)

surreal cape
#

I have an instance on my VPS

#

if you want to test I create a queue for you to test

vocal basin
surreal cape
#

yes, my instance is an docker image :hide_the_pain_harold:

dawn stag
#

how message queue works?

#

it optimises querys?

vocal basin
#

depends on the specific message queue

vocal basin
vocal basin
vocal basin
#

what extra systems and protocols do, are those extra guarantees

#

for example:

  • ensuring messages are stored until they are properly processed
  • managing what "properly processed" even means
surreal cape
#

In rabbit is a little confuse, but with practice you get it.

Is something like each CONSUMER must have your OWN QUEUE

the queue mus have a BOUND to and EXCHANGE

the BOUND is created by a ROUTING_KEY

all the messages a publisher sends is published in an EXCHANGE over a ROUTIN_KEY

a QUEUE can have as many ROUTING_KEYS as you want

all queues binded to the exchange containing the routing_keys associated to the message sent receive the message

dawn stag
#

interesting

surreal cape
#

wanna try send something?

dawn stag
#

i wanna try to see how it works

#

now

surreal cape
#

I have a public queue

dawn stag
#

how can i do it?)

surreal cape
#

sure

#

let me see if I find a easy solution to pub/sub with python

#

lets mine google around libs python to use rabbit

#

i know two of them

#

kombu

#

and ...

#

what was the other ๐Ÿค”

#

pika

#

I suggest kombu

#

google for kombu python

#

to publish

#

ill test here if its workin

#

and dont forget

pip install kombu
#

exchange type รฉ topic

dawn stag
#

bruh

#

(403) ACCESS_REFUSED - Login was refused using authentication mechanism PLAIN. For details see the broker logfile.

surreal cape
#

easy, let me see here

#

got same error

#

let me check if theres a public user

#

seems like the public its not so public at all

#

:hide_the_pain:

#

much like the "public transport" here on Brazil :hide the pain:

dawn stag
#

sadge

surreal cape
#

Ill create a new user here

#

virtual host beelze

#

consegui

dawn stag
#

maybe i do something wrong

surreal cape
dawn stag
#

nice

surreal cape
#

right we did it

#

now lets do the consumer

#

so we can view what each other are sending

dawn stag
#

oke

surreal cape
#

writhe down that producer to a script while I do a quick review for the consumer

#

so you can quickly run a script that gets an input from cmd and sends the input message in the producer payload, ok?

dawn stag
#

just random function?

#

or what

surreal cape
#

sort of

#

like


message = input('message: ')


# code of the producer
#

then where you have inputed that hello beelze you inser the value of the variable message inputed from message

#

input a message and voila

#

sends me a message

dawn stag
#

ready

#

nothing bad will happened?

surreal cape
#

oh my youre fast, I was on the bathroom :hide the pain:

dawn stag
#

sometimes my brain cells starts working

#

for a little bit

surreal cape
#

I guess nit test it send some messages it will nqueue here at the broker

dawn stag
#

{'': message}

#

i can write like this?

surreal cape
#

hmm

dawn stag
#

because if i just write message its an error

surreal cape
#

actually the invert

#

use the input as value

#

oh no

#

sorry

#

correct

#

message is the variable used as value

dawn stag
#

so its fine?

surreal cape
#

but use a key, dont leave empty

dawn stag
#

okey

surreal cape
#

just fill with any "string" you want

dawn stag
#

yeah

#

helicopter

bitter sentinel
#

no permission to speak

#

oh right

#

im stupid

toxic dune
#

So, Proxmox is used for?

#

gotcha

#

I do

#

ahh

#

make sense

#

remove everything lol

#

docker by default runs as a root user

#

don't I have permissions to unmute the mic in this voice chat?

#

gotcha

#

lemme see

#

RIP I need to send over 50 messages

#

can I spam this channel?

#

Oh I see

#

which channel again?

#

gotcha

#

there should be a bot

whole bear
#

how's it going yall

toxic dune
#

what happened?

#

Oh it was long back

surreal cape
#

@gentle hedge did it worked?

gentle hedge
#

no

surreal cape
#

what happens?

gentle hedge
#

"Have over 50 messages in the server."

surreal cape
#

hmm

#

I see

#

you have to participate a little more in the chats

gentle hedge
#

yep

surreal cape
#

what your doing?

gentle hedge
#

I'm talking to you so I can use voice lol

surreal cape
#

:hide the pain harold:

#

still working on that app?

gentle hedge
#

we need more stickers in LUCI

#

like that

surreal cape
#

you are mod

#

add them

gentle hedge
#

give me the copilot role bro

surreal cape
#

there place for only one copilot

#

:harold:

gentle hedge
#

:harold:

#

no, discord, i dont want discord nitro

surreal cape
#

when you were copilt you have "azucrinated"

gentle hedge
#

you're lying

surreal cape
#

but about the app

gentle hedge
#

im the best

#

i never have "azucrinated"

surreal cape
#

anyway

#

the app

gentle hedge
#

idk what is "azucrinar"

#

cuz im the best

#

ok, the app

surreal cape
#

did you finished the chart?

#

can consume the graphql already?

gentle hedge
#

yep, but the interface is weird

surreal cape
#

do you want to still adjusting it or you rather fork and implement the graphql in the API?

gentle hedge
#

idk

surreal cape
#

well is up to you

#

follow your heart

gentle hedge
#

I still need to correct a lot of things in the way I create the chart

gentle hedge
surreal cape
#

so i guess is this wat you want to do

gentle hedge
#

:harold:

surreal cape
#

I have procrastinated the whole day

gentle hedge
#

me too

surreal cape
#

and also, made new friends here

gentle hedge
#

my gf wanted to watch movie

surreal cape
#

want a gf

#

will code one for me

gentle hedge
#

I didn't do much today, I became a useless being on this beautiful saturday

gentle hedge
#

:harold

#

29 messages ;-;

surreal cape
#

if I achieve the capacity to be able to code a single one with scalability design, the I will surely replicate many and open a company to sell billions to nerds around the world

gentle hedge
#

let's do it

surreal cape
#

I will sell my BMW and start to drive a Ferrari

gentle hedge
#

I give you moral support and you do the rest

surreal cape
#

you do the salesmaking

#

since you are "so beautiful"

gentle hedge
leaden vector
#

Hello, I am a beginner coder and I need help with a school assignment

gentle hedge
#

A male version of Afrodite

leaden vector
#

can anyone help me?

gentle hedge
surreal cape
leaden vector
#

I am very confused on what to mark as x since I do not understand the pattern

surreal cape
gentle hedge
surreal cape
leaden vector
surreal cape
#

let me see if I understand

leaden vector
surreal cape
#

yu have to print all X?

#

or stop the loop when find the first X?

#

it is not very clear

leaden vector
surreal cape
#

HMMMMMMM

leaden vector
#

I have that done but I need to make it have the x's in the right spots

#

which is what is completely confusing me

surreal cape
#

you have to generate an output that looks like this matrix right?

gentle hedge
#

if

surreal cape
#

got it

leaden vector
#

I made the black one

surreal cape
#

lets try to find the patterns

#

the first row is a normal linear row

#

from 1 to 9

leaden vector
#

ok

#

its a multiplication table

surreal cape
#

the second row is doubles

leaden vector
#

ok

surreal cape
#

like is second row so starts on 2, and goes multiplying for the value of the colum index
so

the columns index are

1 2 3 4..

2 * 1 = 2 | 2 *2 = 4 | 2 * 3 = 6 | ...

and the same pattern for each row

#

now lets find when we have to fill with X

leaden vector
#

the current code I have and I need to put a nested loop in for filling in the x's

surreal cape
#

its working?

leaden vector
surreal cape
#

oh well

leaden vector
#

I just need to find out how to fill in the spots with x's

surreal cape
#

so, good job

#

oh

#

so isnt working

leaden vector
#

its kinda working

leaden vector
#

It results in this out put but I need to make it turn into this

surreal cape
#

lets say that works when it solves it purspose, just to we dont get lost or misunderstooded

leaden vector
#

Ok!

surreal cape
#

lets see, start simple

if row_num => 3 and col_num >=3:
    value = 'x'

right?

#

I simplified, the appending you will do

leaden vector
#

But what about the 81?

surreal cape
#

I suggest the iteration you execute with enumerate

for row_num, row in enumerate(matrix):
      # do somethin with the row
     for col_numm, col in enumerate(row):
        # do something with the colum
surreal cape
#

this is an check taht you might use before the loop

leaden vector
#

ok

surreal cape
#

by doing this you saves cyclomatic complexity and time exceution

#

matrix[-1][-1] = 81

does it resolve?

leaden vector
gentle hedge
#

for row in range(1, num_rows + 1):
    for column in range(1, num_columns + 1):
        if column >= 3 and row >= 3:
            print("X", end="\t")
        else:
            result = row * column
            print(result, end="\t")
    print()```
#
num_rows = ??
num_columns = ??```
surreal cape
leaden vector
#

I am an extreme newbie at coding ๐Ÿ˜ญ

surreal cape
#

ok lets go for parts

surreal cape
#

the matrix size is 9x9 right?

leaden vector
surreal cape
#
>>> rows = list(range(9))
>>> rows
[0, 1, 2, 3, 4, 5, 6, 7, 8]
>>>
#

if I do that I make a row, right?

leaden vector
#

yeah

surreal cape
#

you need 9 of that

leaden vector
#

ok

#

Should I rewrite my code completely from scratch?

gentle hedge
#

here it is

surreal cape
leaden vector
leaden vector
surreal cape
#

Im helping you

#

just calm down

leaden vector
#

ok

gentle hedge
#

keep calm bro

surreal cape
#

try making 9 of those lists i showed you

#

inside a loop

gentle hedge
#

does the 81 need to appear at the end?

leaden vector
gentle hedge
#

ok...

#
if row == num_rows and column == num_columns:
  print("81")```
#
num_rows = 9
num_columns = 9

for row in range(1, num_rows + 1):
    for column in range(1, num_columns + 1):
        if column >= 3 and row >= 3
            if row == num_rows and column == num_columns:
                print("81")
            else:
                print("X", end="\t")
        else:
            result = row * column
            print(result, end="\t")
    print()```
#

try

leaden vector
#

ok

gentle hedge
#

i forgot the : in the line 6

#

sorry

gentle hedge
leaden vector
gentle hedge
#

nice

#

@surreal cape i cant voice

surreal cape
#

I got a solution

gentle hedge
#

"Have joined the community over 3 days ago."

#

;-;;

#

f**k

surreal cape
#
>>> matrix = []
>>> columns = list(range(1, 10))
>>> for i in range(1, 10):
...     row = []
...     for colum in columns:
...         if i>=3 and colum >= 3:
...             row.append('x')
...             continue
...         row.append(i*colum)
...     matrix.append(row)
>>>
>>> matrix[-1][-1] = 81
>>>
>>> for r in matrix: print(r)
...
[1, 2, 3, 4, 5, 6, 7, 8, 9]
[2, 4, 6, 8, 10, 12, 14, 16, 18]
[3, 6, 'x', 'x', 'x', 'x', 'x', 'x', 'x']
[4, 8, 'x', 'x', 'x', 'x', 'x', 'x', 'x']
[5, 10, 'x', 'x', 'x', 'x', 'x', 'x', 'x']
[6, 12, 'x', 'x', 'x', 'x', 'x', 'x', 'x']
[7, 14, 'x', 'x', 'x', 'x', 'x', 'x', 'x']
[8, 16, 'x', 'x', 'x', 'x', 'x', 'x', 'x']
[9, 18, 'x', 'x', 'x', 'x', 'x', 'x', 81]
gentle hedge
#

nice

surreal cape
#

hmmm but the third row failed

#

just a m inute

gentle hedge
#

if i>=4 and colum >= 4:

#

@surreal cape

surreal cape
#

3

spring glade
#

if i>=4 and colum >= 3

gentle hedge
#

if i>3 and colum >= 3:

surreal cape
#
>>> matrix = []
>>> columns = list(range(1, 10))
>>> for i in range(1, 10):
...     row = []
...     for colum in columns:
...         if i>3 and colum >= 3:
...             row.append('x')
...             continue
...         row.append(i*colum)
...     matrix.append(row)
...
>>> matrix[-1][-1] = 81
>>> for r in matrix: print(r)
...
[1, 2, 3, 4, 5, 6, 7, 8, 9]
[2, 4, 6, 8, 10, 12, 14, 16, 18]
[3, 6, 9, 12, 15, 18, 21, 24, 27]
[4, 8, 'x', 'x', 'x', 'x', 'x', 'x', 'x']
[5, 10, 'x', 'x', 'x', 'x', 'x', 'x', 'x']
[6, 12, 'x', 'x', 'x', 'x', 'x', 'x', 'x']
[7, 14, 'x', 'x', 'x', 'x', 'x', 'x', 'x']
[8, 16, 'x', 'x', 'x', 'x', 'x', 'x', 'x']
[9, 18, 'x', 'x', 'x', 'x', 'x', 'x', 81]
#

of curse there are those line to draw and beautify the output

#

show the row and col numbers

#

etc

#

but the algorithm itself it something like that

gentle hedge
#

now make a version where the output is a dictionary {} where each column is a key containing the multiplication table as a value, inside a list

#

lol

surreal cape
#

cant you talk yet ?

gentle hedge
#

yes ;-;

#

i need to wait three days

surreal cape
gentle hedge
#

so weak

surreal cape
#

more interested in playing with that tablature data anal ysis

gentle hedge
#

i cant

#

still not working

#

cuz i need to wait three days

surreal cape
#

ยฏ_(ใƒ„)_/ยฏ

#

sad

gentle hedge
#

must be a member for at least three days

#

sad

surreal cape
#

well Im here since 2020 and still cant screenshare ๐Ÿ˜‚

twin pond
#

.

somber heath
#

@limpid crypt ๐Ÿ‘‹

limpid crypt
#

Hello bro

#

sorry my english is not perfect

somber heath
#

I'm talking to a bird.

#

So if I talk like I'm talking to a baby, I'm not talking to you. ๐Ÿ˜

limpid crypt
#

see later Opal

#

have a nice day

somber heath
#

@shrewd delta ๐Ÿ‘‹

shrewd delta
#

its not letting me talk

somber heath
#

!voice

wise cargoBOT
#
Voice verification

Canโ€™t talk in voice chat? Check out #voice-verification to get access. The criteria for verifying are specified there.

turbid sandal
#

!voice

shrewd delta
#

yeah its not going to let me talk until i have been in the server for at least 3 days

#

@somber heath

turbid sandal
#

!voice

somber heath
#

!voice

shrewd delta
#

im trying to figure out how to get my discord bot online

turbid sandal
#

!code

wise cargoBOT
#
Formatting code on discord

Here's how to format Python code on Discord:

```py
print('Hello world!')
```

These are backticks, not quotes. Check this out if you can't find the backtick key.

For long code samples, you can use our pastebin.

turbid sandal
#
import tkinter as tk
import time as t
import threading

root = tk.Tk()
label1 = tk.Label(text="0")
label1.pack()


first_value = 0


def sdd():
    first_value = first_value + 1
    label1.configure(text=str(first_value))
    t.sleep(1)


root.mainloop()


#

@somber heath

somber heath
#
import tkinter as tk

class App:
    def __init__(self):
        self.root = tk.Tk()
        self.callback()

    def callback(self):
        print('Hello, world.')
        self.root.after(1000, self.callback)

    def run(self):
        self.root.mainloop()

App().run()```
somber heath
#

@whole bear ๐Ÿ‘‹

whole bear
#

@somber heath broooo how do i print first 10 prime numbers

#

need help

#

in my interview

#

yes

#

bro quik

#

i only have 5 minutes

#

๐Ÿ˜ญ

#

no nothing

#

no skills

#

i just want the job

red peak
#
for i in range(1,11):
  print(i)
#
def is_prime(n):
  for i in range(2, n/2 + 1):
   if n % i == 0:
     return False
  return True
whole bear
#

bro i just wrote print("2,3,5,7,11,13,17,19,23,29")

#

hopefully i pass

#

while everyone is searching outside the box, ya know what i open and look inside the bo

#

x

#

๐Ÿ—ฟ

red peak
#

2, 12, 32

#

6, 30, 90

whole bear
#

why so emptiness in the vc

somber heath
#

@surreal grotto ๐Ÿ‘‹

surreal grotto
#

bro i cant speak i don't have voice perms for some reason

vocal basin
#

!voice

wise cargoBOT
#
Voice verification

Canโ€™t talk in voice chat? Check out #voice-verification to get access. The criteria for verifying are specified there.

whole bear
surreal grotto
#

facts

whole bear
#

๐Ÿ—ฟ

vocal basin
#

@red peak
unit tests or integration tests?

whole bear
#

snakes in toilet or not

red peak
#

Depending on the changes

vocal basin
#

(that's why the question)

red peak
vocal basin
whole bear
#

@surreal grotto do you know liqhtbee?

vocal basin
#

unit tests and code itself are supposed to be written by the same person

#

most of the times

#

@surreal grotto writing unit tests for other people's code is an incorrect workflow, often
so hate for that is somewhat reasonable

#

if there's a person who's good at unit testing, they should be reviewing tests other people wrote, not writing it for them

red peak
#

What about TDD? I've never worked in a TDD structure. Does everyone write their own tests even in TDDs?

vocal basin
#

what do you mean by TDD?

#

I know but there are different definitions

#

one is the correct one:
red-green-refactor loop with minimal iteration steps

#

just writing tests before code isn't enough for TDD

vocal basin
#
  • not all tests are unit tests
    TDD works only with unit tests
#

another reason:
you might not know what the function/method/etc. is expected to do

#

make components as simple as possible
so that the most rigorous and detailed documentation wouldn't be a mess

#

there are also different types of documentation

#

not documentation (comments)
in-code documentation
external documentation (books and stuff)

#

comments reduce readability

#

if the code is too complicated, there should be a separate paper/document to explain what it does
with comment linking to it as an excuse for it being unreadable

#

beep boop uwu

whole bear
#

oh nawww ๐Ÿ’€

vocal basin
#
2 + 2 @ "Alisa Feistel"
      ^ can't apply matrix multiplication between an `int` and a `str`
whole bear
#

bro has 22k messages ๐Ÿ’€

vocal basin
#

!d operator.matmul

wise cargoBOT
#

operator.matmul(a, b)``````py

operator.__matmul__(a, b)```
Return `a @ b`.

New in version 3.5.
vocal basin
#

that one operator that was added only because numpy needed it

gentle flint
whole bear
vocal basin
#

!e

0 @ "str"
wise cargoBOT
#

@vocal basin :x: Your 3.11 eval job has completed with return code 1.

001 | Traceback (most recent call last):
002 |   File "/home/main.py", line 1, in <module>
003 |     0 @ "str"
004 |     ~~^~~~~~~
005 | TypeError: unsupported operand type(s) for @: 'int' and 'str'
somber heath
whole bear
#

could be

somber heath
#

Beaver parmesan.

whole bear
#

i don't know much about cheese

surreal grotto
red peak
#

!e

import numpy as np
x1 = np.array([2j, 3j])
x2 = np.array([2j, 3j])
print(x1 @ x2)
wise cargoBOT
#

@red peak :white_check_mark: Your 3.11 eval job has completed with return code 0.

(-13+0j)
vocal basin
surreal grotto
#

Ok. Because I think Elvis was tricking me into thinking you're a bot

#

which to be fair is kind of hard to discern nowadays anyway

whole bear
vocal basin
#

pithink is "chose" and "picked" the same thing

somber heath
#

Broadly, but while you might choose a flower, the act of bisecting the stem is the picking.

whole bear
#

mutton's texture is kinda weird

#

yeah

#

i think goat's meat is also called mutton?

#

O_o

#

who's setup is this clean and systematic ๐Ÿคฏ the plant tho ๐Ÿ˜†

vocal basin
#

not clean for long given food placement

whole bear
surreal grotto
#

Freddy

whole bear
#

it starts with r and has 11 characters

vocal basin
whole bear
#

i don't want snake on my bum while excreting

#

๐Ÿ˜ญ

#

the dogs in india bro ๐Ÿ’€

#

what

#

@red peak where you live bro

waxen loom
#

has anyone been bitten by a spider?

whole bear
#

i want my picture good tho

gentle flint
waxen loom
#

pretty

gentle flint
#

รŽle de Brรฉhat

whole bear
waxen loom
#

wtf

waxen loom
#

where is that?

somber heath
#

Fairy Bridge, China.

whole bear
waxen loom
#

lovely place

whole bear
#

like, share, sub

#

vine

waxen loom
#

vine blast from the past

#

did i do a bad?

somber heath
waxen loom
#

ahh dw dw

#

lol what was that

#

what courses do you recommend? @frail jetty

frail jetty
waxen loom
#

do you need uni tho you can defo learn everything online

waxen loom
#

that doesnt sound sustainable tbh

#

how long have you been doing this? @frail jetty

shell moat
#

Weirs circumstances: being Russian.

#

And this fking government want to sent me to the fucking fields.

waxen loom
#

huh

craggy whale
#

hi guys! how can i get the right to participate in the discussion?

waxen loom
#

Total mastery, probably unrealistic, becoming highly competent in specific niches, very doable in relatively short time

#

You can defo learn multiple languages at once haha @turbid sandal

craggy whale
#

as previous developer i think, it would be easier to specify the field that you wanna be active in, cz python is so broad

turbid sandal
#

@frail jetty

waxen loom
#

lol

bronze quiver
#

Iโ€™ll be back I. A lil

wind raptor
#

@young vessel over here

turbid sandal
#

!code

wise cargoBOT
#
Formatting code on discord

Here's how to format Python code on Discord:

```py
print('Hello world!')
```

These are backticks, not quotes. Check this out if you can't find the backtick key.

For long code samples, you can use our pastebin.

turbid sandal
#

!e

class test():
  def __str__(self):
    print("test")
print(test)
wise cargoBOT
#

@turbid sandal :white_check_mark: Your 3.11 eval job has completed with return code 0.

<class '__main__.test'>
wind raptor
#

!e

class MyVector:
    def __init__(self, x, y):
        self.x = x
        self.y = y

    def __str__(self):
        return f"({self.x}, {self.y})"

    def __repr__(self):
        return f"MyVector({self.x}, {self.y})"

    def __eq__(self, other):
        return self.x == other.x and self.y == other.y

    def __len__(self):
        return 2

v1 = MyVector(2, 3)
v2 = MyVector(2, 3)
print(v1)
print(repr(v1))
print(v1 == v2)
print(len(v1))
wise cargoBOT
#

@wind raptor :white_check_mark: Your 3.11 eval job has completed with return code 0.

001 | (2, 3)
002 | MyVector(2, 3)
003 | True
004 | 2
turbid sandal
#
    if __name__ == '__main__':
        show_popup()
gentle flint
#
GitHub

Supervisor process control system for Unix (supervisord) - GitHub - Supervisor/supervisor: Supervisor process control system for Unix (supervisord)

GitHub

Superlance utilities for use with the Supervisor process control system - GitHub - Supervisor/superlance: Superlance utilities for use with the Supervisor process control system

vocal basin
#

!e

len(0)
wise cargoBOT
#

@vocal basin :x: Your 3.11 eval job has completed with return code 1.

001 | Traceback (most recent call last):
002 |   File "/home/main.py", line 1, in <module>
003 |     len(0)
004 | TypeError: object of type 'int' has no len()
vocal basin
#

(checking error message)

rugged tundra
#

Learn assembly language programming with ARMv7 in this beginner's course. ๐Ÿฆพ

ARM is becoming an increasingly popular language in the world of computer programming. It is estimated that over 200 billion devices contain an ARM chip, making the ARM language valuable to understand. By understanding an assembly language, programmers can have a better...

โ–ถ Play video
vocal basin
#

also I think this would be more correct

f"MyVector({self.x!r}, {self.y!r})"
#                 ^^          ^^
#

!e

class MyVector:
    def __init__(self, x, y):
        self.x = x
        self.y = y

    def __str__(self):
        return f"({self.x}, {self.y})"

    def __repr__(self):
        return f"MyVector({self.x}, {self.y})"

    def __eq__(self, other):
        return self.x == other.x and self.y == other.y

    def __len__(self):
        return 2

MyVector(0, 0) == 1
wise cargoBOT
#

@vocal basin :x: Your 3.11 eval job has completed with return code 1.

001 | Traceback (most recent call last):
002 |   File "/home/main.py", line 18, in <module>
003 |     MyVector(0, 0) == 1
004 |   File "/home/main.py", line 13, in __eq__
005 |     return self.x == other.x and self.y == other.y
006 |                      ^^^^^^^
007 | AttributeError: 'int' object has no attribute 'x'
wind raptor
#

lol it was just an example to show what dunder methods are and how they interact with built-in stuff

#

Not meant to be practical

vocal basin
#

most of the time I do

if isinstance(other, MyVector):
    return ...
else:
    return NotImplemented
#

but that's neither looking good nor allowing duck-typed comparison

wind raptor
#

yeah, that makes sense to check that the type matches

vocal basin
#

though

vocal basin
#
return natural_and_obvious_comparison if that_comparison_is_possible else NotImplemented

if that_comparison_is_possible:
    return natural_and_obvious_comparison
else:
    return NotImplemented
#

different order of reading

wind raptor
#

or

match isinstance(other, MyVector):
    case True:
        return ...
    case False:
        raise Error("You done bad!")

haha

vocal basin
#
match other:
    case MyVector(x=x, y=y):
        return self.x == x and self.y == y
    case _:
        return NotImplemented
#

eh

#

register size depends on the operation

#

you specify it

somber heath
#

@velvet palm ๐Ÿ‘‹

vocal basin
#

word is two bytes apparently

somber heath
#

@boreal shoal ๐Ÿ‘‹

glad wing
#

hey

vocal basin
glad wing
#

can someone help me with making a Cookie Clicker for my school project?

#

making it with Flask

somber heath
#

@hearty gorge ๐Ÿ‘‹

glad wing
#

java script, html and css.

vocal basin
#

@rugged tundra Oculus and stuff to eyes are like some distant object

#

in terms of how eyes focus on the object

#

lenses and stuff

#

but there is a different problem still

#

which is:
everything is at the same distance away anyway

rugged tundra
vocal basin
#

I think this impacts why sitting in darkness is bad too

vocal basin
#

without type checking it becomes weird

#

this catches more than necessary

try:
    return self.x == other.x and self.y == other.y
except AttributeError:
    return NotImplemented
vocal basin
vocal basin
#

Oxide are developing their own Firmware

#

for stuff they can

#

Oxide Computer

#

I think Steve Klabnik works for them

vocal basin
vocal basin
#

though most similar methods can just have type annotations

vocal basin
#

another hard topic about special methods:
signature of __exit__

#

Pylance somehow understands __exit__'s return type

#

but I haven't found so far how to express it in code

vocal basin
#

yes

#

if you use ExitStack with Pylance looking at your code, it will scream at you for using variables you defined inside with after it exited

#

because ExitStack can exit with True

#

I prefer wrapping everything in with

#

instead of adding hooks

#

when you might need hooks, is when you can't reach the with

#

panic/abort

#

I later did add the user list functionality

#

I still think async with is one of the main things keeping me from moving away from Python

#

I probably didn't

#

ah, yes, they have their own async
I remember doing that

#

I used PySide for four months in school

vocal basin
#

yes

#

it seems to also properly handle when clients crash

#

but not the server yet

#

when the server crashes, it only detects that and says "please type /exit"

#

aiohttp is probably built on top of asyncio's channels

#

remember

red peak
vocal basin
#

@quasi quiver
software engineering principles apply both to front-end and back-end
front-end has quite a lot beyond just HTML/CSS

#

HTML/CSS are weird
but anyway it's that kind of tools when you just can make it work

#

even when you build back-end, you can make monitoring tools and other stuff

#

eh

#

C++ is expressive too

#

"instantiating a class is very easy in C++
here are top 71 ways to do it: ..."

vocal basin
#

Rust's OOP is like Haskell's OOP + dynamic dispatch

red peak
#
auto myClass = new Myclass();
#

You have to assign the class to something don't you?

vocal basin
vocal basin
vocal basin
#

no idea, tbh

wind raptor
#

@random root here

vocal basin
#

void is weird
zero-sized types too sometimes

#

I think MSVC has some issues when you introduce zero-length arrays

#

to whoever asked:
VS Code has a more powerful language server

warm atlas
#

hello

bronze quiver
warm atlas
#

so in python multiple inheritance

quasi quiver
#

print("hello");