#python-discussion

1 messages · Page 399 of 1

gleaming knoll
#

just a reverse notation of ->
a -> b <- a

manic flare
#

Implication but backwards

raw bramble
#

Any other ones then?

manic flare
gleaming knoll
#

and ⊻ is the evil twin of or, xor

wise yarrow
#

any other what? binary boolean operators?

raw bramble
#

A ^ B -> C

If A and B, then C?

manic flare
gleaming knoll
#

in a parallel universe it could mean A ^ (B -> C)

manic flare
#

You can use parentheses to change order too

raw bramble
#

A v C <- B

If B, then A or C?
/
A or C, if B

gleaming knoll
#

yeah though <- is rarely used

raw bramble
#

What’s NOT?

gleaming knoll
# wise yarrow any other what? binary boolean operators?

the type a -> b has |b| ^ |a| members (you have an arbitrary choice of b for each a, so its like, b*b*b*b*b)
the type (a, b) has |a| * |b| members (you choose one a and one b)

so (bool, bool) -> bool has 2 ^ (2 * 2) members, 2 ^ 4 = 16
16 binary boolops

manic flare
#

Ngl I forgot order for the logic, can anyone give me a refresher?

dry yacht
#

the... order?

#

If in doubt, use parentheses?

manic flare
gleaming knoll
dry yacht
#

yeah, left-to-right, but operators have different precedences (e.g. binds stronger than v iirc), but yeah, if in doubt just check the precedences again or use parentheses

gleaming knoll
gleaming knoll
#

so "all possible binary boolops" are all 4-bool arrays

fair heath
#

Hello I'm French and I don't know how to speak English too much I write through the translation app so could someone code me a small program that is a SCP library here thank you

nimble isle
#

Vibe sort: sends a request to an AI language model to sort the given array

#

How good is it?

gleaming knoll
dry yacht
# nimble isle How good is it?

As almost always, the answer is: It depends

For most applications this is obviously complete garbage, but if you're sorting by some eccentric metric that's (almost) impossible to really measure, then maybe the LLM could be used to apply a score to each entry, which is then used for sorting using regular sorting methods, or if assigning each entry a separate value is too costly, then just asking it to spit out its top 10s could be helpful, but yeah... LLMs can't be 100% correct, so there will always be mistakes

inland karma
fair heath
#

ok

nimble isle
obtuse cobalt
inland karma
nimble isle
teal hare
#

`import numpy as np
import matplotlib.pyplot as plt
from sklearn.linear_model import LinearRegression

x = np.array ([[25], [75], [100], [150], [200], [250], [300], [350]])
y = np.array ([250, 180, 144, 120, 100, 80, 60, 30])
y_temp = np.array ([10, 20, 40, 50, 60, 70, 80, 90])

model = LinearRegression()
temp_model = LinearRegression()
model.fit(x, y)
temp_model.fit(x, y_temp)

while True:
Fps_Test = input("Enter your Resolution or exit for end: ")
if Fps_Test.lower() == 'exit':
print("Bye")
break
test_resulution = int(Fps_Test)
prediction = model.predict([[test_resulution]])
temp_prediction = temp_model.predict([[test_resulution]])
if prediction[0] > 144:
print("you can play on max Graphics")
print(f"your temp is: {temp_prediction[0]:.1f}°C")
elif prediction[0] >= 80:
print("You can play on Medium to High Graphics")
print(f"your temp is: {temp_prediction[0]:.1f}°C")
elif prediction[0] >= 60:
print("You can play on Low Graphics")
print(f"your temp is: {temp_prediction[0]:.1f}°C")
else:
print("Your FPS is so low its unplayable!")
print(f"your temp is: {temp_prediction[0]:.1f}°C")`

still learning spended like 30mins learning the AI things, what should i add to that AI FPS Prediction

obtuse cobalt
nimble isle
gleaming knoll
# gleaming knoll only 6 of them seem to be named in a recognizable way

well some of them literally dont depend on atleast one of the inputs
so it would be weird to call it a "binary boolop"
like you write a something b but it doesnt use a or b
??? insane
like one of the truth tables is just [False, False, False, False] (and same with True)
those are just constants repeated 2^n times, not really operations
but lambda a, b: False exists indeed. maybe not the most useful function but a function nonetheless

nimble isle
#

That makes sense then

gleaming knoll
vernal owl
#

Has anyone heard of the app pydroid?

dry yacht
# nimble isle What kind of algorithm runs faster the more items it has?

Depending on how you interpret the question: Most, if not all.

For example the total throughput of cycles will increase after a brief time, when the code and data is hot and already cached and when the branch predictor got to understand the program a bit.
If we want to talk about runtime per item, then this would be the case for all algorithms in linear runtime (for the reasons I said in the sentence before) or in better runtime complexities.
If we want to talk about total runtime, then maybe an accurate reverse engineering of some frequencies that were sampled at a specific Herz-rate. If you used a higher Herz-rate, and thus had more signal points to work with, decoding the real signal would be simpler (do note that I assume the lower sampled rate is below the Nyquist rate).

nimble isle
wise yarrow
wise yarrow
#

the two projection ones and xor and its negation

full bone
vernal owl
full bone
teal hare
inland karma
fierce merlin
#

What are you building?

vernal owl
nimble isle
#

Random.randint is constant time right? As is O(1) indexing. So random.choice must be O(1) by extension

inland karma
#

maybe start on something a bit simpler?

dry yacht
velvet trout
#

but it doesn't read like:
a if b and b if a

This makes more sense than just a if and only if a.

#

When you read it in english, it doesn't.

#

Bro pulled out the truth table xD

inland karma
nimble isle
#

Isn't O(n^(-1)) identical to O(1/n)? I feel like the latter is clearer

gleaming knoll
autumn forge
gleaming knoll
#

the empty algorithm
nop

velvet trout
#

O()

#

void

dry yacht
#

O(0)

autumn forge
#

def f(): pass

gleaming knoll
#

me when call instruction handling is non 0 cycles

velvet trout
#

What's the most smallest code/way of void/pass in python?

velvet trout
bronze dragon
#

it's a valid statement so it can serve as pass

nimble isle
velvet trout
#

Reminds me of /dev/null

autumn forge
nimble isle
velvet trout
#

"Eat 5star, do nothing."

#

u200b

nimble isle
#

So nothing is O(0), which is still constant time

velvet trout
#

Chat, how do i make discord text input box render unicode code typed in

#

\U200b

nimble isle
#

Aha.... ```py
from time import sleep
n = int(input())
sleep(1/n)
print("Finished")

harsh anchor
autumn forge
stray field
#

sleep(n and 1/n)

autumn forge
#

all O(0) functions are also O(1), but the reverse is not true

nimble isle
gleaming knoll
nimble isle
steady rain
#

!clban 1311047980551503964 upwork scam

edgy krakenBOT
#

:incoming_envelope: :ok_hand: applied ban to @queen geyser permanently.

gleaming knoll
nimble isle
dry yacht
# nimble isle Anything that does something must be at least O(1)

I guess it could work if we assume the runtime of the function is infinite.
Then we could have a function in O(1/n) by doing e.g. this:

def generate_number(n: int):
    i: int = n
  
    while True:
        yield i
        i += n

the larger our input size n, the more numbers we can skip (always n at a time).

I do have to admit, that I have no clue if and how big-O notation is even defined for infinitely running functions, so...

autumn forge
#

watching lambda edit messages is like watching a slow LLM generate output

wise yarrow
#

for programming if something got faster the bigger the input you'd probably just say O(1)
but in math it's much more common to see O(1/n) than O(n)

velvet trout
gleaming knoll
gleaming knoll
velvet trout
wise yarrow
stray field
#

O(0) still counts as O(1)

#

0 is constant

gleaming knoll
nimble isle
wise yarrow
#

maybe that's a bad example the series doesn't converge

harsh anchor
dry yacht
stray field
#

"But bricks are heavier than feathers"

gleaming knoll
velvet trout
#

Python REPL when typed an expression prints out its str or repr?

gleaming knoll
velvet trout
#

Cool

gleaming knoll
#

though if x is None then it doesnt print None

velvet trout
gleaming knoll
#

just to not give useless output for "do something" expression-statements

stray field
#

it's just special treatment

#

None is a VIP customer

velvet trout
#

None deserves a print 😢

stray field
#

We're respecting None's privacy

gleaming knoll
velvet trout
stray field
#

Same energy as ```py
def foo():
print("foo")
print(foo())

undone gazelle
#

so vscode is rolling out a really crappy ui theme change to some people using the default theme

here's how to revert the garbage new vscode theme once it rolls out to you:

  1. ctrl + shift + p
  2. go to Preferences: Color Theme
  3. select Dark Modern to go back to the good theming
stray field
#

Or just switch to zed

#

I've switched search engines for less

velvet trout
#

Or just write your own IDE

wise yarrow
# nimble isle Example?

not to say it isn't common to see like O(x^3), but stuff like O(1/x^3) is also pretty common
tho usage does differ, since O(x^3) is usually used for limits x -> 0, whereas in cs it's almost exclusively used for limits x -> infty

#

like Taylor series is another example where it's used around 0

velvet trout
#

Is there a open source ide which is too customizable and no/almost no opinionated?

surreal knot
#

emac

stray field
#

neovim with lazyvim

velvet trout
#

😋

velvet trout
velvet trout
#

Cool

#

How about made in python?

gleaming knoll
#

GNU Emacs was created by
Richard Stallman as the first program of the GNU Project. Development began in 1984
EMACS LITERALLY 1984

stray field
#

pyIDLE

#

it comes with python

gleaming knoll
arctic phoenix
gleaming knoll
stray field
#

Does babi count as an IDE?

#

!pip babi

edgy krakenBOT
crisp jay
velvet trout
#

iV

gleaming knoll
#

its not even an IDE its a integrate-anything-into-me

crisp jay
velvet trout
gleaming knoll
#

i dont use emacs btw
though i would if i knew about it before i knew about vim

velvet trout
#

i know you do 😏

gleaming knoll
#

maybe i should switch to emacs as a fun summer project

velvet trout
#

I knew it

#

Hehe

crisp jay
gleaming knoll
velvet trout
#

How do i read python's grammar?

#

python.gram ?

gleaming knoll
velvet trout
#

EBNF ig

velvet trout
#

Thanks

#

Gotta check if there's something I did not know

gleaming knoll
#

the .gram includes inline C code to generate the AST and do some checks, its what the actual cpython parser is generated from
the EBNF is for humans to read without worrying about implementation details

velvet trout
#

Since i assume it is already advanced enough for what i want to express

velvet trout
#

in source code, python.gram is actually what it uses for grammar?

velvet trout
#

Like its the only language it understands?

shrewd pine
#

though to be fair...a lot of modern editors are bad in that regard

velvet trout
shrewd pine
velvet trout
#

','.dotted_as_name+

WOw! Its like ", ".join() !

gleaming knoll
#

kind-of, yeah

gleaming knoll
shrewd pine
gleaming knoll
#

ruby has a lot of cursed stuff doesnt it

#

the kids on the internet dont hate on it because they just dont know it

velvet trout
#

That thing isn't even rubynic

gleaming knoll
autumn forge
#

Ruby is the greatest language of all time

velvet trout
#

Python has a lexer or tokenizer or both?

gleaming knoll
velvet trout
velvet trout
gleaming knoll
#

nope, no difference

velvet trout
#

Like i want to pick either term and standardize it for my projects. ;-;

inland karma
#

just pick one

crisp jay
velvet trout
#

Lexer sounds cool

inland karma
#

there you go

velvet trout
#

5 cool letters 🔥

gleaming knoll
#

the stdlib module is called tokenize

#

!d tokenize

edgy krakenBOT
#

Source code: Lib/tokenize.py

The tokenize module provides a lexical scanner for Python source code, implemented in Python. The scanner in this module returns comments as tokens as well, making it useful for implementing “pretty-printers”, including colorizers for on-screen displays.

To simplify token stream handling, all operator and delimiter tokens and Ellipsis are returned using the generic OP token type. The exact type can be determined by checking the exact_type property on the named tuple returned from tokenize.tokenize().

gleaming knoll
#

"provides a lexical scanner"
💀

inland karma
#

and the docs calls it lexical analyzer i think

gleaming knoll
#

even they cant decide
smh
ong
🥀

velvet trout
#

Why not call it lexer or lexinizer (if that's a term)

gleaming knoll
#

lexinizer is not a used word

inland karma
#

Next, the lexical analyzer uses the source characters to generate a stream of tokens.

granite wyvern
#

lexer is a common term. lexiniser is a make up work, useful as a sci fci gun, pointed at some text

velvet trout
#

tokenize.tokenize() brainmon

lexer.lex() better

gleaming knoll
#

lexical analyzer (also known as the tokenizer)
should be
lexical analyzer (also known as the tokenizer (also known as the lexer))

velvet trout
#

Lexinizer (i don't like s, isn't it british)

granite wyvern
#

It's valid English word construction, yes.

velvet trout
granite wyvern
cerulean ravine
velvet trout
#

But i find Zed cooler than Zee or S

granite wyvern
gleaming knoll
# velvet trout Although, is it valid under English grammar?

i think -iser is a suffix that means usually means "produces"
like, <x>iser = something that produces <x>s
a tokenizer produces tokens
a lexi..nizer? lexisizer? whatever the word you'd make up, would have to produce.. lexes? what is a single "lex"? lexemes are a thing, though

velvet trout
autumn forge
gleaming knoll
#

lexemiser maybe
produces lexemes (lexeme ~ token)

velvet trout
#

Lexed

#

Lets just nuke english

gleaming knoll
velvet trout
#

What's the past form of lex? I know the convention of -ed. Lexed?

autumn forge
#

lexinominator

cerulean ravine
#

leximification

granite wyvern
#

I lex, you lex, they lex. We lexed in the past. We will lex.
She bop.

cerulean ravine
#

we will have maybe should have lexed

gaunt badge
#

What is this, lex education?

next garden
#

Lexically speaking…..

velvet trout
gleaming knoll
#

my lexicon is very limited

gleaming knoll
velvet trout
#

Lexically lexing

autumn forge
#

we are complexifying lexer lexis

pastel sluice
#

comp-lex-ity

runic wharf
#

added this to my game engine cause i can

def tragic_bye_obj(obj):
    print(f"[{obj}]: No! Please No!")
    print(f"[{obj}]: Why would you do this???")
    print(f"[{obj}]: NOOOOOOOO!")
    print(f"{obj} - Lived from 0 to {timer()}")
    delete("player")
gleaming knoll
#

a tragedy in 3|4 acts

runic wharf
#

fixed

def tragic_bye_obj(obj):
    print(f"[{obj}]: No! Please No!")
    print(f"[{obj}]: Why would you do this???")
    print(f"[{obj}]: NOOOOOOOO!")
    print(f"{obj} - Lived from 0 to {timer()}")
    delete(obj)
velvet trout
#

Lexinizer or Lexier ? Which do you recommend

runic wharf
#
[player]: No! Please No!
[player]: Why would you do this???
[player]: NOOOOOOOO!
player - Lived from 0 to 0.226
autumn forge
#

lexer is the best

gleaming knoll
autumn forge
#

ah, my spellchecker doesn't think it is a real word

velvet trout
gleaming knoll
#

😳 do not consider me a person
do not perceive

velvet trout
#

class Lexer: ...

lexer = Lexer()
lexer.lex() 😋

gleaming knoll
#

ok but what will .lex() return
it wont be list[Lexemes] obviously because thats big

dry pike
#

lambder

pastel sluice
#

class Luthor:

gleaming knoll
velvet trout
#

Generator[Token]

velvet trout
runic wharf
velvet trout
gleaming knoll
#

please end me

autumn forge
#

hopefully list[Token] gets inferred

velvet trout
#

Ayo reaction

#

Is this the end?

inland karma
#

i wrote a tokenizer using pattern matching a while back

runic wharf
velvet trout
inland karma
#

during a pycon presentation about pattern matching when it came out

mossy sigil
#

I want to rule the world

topaz cedar
#

i made a cool BMDECR like array thing but i kind of forgot what all the other stuff did so its not exactly BMDECR

gleaming knoll
#

is that like SUBLEQ

topaz cedar
#

bashicu matrix decrease basically

velvet trout
gleaming knoll
granite wyvern
velvet trout
inland karma
gleaming knoll
#

i dont think match case is well suited for matching on strings

inland karma
#

depend on how you use it

velvet trout
# gleaming knoll enabling reactions was a (good | bad) decision it certainly was a decision, that...
class ArgumentLexer:
    END_OF_OPTIONS: Final[str] = "--"
    EXPLICIT_ARGUMENT_SEPARATOR: Final[str] = "="

    @classmethod
    def lex(cls, arguments: Iterable[str]) -> Generator[Token]:
        end_of_options = False

        for argument in arguments:
            if not end_of_options and argument == cls.END_OF_OPTIONS:
                end_of_options = True
                continue

            if not end_of_options:
                if argument.startswith(OptionPrefix.LONG):
                    prefix = OptionPrefix.LONG
                    body = argument.removeprefix(prefix)
                    name, explicit_argument = cls.extract_option_body_parts(body)

                    yield OptionToken(
                        argument=argument,
                        prefix=prefix,
                        body=body,
                        name=name,
                        explicit_argument=explicit_argument
                    )
                    continue
                elif argument.startswith(OptionPrefix.SHORT):

If i had used match-case construct, it would be an abuse of Structural Pattern Matching.

#

Ayo what

#

Why would you say that? 😢

gleaming knoll
dry pike
#

Somebody gotta do something about this

inland karma
#

!e

from typing import NamedTuple
import re


class Token(NamedTuple):
    type: str
    value: str
    line: int
    column: int

def tokenize(code):
    keywords = {'IF', 'THEN', 'ENDIF', 'FOR', 'NEXT', 'GOSUB', 'RETURN'}
    token_specification = [
        ('NUMBER',   r'\d+(\.\d*)?'),  # Integer or decimal number
        ('ASSIGN',   r':='),           # Assignment operator
        ('END',      r';'),            # Statement terminator
        ('ID',       r'[A-Za-z]+'),    # Identifiers
        ('OP',       r'[+\-*/]'),      # Arithmetic operators
        ('NEWLINE',  r'\n'),           # Line endings
        ('SKIP',     r'[ \t]+'),       # Skip over space and tabs
        ('MISMATCH', r'.'),            # Any other character
    ]
    token_regex = '|'.join('(?P<%s>%s)' % pair for pair in token_specification)
    line_num = 1
    line_start = 0
    for mo in re.finditer(token_regex, code):
        kind = mo.lastgroup
        value = mo.group()
        column = mo.start() - line_start
        match kind:
            case 'NUMBER':
                value = float(value) if '.' in value else int(value)
            case 'ID' if value in keywords:
                kind = value
            case 'NEWLINE':
                line_start = mo.end()
                line_num += 1
                continue
            case 'SKIP':
                continue
            case 'MISMATCH':
                raise RuntimeError(f'{value!r} unexpected on line {line_num}')
        yield Token(kind, value, line_num, column)

statements = '''
    IF quality THEN
        total := total + price * quality;
        tax := price * 0.05;
    ENDIF;
'''

for token in tokenize(statements):
    print(token)
edgy krakenBOT
# inland karma !e ```py from typing import NamedTuple import re class Token(NamedTuple): ...

:white_check_mark: Your 3.14 eval job has completed with return code 0.

001 | Token(type='IF', value='IF', line=2, column=4)
002 | Token(type='ID', value='quality', line=2, column=7)
003 | Token(type='THEN', value='THEN', line=2, column=15)
004 | Token(type='ID', value='total', line=3, column=8)
005 | Token(type='ASSIGN', value=':=', line=3, column=14)
006 | Token(type='ID', value='total', line=3, column=17)
007 | Token(type='OP', value='+', line=3, column=23)
008 | Token(type='ID', value='price', line=3, column=25)
009 | Token(type='OP', value='*', line=3, column=31)
010 | Token(type='ID', value='quality', line=3, column=33)
... (truncated - too many lines)

Full output: https://paste.pythondiscord.com/5HFPWXITKKRQ3ACNWL4BVKVUK4

velvet trout
dry pike
#

Yeah @inland karma can we do something about the reaction spam guy please

gleaming knoll
velvet trout
dry pike
inland karma
#

@<1471914282521460786> what are you doing?

#

ermm.. hmmm

velvet trout
inland karma
#

@runic wharf what are you doing?

gleaming knoll
velvet trout
bright violet
#

Does anyone know what the reason is behind .pth files?

inland karma
gleaming knoll
bright violet
#

Wondering if it can be disabled

#

without harming stuff

inland karma
#

you disable the site module

velvet trout
#

Whats .pth? I forgot i think i have seen this extension

topaz cedar
#

a [2] = a^2

gleaming knoll
#

by default i think its only used for editable installs to add a custom import loader

bright violet
#

that what caused the litellm stuff to broadcast secrets

topaz cedar
#

9 [3] = 9^3

#

ok this is a really stupid way of calculating exponentiation

inland karma
#

!ban 1471914282521460786 your poor judement in emojo reaction spamming telling someone to shut the fuck up and you gay and then ignoring me when im trying to call it out makes me thing you dont want to be here, so im showing you the door.

edgy krakenBOT
#

:incoming_envelope: :ok_hand: applied ban to @runic wharf permanently.

gleaming knoll
# topaz cedar a [2] = a^2

if a is a type and |a| is the number of members of this type, then |a[n]| = |a| ^ n indeed, you're choosing a value of type a n times

velvet trout
topaz cedar
gleaming knoll
inland karma
topaz cedar
#

different notation

gleaming knoll
inland karma
bright violet
#

Luckily it was only online for 4 hours

topaz cedar
# gleaming knoll its the exact same concept
def n_at(n, arr, max_steps=100000000000):
    arr = arr[:]  # copy
    v = 0
    step = 0

    print(f"Step {step}: {arr} | v = {v}")

    while arr and step < max_steps:
        step += 1

        p = arr.pop()  # take last element

        # expand into n copies of (p - 1)
        new_vals = [p - 1] * n

        # count zeros
        for x in new_vals:
            if x == 0:
                v += 1

        # append back
        arr.extend(new_vals)

        # optional: remove negatives to avoid infinite loops
        arr = [x for x in arr if x >= 0]

        print(f"Step {step}: {arr} | v = {v}")

    print("\nFinal Result:")
    print("v =", v)
    print("final array =", arr)


# Example
n = 5
arr = [n]

n_at(n, arr)
inland karma
velvet trout
#

pithink now i think about it, it allows other langs letters as identifiers which can be alphabets like english do, does it use some type of sheet of unicode or something? Or maybe unicode range points?

gleaming knoll
#

i wrote a pth file once when messing with an even more cursed feature, custom codecs

inland karma
gleaming knoll
bright violet
#

Thanks, this is a nice discord 🙂

velvet trout
inland karma
#

i have promised multiple people to write a blog post about my little python trick/hack.. so ill do that soonish!!! 😄

gleaming knoll
velvet trout
velvet trout
gleaming knoll
bright violet
velvet trout
gleaming knoll
bright violet
gleaming knoll
#

well its not like you can fuck up a tokenization regex, its basically always just LL(1) (as in, each character -> one path for the regex state machine to take)
unless you have a cursed language at which point you wouldnt be writing a regex in the first place

granite wyvern
granite wyvern
#

Tjough did I see someone mention a linear time regexp evaluator recently?

inland karma
limpid wigeon
#

Wi

velvet trout
inland karma
limpid wigeon
#

How are you doing ❤️

inland karma
#

doing well, prepping a talk for work after the lightllm attack, some guys at work wanted to know how it worked

gleaming knoll
#

i didnt hear about litellm even once until the incident

#

therefore its a marketing campaign /hj

velvet trout
#

Lmao

inland karma
#

i dont know who is the market for a third party thing to connect to an llm you are already paying for.

velvet trout
#

It was a funny issue tho, like in its comment, all bots were spamming and some people even advertised their rust programs i was like 😭🙏

inland karma
#

yeah, it was very well planned

gleaming knoll
inland karma
#

and they did manage to get high level access from people that should know how to use the -S flag

velvet trout
#

Why is it called as -S?

#

Like it doesn't even take an argument

inland karma
#

python -S

velvet trout
#

Its a boolean flag to no

inland karma
#

it disables the site module

#

!docs site

edgy krakenBOT
#

Source code: Lib/site.py

This module is automatically imported during initialization. The automatic import can be suppressed using the interpreter’s -S option.

Importing this module normally appends site-specific paths to the module search path and adds callables, including help() to the built-in namespace. However, Python startup option -S blocks this and this module can be safely imported with no automatic modifications to the module search path or additions to the builtins. To explicitly trigger the usual site-specific additions, call the main() function...

velvet trout
#

ik it disables site module importation

But capital S doesn't rather seem to say no to import site

-no-s would have made sense

Is it a known convention to have capital X where X is a no/disable for x?

stone hinge
#

Hello

gleaming knoll
stone hinge
#

I don't know how to program at all, what do you guys recommend?

edgy krakenBOT
gleaming knoll
velvet trout
inland karma
velvet trout
#

Where's iphone runtime

steel whale
stone hinge
inland karma
#

so the single characters can be picked arbitary, but they often are picked based on logic, like S for site and h for help

gleaming knoll
#

gcc does -category[no-]flag

velvet trout
velvet trout
nocturne monolith
#

would anyone happen to be able to point me in the direction of a good source of info on how to downgrade to an earlier 'no longer supported' version of python?

velvet trout
#

--no-site makes more sense IMO

steel whale
velvet trout
steel whale
#

i think

velvet trout
#

@grok is this true

gleaming knoll
velvet trout
inland karma
velvet trout
velvet trout
inland karma
gleaming knoll
inland karma
# velvet trout help msg?

sure, thats one example, i was more thinking of logically even if you had them next to each other, it would not look connected until you understood both

velvet trout
inland karma
#

i use spaces for values

#

i would never do -f=value

velvet trout
gleaming knoll
inland karma
#

in fact, if i had a tool like that, i would uninstall it

inland karma
velvet trout
#

option=value is used when the value has a '-' as prefix

gleaming knoll
velvet trout
#

--count=-4 will be required since --count -4, where -4 will be interpreted by the parser as an option

inland karma
#

i dont mind --count=value

#

but the parser knows that --count has value next, so -4 will still work

#

it will just arguably look strange

velvet trout
#

as per my understanding, parsers look at token with startswith("--") -> long option, startswith("-") -> short option

But -4 isn't really an option, if your option optionally takes an argument then its ambiguous for the parser to determine whether the next token with a - prefix is an option token or value for this option

inland karma
#

its your job to make the rules you are going to use

velvet trout
#

Real

inland karma
#

so dont invent problems that can happen because you have not written a solution for an edge case

velvet trout
#

Hm

inland karma
#

i do agree with @gleaming knolls comment, -X for flags, --something-verbose for values

#

well, my interpretation off the comment

velvet trout
#

I think i used cli programs which use short options with values too

Like -f

#

short options are easier to type but not so much context in their name.

granite wyvern
velvet trout
granite wyvern
#

Right. Whereas getop and argparse et al have to honour the spec when parsing - you can't infer whether an option has an argument just from the CLI - you also need the spec.

gleaming knoll
#

i made a personal hacky thing in xonsh btw, tool modname loads the modname module (like import modname) and adds its main function as a callable alias (with some hacky args parsing) under name modname, and also adds all tool_<x> functions as x, and x --help does x??
so

echo.py

def main(*args: str):
  print(args)
λ tool echo
Loaded module 'echo'
Tool 'echo' provides: {'echo'}

λ echo --help
def main(*args: str):
    print(*args)

λ echo 1 2
1 2

i just didnt like that source-ing has overhead, and if i just import then i need to call it as a function which is more to type than a cli call

granite wyvern
#

Purely for single letter options (to keep the example small), a getopt spec of abc:d means abc are single letter options and c is a single letter with an arguments.

In turn meaning:
-a -b sets a and b
-ab set a and b
-abc sets a and b and expects a following argument for c
-c 4 is c with argument 4
-c4 is also c with argument 4
-c a is c with argument a
-ca is also c with argument a

#

None of this is ambiguous if you have the spec to hand during the parse.

steel whale
#

i made the dumbest mistake ever

granite wyvern
steel whale
#

reading from a nullptr

velvet trout
#
  1. --count -4
    If option count in spec is defined as optionally-argument taking, then how would you determine the next token -4 is supposed to be its value or not?

--text -prefix
2) lets say --text is argument taking, required, but how would parser determine whether -prefix is a value for --text or another option (may or may not be defined in spec) or the user mistakenly typed it? It has to make guesses.

pithink

steel whale
gleaming knoll
#

java.lang.NullPointerException

steel whale
#

which in turn caused a segfault

jagged nacelle
#

Hmmh is there an .py TLD?

velvet trout
steel whale
jagged nacelle
steel whale
#

yes

jagged nacelle
#

pithink hm

steel whale
#

but theyre very expensive iirc

granite wyvern
#

!rule advert

edgy krakenBOT
#

6. Do not post unapproved advertising.

frosty oriole
#

lmfao

gleaming knoll
#

and why exactly are you advertising by spamming in discord if you're making 3k a day

jagged nacelle
fervent matrix
#

Just tell the scam straight up instead

granite wyvern
#

<@&831776746206265384> ^^

steel whale
#

dm me

bright shoal
#

Do you have a wall of knowledge?

velvet trout
steel whale
#

lets see if youre all bark

raw bramble
#

Where’s the link to your $4,000 course

velvet trout
slender urchin
#

!cleanban 1484472050738266226 scam

gleaming knoll
edgy krakenBOT
#

:incoming_envelope: :ok_hand: applied ban to @arctic monolith permanently.

granite wyvern
raw bramble
#

Computing is so messy :(

steel whale
jagged nacelle
velvet trout
slender urchin
gleaming knoll
raw bramble
velvet trout
granite wyvern
slender urchin
velvet trout
#

--text --parse-mode HTML

Suppose both can be real text or option

Only = can save here

granite wyvern
raw bramble
#

How convert 0 to 0000 and 14 to 0014 and such

jagged nacelle
slender urchin
#

Fstrings have this build in

granite wyvern
raw bramble
#

Programming really isn’t smart is it 😭 it’s just hiding the confusing things (it is smart but it’s not simple)

granite wyvern
velvet trout
#

If we follow this:

--text="--parse-mode HTML"
Parser will deterministically easily know that this is supposed argument for --text

--text --parse-mode HTML

here it will raise error for not providing argument for --text and will interpret --parse-mode (next token) as a legit option (regardless of being defined or not in spec)

raw bramble
dry yacht
raw bramble
#

What’s this meansung yeah

granite wyvern
granite wyvern
raw bramble
#

And 4 means pad it with 4 0s

#

And the d?

nocturne monolith
jagged nacelle
#

U should learn string formatting

granite wyvern
raw bramble
#

Too much to learn, not enough mental capacity to learn it

inland karma
#

take your time

surreal knot
velvet trout
granite wyvern
#

Read the spec (above). Learn the things you commonly use, and look things up when you need something uncommon.

raw bramble
#

Far too stressed about everything and overwhelmed with what I have to learn, so I can’t learn things because all my time is spent stressing about it haha

velvet trout
surreal knot
gleaming knoll
#

i unironically use printf in c++
because include iostream adds too much compile time
stupid overly complex template meta programming STL shit

granite wyvern
raw bramble
gleaming knoll
#

f is for floats

granite wyvern
#

decimal (10), hexadecimal (16), octal (8), binary (2)

raw bramble
#

Ohhhh

gleaming knoll
#

given that d is the format char for decimal
the format char for hex is!!! obviously!!
x. not h. yes

granite wyvern
#

!xkcd quartz

velvet trout
gleaming knoll
#

.xkcd 2501

gleaming knoll
granite wyvern
#

.xkcd 2501

verbal wedgeBOT
#

How could anyone consider themselves a well-rounded adult without a basic understanding of silicate geochemistry? Silicates are everywhere! It's hard to throw a rock without throwing one!

crisp grail
#

Hello

velvet trout
autumn forge
#

there are like 10 xkcd comics

crisp grail
#

How can I start teaching python

granite wyvern
gleaming knoll
#

this rabbit is not human bro

dry yacht
granite wyvern
crisp grail
#

Sorry

gleaming knoll
crisp grail
granite wyvern
granite wyvern
#

Ask here

granite wyvern
edgy krakenBOT
autumn forge
gleaming knoll
granite wyvern
velvet trout
crisp grail
autumn forge
#

I hope there is a 0th xkcd

gleaming knoll
velvet trout
gleaming knoll
#

i must say that learning is supposed to be hard even with a good resource
its 99% your effort and 1% resource effort

granite wyvern
runic flower
crisp grail
crisp grail
#

(My English is probably bad sorry)

granite wyvern
# crisp grail Idk

Some tutorials are better suited to some people and not others. Find one you fin approachable.

granite wyvern
gleaming knoll
runic flower
velvet trout
#

English is hard. Python's english is way easier.

granite wyvern
craggy mantle
crisp grail
runic flower
craggy mantle
#

guys how do i install pyautogui?

granite wyvern
gleaming knoll
velvet trout
#

windows doesn't put pip as a command? ducky_concerned

gleaming knoll
runic flower
craggy mantle
#

File "c:\Users\*\Desktop\*.py", line 1, in <module> import pyautogui ModuleNotFoundError: No module named 'pyautogui'
althogh installed it :/

velvet trout
#

Another reason why to pick Linux

granite wyvern
gleaming knoll
runic flower
gleaming knoll
velvet trout
craggy mantle
#

and now
No module named 'win32gui'

gleaming knoll
#

wdym "now"? what did you do that changed it?

runic flower
craggy mantle
velvet trout
craggy mantle
#

hm

#

how?

gleaming knoll
#

im not sure what non-sus program would use win32gui directly rather than as a transitive dependency which would've been installed with the library itself

velvet trout
craggy mantle
#

tryna make a popup thingy

velvet trout
#

You gotta be first romantic

velvet trout
gleaming knoll
runic flower
craggy mantle
runic flower
velvet trout
autumn forge
#

tkinter.messagebox is in the standard library

gleaming knoll
craggy mantle
willow portal
#

where can i learn python please

craggy mantle
#

for no reason

velvet trout
edgy krakenBOT
craggy mantle
#

ok i got it working

runic flower
# gleaming knoll lots of toptions - the bad english in question

I quite unfortunately never really learned to type properly so I still look at my keyboard while typing. And as I type fast, and if I'm not wearing reading glasses it results in a ton of dumb typos. And then on top of that you add "thinkos" where I will type "write" vs "right" or get a "they're" wrong and I end up editing most of the crap I type.
I'm amazed that I exist in a profession where typing a single character wrong will break your code.

velvet trout
#

😢

celest breach
runic flower
velvet trout
#

I brain even merged the with with -> withe automatically

#

For no reasons, probably because of th of with matching with the.

runic flower
#

Anyone see that thing on reddit about reading 900wpm ? I had no problem keeping up with that. But typing? I go tto fast and make mistakes. 🙂

soft coral
#

I used these at some point (~500 bucks), ended up not using it ...

#

Really difficult to get used to

soft coral
#

But they were very ergonomic. Glove80 they're called

velvet trout
#

That ain't look like a keyboard

soft coral
#

The cool thing is that you can use both your thumbs for more than just space

runic flower
soft coral
#

If you train with it, you can be very fast with it. especially all the special chars like brackets and parentheses and stuff

#

Yeah, it's not for gaming haha

#

wasd is all messed up

fierce merlin
#

Can anyone tell me when we need to use data types ?

runic flower
soft coral
soft coral
#

I bought them in my vim phase 😛

fierce merlin
#

Like tuple list set and so on

soft coral
#

Well which specifical;ly do you want to know. Why do you think you should use only 1?

fierce merlin
#

When they are useful in the code

runic flower
fierce merlin
#

No saying one

#

Data types

soft coral
#

I mean, they all have their benefits. Sets have a quick look-up, so if you want to check if a collection contains an item, set is much better than list f.e.

runic flower
soft coral
#

tuples are nice when you are working with something you don't want to mutate, etc.

raw bramble
#

Tuples are the worst

gleaming knoll
fierce merlin
#

Data types I've learned them but I don't know when to use them in a real code scenario

raw bramble
#

Dicts are the best

soft coral
raw bramble
#

I don’t really know where to use tuples

runic flower
soft coral
#

if you do return x, y that's a tuple

celest breach
raw bramble
gleaming knoll
raw bramble
fierce merlin
#

None

raw bramble
#

How expensive was it?

burnt pier
robust ledge
runic flower
raw bramble
#

I’ve only ever used regular typewriter keyboards >:(

#

Ortholinear is the only way keyboards should be, no more of this offset

runic flower
burnt pier
#

I think the offset is cute. Ortholinear ones have no character

celest breach
#

How does Python work though if the interpreter can't store the values of variables for later? Can you explain? @gleaming knoll

craggy mantle
#

when i do pip in any way it just says not recognized in cmd prmt

#

help

runic flower
gleaming knoll
raw bramble
craggy mantle
raw bramble
craggy mantle
gleaming knoll
craggy mantle
raw bramble
#

You assign a value to a name, or a name to a value?

craggy mantle
gleaming knoll
raw bramble
#

assign 5 to my_number

assign my_number to 5

#

Yeah you assign a value to a name, the latter feels wrong

crisp jay
runic flower
craggy mantle
raw bramble
crisp jay
celest breach
raw bramble
craggy mantle
gleaming knoll
raw bramble
craggy mantle
raw bramble
#

Anything is better than nano though

crisp jay
mossy sigil
#

FAFO

gleaming knoll
runic flower
crisp jay
mossy sigil
gleaming knoll
celest breach
#

FIDO (First In, Dog Out)

raw bramble
burnt pier
gleaming knoll
runic flower
crisp jay
crisp jay
#

Functions are actually static methods of global

raw bramble
#

I mean that if it’s something like x = 39589284, then Python stores a new object

raw bramble
runic flower
jagged nacelle
raw bramble
mossy sigil
#

Is it alright to say the n word on here I’m black btw it’s part of my lingo

burnt pier
#

hmm, won't constants also get inlined?

gleaming knoll
# burnt pier hmm, won't constants also get inlined?

what exactly do you mean by that
constants are created once in the co_consts of the code object they are in, yes, so running the code only makes a new reference to them each time, its not allocating a new integer for that constant

mossy sigil
raw bramble
celest breach
mossy sigil
#

Damn

runic flower
mossy sigil
#

Y’all are really going to censor a black man

craggy mantle
celest breach
raw bramble
#

Are you going to follow the rules or no?

sharp hemlock
#

it's just dialect 🤷

silver plover
edgy krakenBOT
#

:incoming_envelope: :ok_hand: applied warning to @mossy sigil.

runic flower
#

Alright, I have a website that needs coding, and a dungeon that needs crawling, see you all later!

mossy sigil
#

I didn’t even say it

mossy sigil
#

wtf

raw bramble
sharp hemlock
steady rain
#

@mossy sigil send a message to <@&714562188236423278> if you have any questions. You'll be muted if this continues.

mossy sigil
steady rain
sharp hemlock
#

lowkey why was he warned though

mossy sigil
#

Y’all are racist asf

silver plover
#

I warned you that dropping the N word is not permitted. That's literally a warning.

jagged nacelle
# sharp hemlock it's just dialect 🤷

Dialect varies in cultures, in Brazil we use the word gringo as anyone who isn't brazillian, but some people take the same word as a bad way so better just avoid

silver plover
chrome night
sharp hemlock
silver plover
#

!mute 1482215019771855061

granite wyvern
edgy krakenBOT
#

:incoming_envelope: :ok_hand: applied timeout to @chrome night until <t:1774568906:f> (1 hour).

mossy sigil
oblique spindle
gleaming knoll
#

so python

celest breach
#

In before the ban storm

oblique spindle
#

Let's come back to python

steady rain
#

.topic

verbal wedgeBOT
#
**What's your favorite Python related book?**

Suggest more topics here!

sharp hemlock
silver plover
#

!mute 846498827238506499 I don't know why you feel need to antagonize while we're trying to deal with this. So take a break.

edgy krakenBOT
#

:incoming_envelope: :ok_hand: applied timeout to @sharp hemlock until <t:1774568947:f> (1 hour).

steady rain
#

Fluent python

mossy sigil
gleaming knoll
silver plover
#

!mute 1321076256955043881 1d take a break and come back when you want to talk about Python

edgy krakenBOT
#

:incoming_envelope: :ok_hand: applied timeout to @mossy sigil until <t:1774651777:f> (1 day).

gleaming knoll
raw bramble
#

How do you speak Python

runic flower
# verbal wedge

What's your favorite Python related book?
So, Anyway...: A Memoir
by John Cleese

rocky gust
celest breach
raw bramble
gleaming knoll
runic flower
raw bramble
oblique spindle
crisp jay
gleaming knoll
ebon comet
#

I heard a rumour that the python repo got hacked and that all api keys e.g. pip related keys were exposed - is that true? Should I be concerned?

oblique spindle
burnt pier
runic flower
ebon comet
oblique spindle
gleaming knoll
#

the litellm repo
so if you used litellm (even transitively) then yes you should do something

oblique spindle
#

It's an AI company repo litellm which was hacked.
Python library

crisp jay
ebon comet
jagged nacelle
oblique spindle
ebon comet
#

yeah so basically lk I don't care!!!

crisp jay
#

Like that one npm worm

ebon comet
#

Thanks for the clarification

runic flower
gleaming knoll
oblique spindle
# crisp jay Can it hack other libraries?

Basically from how I understand,
if any library you download has code "import litellm" you can be hacked. If not you're safe.
.
And I don't think any Major libraries has this line.

autumn pelican
#

Or if a tool you use has it

jagged nacelle
ebon comet
#

ok thanks

bright shoal
rugged barn
#

Good timezone

bright shoal
#

There is a full timeline breakdown from Feb 2026 -> Mar 2026

ebon comet
#

No offence but given the situ I'm wary about clicking that link

bright shoal
oblique spindle
gleaming knoll
unborn lagoon
bright shoal
fickle sphinx
unborn lagoon
gleaming knoll
#

hacktoberfest???

silver plover
#

What's the supply chain fix to this tho? Why isn't the build artifact signed on the GitHub side at build time or something?

fickle sphinx
gleaming knoll
velvet trout
fickle sphinx
granite wyvern
velvet trout
#

I see

crisp jay
runic flower
gleaming knoll
#

i dont remember the last time i saw an attack that wasnt supply chain
maybe its the only ones i remember

crisp jay
bright shoal
runic flower
craggy mantle
#

guys whats the import to make my bot do math?

gleaming knoll
#

what kind of math?

craggy mantle
#

like

#

multiplication, div, etc

#

basic

crisp jay
#

Uhhhhh

short whale
#

Isn't that built in?

crisp jay
#

#include <math.h>

craggy mantle
#

i meant the thing at the top of the code

gleaming knoll
gleaming knoll
# craggy mantle /calculate

you should learn about parsing expressions, its fun and useful
do not use a library right away - it robs you from learning

runic flower
craggy mantle
#

mb chat

runic flower
gleaming knoll
soft mirage
#

Hi is it possible to use adjaceny matrix, for a directed traversal graph as the backbone of a text base adventure game? like a network of decisions?

My idea for a project, is the player is really interacting with matrix network, then that network produces the content, per the node and edges.

Is this a real thing?
I started Uni, and learned about graph theory, and wanted to implement it in my python game project

granite wyvern
runic flower
soft mirage
runic flower
craggy mantle
#

Should I use one file to save data for everything in my bot data. Or use seperate files for different things, like warnings, prefrences, etc.

granite wyvern
craggy mantle
runic flower
fickle sphinx
#

Are we talking configuration data?

runic flower
fickle sphinx
craggy mantle
craggy mantle
granite wyvern
fickle sphinx
granite wyvern
winged vector
#

im so confused guys, I'm trying to find the dot product between two latitude and longitude coordinates
i first convert them into cartesian coordinates but im struglling for the dot stuff

spark canyon
#

i'm in a beautiful predicament right now in which my code, unchanged, will sometimes run, but sometimes claim there's a syntax error on line 171, 173, or 175

soft mirage
fickle sphinx
spark canyon
#

i am assuming there is something wrong with the port of python i'm running, otherwise this should never happen right? lol

granite wyvern
runic flower
spark canyon
#

that's what i'm saying

granite wyvern
runic flower
winged vector
spark canyon
#

oh man, i can't copy text out of this terminal so i'd need a second

soft mirage
granite wyvern
spark canyon
#

but i literally press the run button twice and the first time it says
File "<stdin>", line 173
SyntaxError: invalid syntax
and the second time it says
File "<stdin>", line 175
SyntaxError: invalid syntax

granite wyvern
spark canyon
#

yeah it does not

burnt pier
soft mirage
#

Another idea is graph theory x rubiks cube

spark canyon
#

again i'm assuming this is an issue with the port or with my board because it's absolutely never supposed to happen

granite wyvern
# spark canyon but i literally press the run button twice and the first time it says File "<std...

I withdrawn this statement, it's clearly false.

Traceback (most recent call last):
  File "<frozen runpy>", line 189, in _run_module_as_main
  File "<frozen runpy>", line 159, in _get_module_details
  File "<frozen importlib._bootstrap_external>", line 1160, in get_code
  File "<frozen importlib._bootstrap_external>", line 1090, in source_to_code
  File "<frozen importlib._bootstrap>", line 488, in _call_with_frames_removed
  File "/Users/cameron/hg/css-pilfer/lib/python/cs/app/pilfer/print.py", line 201
    )))
     ^
SyntaxError: closing parenthesis ')' does not match opening parenthesis '[' on line 191
spark canyon
#

sure

winged vector
#

im gonna do it on paper, and then do ito n code

burnt pier
#

sounds like a plan

runic flower
# winged vector Ah

you know we have libraries that do that. this is a previously solved problem.

edgy krakenBOT
#

Hey @spark canyon!

Please edit your message to use a code block

Add a py after the three backticks.

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

This will result in the following:

print('Hello, world!')```
spark canyon
#

code expunged, ultimately was irrelevant to issue

granite wyvern
winged vector
craggy mantle
#

when using
import aiosqlite
why is the aiosqlite underlined red

spark canyon
#

yeah

gleaming knoll
spark canyon
#

again, the weird thing isn't just that it thinks there's a syntax error, it's that it only thinks so sometimes

granite wyvern
#

What aiosqlite instead of the supplied sqlite module?

spark canyon
#

i'm just pressing the run button in the ide

craggy mantle
gleaming knoll
#

the same way you install other packages, with pip

craggy mantle
granite wyvern
craggy mantle
#

Maybe I should restart VSC

granite wyvern
# craggy mantle Maybe I should restart VSC

I would hope that doesn't help 🙁

But I gather that for whatever reason, the python you choose for vscode (pick interpreter) is distinct from the python pylance looks at, and both need configuring. Super annoying. I gather.

fickle sphinx
fickle sphinx
winged vector
fickle sphinx
granite wyvern
fickle sphinx
#

I just like pointing that out whenever I can because it's something beginners should know

winged vector
velvet trout
#

Hi chat

spark canyon
#

no, i don't think so

winged vector
#

any vscode users how can i import a class from another file in my folder?

spark canyon
#

i think none of the other files in this folder are longer than maybe 100 lines

winged vector
#

ModuleNotFoundError: No module named 'RwyThresholdGuard'

spark canyon
#

plus, the other files in this folder actually work regularly

granite wyvern
# spark canyon no, i don't think so

In another window, list/show the content of the file from outside your editor. See if it's different.

Also, check that vscode (is it vscode?) is running the file you expect it to run.

fickle sphinx
crisp jay
#

Also importing python files isnt a vscode unique thing

winged vector
craggy mantle
#

time to read 2000 lines of code and make sure nothing is wrong 😃

spark canyon
#

it's not vscode, it's arduino lab

granite wyvern
rocky gust
ebon comet
spark canyon
#

well, not really. the run button here should always send the code currently open to the microcontroller regardless of if it's saved or has the right filename

granite wyvern
craggy mantle
spark canyon
#

to an esp32, yeah

#

that's why the file is "<stdin>"

granite wyvern
rocky gust
#

you should put it on github

craggy mantle
spark canyon
#

that actually would make a lot of sense. i can transfer the file properly and see if it's more consistent that way

granite wyvern
#

I know nothing about esp32 devices.

spark canyon
#

i think it's sending over the terminal yea

craggy mantle
#

im not an open source guy

rocky gust
#

fair ig

granite wyvern
#

It can be possible to "send too fast", either actually overrunning the serial through some setup mismatch, or overflowing the terminal buffer of whatever receives.

craggy mantle
spark canyon
#

ok yeah that worked. Sigh

granite wyvern
spark canyon
#

right

granite wyvern
#

Is there any scope for putting a slight delay in the seending of each line? Eg send line of code, delay 0.1s, repeat?

spark canyon
#

maybe if i could get it to talk at a different speed it might get more consistent

spark canyon
#

but this ide does not have many such options

granite wyvern
#

Surely you can set the serial line speed and other parameters (parity, stop bits etc)

#

Of course the esp32 has to match

craggy mantle
#

does a json file make a good data base 💀