#voice-chat-text-0

1 messages Β· Page 203 of 1

vocal basin
#

C# too

rugged root
#

That was for nullable, wasn't it?

vocal basin
#

JS and C# are similar

#

yes

#

@rugged root nullable

#

x can be None as it's Option<i32>

rugged root
#

What dos it do in that case

vocal basin
#

None.map(...) becomes None

#

Some(x).map(f) becomes Some(f(x))

whole bear
#

@rugged root like i had a question, how do some installers or scripts install their dependencies without internet

vocal basin
#

!d typing.Any

wise cargoBOT
#

typing.Any```
Special type indicating an unconstrained type.

β€’ Every type is compatible with [`Any`](https://docs.python.org/3/library/typing.html#typing.Any).

β€’ [`Any`](https://docs.python.org/3/library/typing.html#typing.Any) is compatible with every type.

Changed in version 3.11: [`Any`](https://docs.python.org/3/library/typing.html#typing.Any) can now be used as a base class. This can be useful for avoiding type checker errors with classes that can duck type anywhere or are highly dynamic.
whole bear
#

weird

vocal basin
#

I can't type

whole bear
#

no?

vocal basin
#
obj.val?.prop
obj.val?.[expr]
obj.func?.(args)
#

?.() not in C# because it uses methods rather than functions, I guess

#

because a method is guaranteed to be non-null, in some sense

whole bear
#

yea i would love if python had this

vocal basin
#

!e

from functools import partial

def curry(f):
    def inner(arg):
        return partial(f, arg)
    return inner

@curry
def repeat(n, f):
    def inner():
        for _ in range(n):
            f()
    return inner

@repeat(3)
def test():
    print(3)

test()
wise cargoBOT
#

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

001 | 3
002 | 3
003 | 3
vocal basin
#

decorator to write decorators

whole bear
#

rename str to rope

#

4

vocal basin
#

because f is only a singular argument

whole bear
#

this is still not elegant

#

the or will break on empty tokens

#

but we know these tokens will never be empty

#

so i guess its fine

#

i could make the digit be not inherting bytes

vocal basin
#

"I will start a petition against using DSA acronym wrong"

#

@gentle flint "types are a myth in SQLite"

#

I think it expects external functions to be used for value manipulation

#

!e

from functools import partial

def parameterised(f):
    def inner(*arg):
        return partial(f, *arg)
    return inner

@parameterised
def wrap(prefix, suffix, f):
    def inner():
        print(prefix)
        f()
        print(suffix)
    return inner

@wrap(1, 3)
def test():
    print(2)

test()
wise cargoBOT
#

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

001 | 1
002 | 2
003 | 3
whole bear
#

why wont this work

gentle flint
rugged root
#

"There are 10 kinds of people in the world. Those who understand binary and those who don't."

whole bear
#

can i do this?

def __int__(self):
   ...
rugged root
#

No wait, hold on

whole bear
#

i saw a __int__ there

rugged root
#

Yeah it is there

whole bear
#

str?

#

i thought str calls repr

stuck furnace
#

str calls repr if there is no __str__ implementation

rugged root
#

Yep

#

However repr() will not call __str__

whole bear
#

nice

#

thanks

gentle flint
whole bear
#

wdythink about this ?

stuck furnace
#

Yeah you melt the cheese in the little shovels underneath and cook stuff on top πŸ˜„

rugged root
#

That's amazing

dry jasper
stuck furnace
#

Start the day off with cheese sweats

dry jasper
#

starting off the why by sweating out cheese

rugged root
#

I'm more trying to figure out the how

#

Just right through the pores

#

Like a can of easy cheese

stuck furnace
#

Errrm, not much

#

Wdym sorry?

#

Oh right

rugged root
vocal basin
#

it almost surely does

stuck furnace
#

Yeah I think it does

vocal basin
#

isn't list contiguous too?

#

address array

#

like Vec in Rust

stuck furnace
#

I think lists are contiguous arrays of pointers to objects.

vocal basin
#

PyObject**

#

I guess

stuck furnace
#

Erm, in C you could have an array of values or pointers. Pointers are just data like anything else.

vocal basin
#

!e

from sys import getsizeof
a = []
for _ in range(11111):
    a.append(None)
print(getsizeof(a))
wise cargoBOT
#

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

95864
vocal basin
#

!e

print(95864/8)
wise cargoBOT
#

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

11983.0
vocal basin
#

!e

from sys import getsizeof
a = []
for _ in range(15111):
    a.append(None)
print(getsizeof(a))
wise cargoBOT
#

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

121432
vocal basin
stuck furnace
vocal basin
#
/* Vector of pointers to list elements.  list[0] is ob_item[0], etc. */
PyObject **ob_item;
#

getsizeof is speculative, I think

tepid edge
#

is this for list?

vocal basin
#

yes

tepid edge
#

i thought we were looking at array.array

rugged root
#

@flint yarrow Yo

stuck furnace
#

@indigo crag What do you want to stream?

#

Β―_(ツ)_/Β―

#

!stream 1097803309785567294

wise cargoBOT
#

βœ… @indigo crag can now stream until <t:1697646931:f>.

stuck furnace
#

Yeah sure

#

I'm a bit distracted though

whole bear
stuck furnace
#

Your keyboard's going crazy πŸ˜„

#

Oh right, so someone enters in e.g. seven, and your program prints out 7?

rugged root
stuck furnace
#

I'd first get the user's input: ```py
user_input = input('Please enter a number: ')

#

@indigo crag You have to save the output of the split function in a variable: ```py
words = user_input.split(',')

#

String methods always return a new string.

#

They don't ever modify the string in place.

whole bear
stuck furnace
#

@indigo crag What's the issue with your keyboard that makes it keep spamming the letter c?

whole bear
#

Regex courses are often TOO verbose

stuck furnace
#

Ahh right ok.

rugged root
whole bear
#

and I personally get lost while reading things since I have issues with concentration

#

Yeah I use that to test my shit

#

But not to learn

rugged root
#

Good as reference when doing the crossword at least

toxic arch
#

numbers[word]

#

sure

stuck furnace
#

Yep πŸ‘

rugged root
#

Yo FILE

toxic arch
#

hello mr hemlock

#
try:
    new_num = numbers[word]
except KeyError:
    print(f'Invalid number {word}')
stuck furnace
#

Do you want the result to be a single number?

#

Like 123

#

I.e. do you want the digits to be joined together?

toxic arch
#

theres alot of numbers

#

if you want every single number

#

also why is "zero" not there?

#

"0"

#
new_words = [numbers.get(word,'Invalid Number') for word in words]
#

maybe this can works

stuck furnace
indigo crag
rugged root
#

$14/month

gilded solstice
pulsar light
#

what u think mr.hemlock

rugged root
#

So one thing to help your code:

if (the_board[(1)] == the_board[(2)] == the_board[(3)] == 'X' 
  or the_board[(1)] == the_board[(4)] == the_board[(7)] == 'X'
  or the_board[(7)] == the_board[(8)] == the_board[(9)] == 'X'
  or the_board[(9)] == the_board[(6)] == the_board[(3)] == 'X'
  or the_board[(8)] == the_board[(5)] == the_board[(2)] == 'X'
  or the_board[(4)] == the_board[(5)] == the_board[(6)] == 'X'
  or the_board[(1)] == the_board[(5)] == the_board[(9)] == 'X' 
  or the_board[(7)] == the_board[(5)] == the_board[(3)] == 'X'):
  pass
pulsar light
#

oooo i did that before

#

but we dont need that

rugged root
#

It will help you check your logic way easier

amber raptor
#

couldn't you switch your way through that

rugged root
#

Also, it's a bit redundant to check for either X or O. All you care about per move is if there's a match

amber raptor
#

My guess is your teacher is going to fail you for not handling logic better

amber raptor
#

Yes

rugged root
#

!e

x = 4
if x:
  pass
pulsar light
#

im learning alone haha

amber raptor
#

then I'm failing you

wise cargoBOT
#

@rugged root :warning: Your 3.12 eval job has completed with return code 0.

[No output]
pulsar light
#

!e```py
x = 4
if x:
print(x)
pass

wise cargoBOT
#

@pulsar light :white_check_mark: Your 3.12 eval job has completed with return code 0.

4
pulsar light
#

ahh man i got it wrong

craggy forge
#

yo guys how do you make input that asks yes or no?

rugged root
#
user_input = input("Yes or no:  ")
karmic obsidian
#

!e
a=input("ye or no:")

gentle flint
craggy forge
#

so this should work if i would later use

#

if user_input == yes:

rugged root
#

Actually instead I'd do...

karmic obsidian
rugged root
#
user_input = input("Yes or no:  ").lower()

if user_input == "yes":
  ...
rugged root
#

That way you're always going to be checking for yes regardless of whether the person entered with caps or not

#

Could also strip off white space characters:

user_input = input("Yes or no:  ").strip().lower()
#

So that even if they entered spaces on either end of the input, it'll still work

vocal basin
#

(because invalid input shouldn't be interpreted as no)

if ... == "yes":
    ...
elif ... == "no":
    ...
else:
    ...  # blame the user
rugged root
#

Best else

pulsar light
craggy forge
#

it tells me that yes is not recognised as cmdlet function ...

pulsar light
#

give code

vocal basin
#

yes is not packaged with Windows, afaik

#

it is quite found in Linux

pulsar light
gentle flint
#

The Royal Netherlands Air Force (RNLAF; Dutch: Koninklijke Luchtmacht (KLu), "Royal Air Force") is the military aviation branch of the Netherlands Armed Forces. It was created in 1953 to succeed its predecessor, the Luchtvaartafdeling (English: aviation department) of the Dutch Army, which was founded in 1913. The aerobatic display team of the R...

#

@pulsar light

#

if you scroll down you'll see the roundel

gentle flint
#

os.listdir()

vocal basin
#

!d pathlib.Path.iterdir

wise cargoBOT
#

Path.iterdir()```
When the path points to a directory, yield path objects of the directory contents...
pulsar light
#
Google AR & VR

Augmented reality (AR) and Virtual Reality (VR) bridge the digital and physical worlds. They allow you to take in information and content visually, in the same way you take in the world. AR dramatically expands the ways our devices can help with everyday activities like searching for information, shopping, and expressing yourself. VR lets you ex...

rugged root
#

I don't think I'll be back on until I get back to the office. Having a weird anxiety spike and need music instead

dire quarry
#

hi guys
i just started coding and learning programming with python and work in backend.
i was worried about somethings.
that i really needs Data Structures and Algorithms ?
if i want to work as freelancering for long time do i really need that topic? or only by practice and coding more and learning more i can pass the way?
Thanks ❀️

leaden garden
#

learn_about = [hosting, frameworks, databases]

#

codewars = "codewars: a free website for programers to improve their coding solving skills"
backend = f"pick a popular language in backend and do {codewars}"

pulsar light
rugged root
#

@fierce summit py -m pip install [package_name_here]

pulsar light
rugged root
#

py -m pip list

#

!stream 469419943755120650

wise cargoBOT
#

βœ… @pulsar light can now stream until <t:1697661341:f>.

rugged root
#
n = int(input(' \n    Player X:   '))
if n ==0:
    os.system('cls')
    print(' \n   Thanks for playing.   \n   ')
    c = False
    c1 = False
    c2 = False
    d = False
    break
if n not in v_n:
    os.system('cls')
    print(' \n You can only type numbers from 1 to 9. \n ')
    break

if turns==9:
    print('Its a draw. ')
    c1 = False
    c2 = False
    break

if the_board[n] == ' ':
    the_board[n] = 'X'
    xo(the_board)
    c1 = False
    c2 = True
    turns +=1

...
#

@pulsar light

#

!e

for i in range(9):
  if i % 2 == 0:
    print("It's X's turn.")
  else:
    print("It's O's turn.")
wise cargoBOT
#

@rugged root :white_check_mark: Your 3.12 eval job has completed with return code 0.

001 | It's X's turn.
002 | It's O's turn.
003 | It's X's turn.
004 | It's O's turn.
005 | It's X's turn.
006 | It's O's turn.
007 | It's X's turn.
008 | It's O's turn.
009 | It's X's turn.
dreamy flame
#

is it tictactoe

pulsar light
#

yes

rugged root
#
    def _setup_board(self):
        self._current_moves = [
            [Move(row, col) for col in range(self.board_size)]
            for row in range(self.board_size)
        ]
        self._winning_combos = self._get_winning_combos()

     def _get_winning_combos(self):
        rows = [
            [(move.row, move.col) for move in row]
            for row in self._current_moves
        ]
        columns = [list(col) for col in zip(*rows)]
        first_diagonal = [row[i] for i, row in enumerate(rows)]
        second_diagonal = [col[j] for j, col in enumerate(reversed(columns))]
        return rows + columns + [first_diagonal, second_diagonal]
#
    def process_move(self, move):
        """Process the current move and check if it's a win."""
        row, col = move.row, move.col
        self._current_moves[row][col] = move
        for combo in self._winning_combos:
            results = set(
                self._current_moves[n][m].label
                for n, m in combo
            )
            is_win = (len(results) == 1) and ("" not in results)
            if is_win:
                self._has_winner = True
                self.winner_combo = combo
                break
#

!e

from pprint import pprint

board = [[None for _ in range(3)] for _ in range(3)]

pprint(board)
wise cargoBOT
#

@rugged root :white_check_mark: Your 3.12 eval job has completed with return code 0.

[[None, None, None], [None, None, None], [None, None, None]]
rugged root
#

!stream 469419943755120650

wise cargoBOT
#

βœ… @pulsar light can now stream until <t:1697663176:f>.

gentle flint
#

for diagonal summing how about

sum([board[i, i] for i in range(len(board))])
rugged root
#

(0, 2), (1, 1), (2, 0)

gentle flint
#

and for right to left```py
sum([board[i, -i-1] for i in range(len(board))])

elfin bone
#

hemlock

#

whats up

rugged root
#

Sup

elfin bone
#

going good

#

havent been able to code for the past week

#

too much school work

#

its annoying

#

havent been able to play much games either

rugged root
#

I know that feeling

elfin bone
#

ya

rugged root
#

Brain failing

fierce summit
rugged root
fierce summit
rugged root
#
<input type="number" id="quantity_65304fe40b3ca" class="input-text qty text" name="quantity" value="1" aria-label="Product quantity" size="4" min="1" max="4" step="1" placeholder inputmode="numeric" autocomplete="off"/>
pulsar light
rugged root
#

!e

from collections import Counter

ham = "I'm a huge fan of ham, dude"
totals = Counter(ham)
print(totals)
wise cargoBOT
#

@rugged root :white_check_mark: Your 3.12 eval job has completed with return code 0.

Counter({' ': 6, 'a': 3, 'm': 2, 'h': 2, 'u': 2, 'e': 2, 'f': 2, 'd': 2, 'I': 1, "'": 1, 'g': 1, 'n': 1, 'o': 1, ',': 1})
rugged root
#

Only problem is that it doesn't give that in proper order

midnight meadow
#

@rugged root

#

i just got a ping from a bot to verify?

#

i have no idea how it works its my first time joining here

#

im a college student and im studying a python course

rugged root
#

Oh it's just letting you know about the voice gate. For details, see the #voice-verification channel

midnight meadow
#

and i really just wanna learn

rugged root
#

What have you tried so far?

midnight meadow
#

Not much

#

we learned Slicing and Tuples

rugged root
#

Oh you mean in school?

midnight meadow
#

no no no

#

im a college student

rugged root
#

Still technically school

midnight meadow
#

For bachlers degree

#

i guess??

#

XD

#

so we basically work with lists and stuff

toxic venture
#
def first_non_repeating_letter(word):
    lower_word = word.lower()```
midnight meadow
#

but i think this is just the beginning tho

#

we're starting to dive abit deeper

rugged root
#

Any of the stuff you need clarification on? Always happy to explain stuff

#

!stream 469419943755120650

wise cargoBOT
#

βœ… @pulsar light can now stream until <t:1697665891:f>.

midnight meadow
#

not right now but if i do have any trouble ill come crying to u for sure

rugged root
#

HA, fair enough

#

We're always happy to explain stuff for sure

midnight meadow
#

much appriciated

pulsar light
toxic venture
rugged root
#

!e

ham = "I'm a huge fan of ham"
print(ham.count('h'))
wise cargoBOT
#

@rugged root :white_check_mark: Your 3.12 eval job has completed with return code 0.

2
rugged root
#

You have to tell it what character you want to count

toxic venture
#

Oh ok

#

thanks

#

I see niow

#

now*

rugged root
#

!e

from collections import Counter

ham = "I'm a huge fan of ham, dude"
totals = Counter(ham)
for char in totals.elements():
  print(char)
wise cargoBOT
#

@rugged root :white_check_mark: Your 3.12 eval job has completed with return code 0.

001 | Counter({' ': 6, 'a': 3, 'm': 2, 'h': 2, 'u': 2, 'e': 2, 'f': 2, 'd': 2, 'I': 1, "'": 1, 'g': 1, 'n': 1, 'o': 1, ',': 1})
002 | Counter({' ': 6, 'a': 3, 'm': 2, 'h': 2, 'u': 2, 'e': 2, 'f': 2, 'd': 2, 'I': 1, "'": 1, 'g': 1, 'n': 1, 'o': 1, ',': 1})
rugged root
#

Hmm

#

!e

from collections import Counter

ham = "I'm a huge fan of ham, dude"
totals = Counter(ham)
for char in totals.elements():
  print(char)
wise cargoBOT
rugged root
#

That's not insertion order

#

Why are you lying to me, Python

#

Ohhhhhh

#

Hmm

pulsar light
rugged root
#

I hopped down since I'm wrapping up my day

fierce summit
#

else:
p1 = 'X'
p2='O'
score_p2 += 1

#

elif p2 == 'X':
p1 = 'X'
p2 = 'O'
score_p2 += 1

willow light
#
using HTTP
function make_API_call(url)
    try
        response = HTTP.get(url)
        return String(response.body)
    catch e
        return "Error occurred : $e"
    end
end

response = make_API_call("http://jsonplaceholder.typicode.com/users")
println(response)

Julia, are you okay?

#

Why use end when you can use two spaces?

pulsar light
#

@rugged root

fierce summit
#

print(f"Player 1: {score_p1} \nPlayer2: {score_p2}")

#

print("Player 1", score_p1, "\nPlayer2:", score_p2)

#

@rugged root can you give @pulsar light permissions to stream?

pulsar light
stuck furnace
#

!stream 469419943755120650

wise cargoBOT
#

βœ… @pulsar light can now stream until <t:1697668694:f>.

fierce summit
#

thanks

pulsar light
#

thanks

fierce summit
#

|

#
print(f"Player 1 is {p1} | Player 2 is {p2}")
stuck furnace
#

One sec sorry

#

What do you want to stream @faint raven ?

faint raven
#

my code, sir

stuck furnace
#

!stream 266030641382948865

wise cargoBOT
#

βœ… @faint raven can now stream until <t:1697673535:f>.

faint raven
stuck furnace
faint raven
#

yes, yes

#

sir

shy raft
#

erm

#
print(booleon(''))
somber heath
#
Ghostbusters Wiki

Vigo (also known as Prince Vigo Von Homburg Deutschendorf, Scourge of Carpathia, Sorrow of Moldavia, Vigo the Carpathian, Vigo the Cruel, Vigo the Torturer, Vigo the Despised, Vigo the Unholy) is...

velvet patrol
#

@faint raven oi, y’all want to jump back up here?

somber heath
#

@gray nova πŸ‘‹

lunar venture
#

hi

#

i want

#

background

#

sound

#

so keep it going guys

somber heath
whole bear
#

Hi

lunar venture
#

@indigo crag

#

you are turkish

#

right

somber heath
#

@steel torrent πŸ‘‹

lunar venture
#

@somber heath you sound like my friend from perth

#

but are you from perth

#

thats like

#

east

#

coast?

#

alright

#

perth is like the west most part of austrailia if im not wrong bc we could still play games together without having the biggest timezone issues lol

somber heath
#

@gilded solstice πŸ‘‹

gilded solstice
lunar venture
#

@indigo crag hal shama chittori

#

weeb @whole bear

#

i dont talk to anime enjoyers

#

no

#

my grandfather knew farsi

#

@somber heath im joking im an anime enjoyer

#

fmab is the goated anime

#

my pfp is anime

gilded solstice
lunar venture
#

what if u lose and its not even bullet

#

thatd be sad @whole bear

#

no

#

chess is alright but i dont have the patience to think through that game

#

HAHHA

gilded solstice
lunar venture
#

i just

#

played

#

u

#

i never palyed

#

15

#

s

#

ive played

#

bullet

#

yteah fair

#

you cant spam moves

#

if you keep getting checked

#

guys

#

DO U HAVE TO POOP IF U HAVE CEREAL + MILK

#

in the morning

#

i have to

somber heath
#

@left roost πŸ‘‹

#

!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.

left roost
#
max_attempts = 0
x = 45

difficulty = {'easy': 1,
              
              'medium': 2,
              
              'hard': 3}
difficulty_option = input("""

           Choose your difficulty.

""")

if difficulty_option in difficulty:
  
  print (f"""
           You chose {value}
  """ )
  
print (f"""

                  Word Guessing Game
       You have {max_attempts} attempts to guess! Good luck!
""")
while True: 
 
  if attempts == max_attempts:
    if attempts == 5:
      print (f"You ran out of attempts, x = {x}.")
    exit()
  y = int(input("""
  
            Guess the number. It's 100 or under
  
  """))
  
  if y == x:
    attempts+=1
    print(f"""
------------------------------------------------------
                Attempt {attempts}.

    """)
    print (f"""
    
             Correct!

    It took {attempts} attempt(s)
    
    """)
    
        
  elif y > x:
    attempts+=1
    print(f"""
------------------------------------------------------  
                Attempt {attempts}.
    
    """)
    print (f"""
    
    x is less than {y}.
    
    """)
    continue
  elif y < x:
    attempts+=1
    print(f"""
------------------------------------------------------  
                 Attempt {attempts}.

    """)
    print(f"""
    x is greater than {y}.
    """)
    continue
  else:
    print("Please Enter a valid input...")
    continue
indigo crag
somber heath
#

!d random.randint

wise cargoBOT
#

random.randint(a, b)```
Return a random integer *N* such that `a <= N <= b`. Alias for `randrange(a, b+1)`.
somber heath
#

!e py import random for _ in range(5): print(random.randint(1, 100))

wise cargoBOT
#

@somber heath :white_check_mark: Your 3.12 eval job has completed with return code 0.

001 | 24
002 | 71
003 | 9
004 | 8
005 | 46
wise loom
#

Professional Software Engineering = Agile + Rank & Yank

left roost
#

attempts = 0
max_attempts = 15
x = 0


difficulty = input("""

           Choose your difficulty.

""")

if difficulty == "easy":
  x = random.randint(1, 10)
elif difficulty == "medium":
  x = random.randint(1, 50)
elif difficulty == "hard":
  x = random.randint(1, 100)
  
print (f"""

                  Word Guessing Game
       You have {max_attempts} attempts to guess! Good luck!
""")
while True: 
 
  if attempts == max_attempts:
    if attempts == 5:
      print (f"You ran out of attempts, x = {x}.")
    exit()
  y = int(input("""
  
            Guess the number.  
  
  """))
  
  if y == x:
    attempts+=1
    print(f"""
------------------------------------------------------
                Attempt {attempts}.

    """)
    print (f"""
    
             Correct!

    It took {attempts} attempt(s)
    
    """)
    
        
  elif y > x:
    attempts+=1
    print(f"""
------------------------------------------------------  
                Attempt {attempts}.
    
    """)
    print (f"""
    
    x is less than {y}.
    
    """)
    continue
  elif y < x:
    attempts+=1
    print(f"""
------------------------------------------------------  
                 Attempt {attempts}.

    """)
    print(f"""
    x is greater than {y}.
    """)
    continue
  else:
    print("Please Enter a valid input...")
    continue
vocal basin
#

3.5 billion

somber heath
#

All'o'yall'd've.

lucid shoal
#

πŸ˜‚

vocal basin
#

!e

from math import erf
print(2 / (1 - erf((100 - 7) / 15 / 2 ** .5)))
wise cargoBOT
#

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

3542132832.249878
vocal basin
#

the math behind the rat count

#

1 in 1771066416.124939 are outside of the 7~193 range
with 1 rat below 7 and 1 rat above 193

#

because IQ by definition is normally distributed
(it's just a way to convert ranking to a number)

lucid shoal
#

I wanna post a rat related meme so bad but i think i'd get banned

vocal basin
#

!e

iterable = [1, 2, 3]
iterator = iter(iterable)
while True:
    try:
        element = next(iterator)
    except StopIteration:
        break
    print(element)
wise cargoBOT
#

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

001 | 1
002 | 2
003 | 3
vocal basin
#

desugared for loop

#
for element in iterable
#   ^^^^^^^ this variable gets assigned on each iteration
#

!e

for (a, b) in [(1, 2), (3, 4)]:
    print(b, a)
wise cargoBOT
#

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

001 | 2 1
002 | 4 3
vocal basin
#

!e

iterable = [(1, 2), (3, 4)]
iterator = iter(iterable)
while True:
    try:
        (a, b) = next(iterator)
    except StopIteration:
        break
    print(b, a)
wise cargoBOT
#

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

001 | 2 1
002 | 4 3
vocal basin
#

just as usual assignment, supports tuple patterns

#

@sonic whale

vocal basin
#

and, like normal assignment, the variable remains assigned after the loop is done (if there was at least one iteration)
which works because Python doesn't have block scopes

#

!e

for x in [1, 2]:
    pass
print(x)
for y in []:
    pass
print(y)
wise cargoBOT
#

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

001 | 2
002 | Traceback (most recent call last):
003 |   File "/home/main.py", line 6, in <module>
004 |     print(y)
005 |           ^
006 | NameError: name 'y' is not defined
vocal basin
#

the loop doesn't unassign the variable, yes

#

if there are any elements, then it will be the last element
if there are no elements, it will be the same as before the loop

#

in almost all circumstances, variable should not be used after the loop until it is re-assigned

#

just to avoid errors

#

Ryright (VS Code's language server) will detect such potential errors
(PyCharm might do that too)

sonic whale
#

thanks!

dry jasper
#

answer = 0

#

answer += float

jolly pumice
#

I need to get some python going for some local build jobs, its not fun doing things in batch/bash

#

unrelated, anyone have experience with problem matchers and github actions? idk if its just me but coming up with these on the fly is such a pain

thick nymph
#

ok

#

so

#

maatchers and github actions? idk if its just me but coming up with these on the fly is such a pain

#

the loop doesn't unassign the variable

#

i just

#

copy and paste

vocal basin
#

!e

print([x * x for x in [1, 3, 5]])
print(x)
wise cargoBOT
#

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

001 | [1, 9, 25]
002 | Traceback (most recent call last):
003 |   File "/home/main.py", line 2, in <module>
004 |     print(x)
005 |           ^
006 | NameError: name 'x' is not defined
thick nymph
#

huhhh

#

001 | [1, 9, 25]
002 | Traceback (most recent call last):
003 | File "/home/main.py", line 2, in <module>
004 | print(x)
005 | ^
006 | NameError: name 'x' is not defined

#

seems real

jolly pumice
thick nymph
#

Reading some of these docs looks like gibberish tbh, could be because im tired or something but usually its not this hard trying to read woahh

vocal basin
#

!e

print((x for x in range(10)))
print([x for x in range(10)])
print({x for x in range(10)})
print({x: x for x in range(10)})
wise cargoBOT
#

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

001 | <generator object <genexpr> at 0x7f471c38cac0>
002 | [0, 1, 2, 3, 4, 5, 6, 7, 8, 9]
003 | {0, 1, 2, 3, 4, 5, 6, 7, 8, 9}
004 | {0: 0, 1: 1, 2: 2, 3: 3, 4: 4, 5: 5, 6: 6, 7: 7, 8: 8, 9: 9}
vocal basin
#

expression equivalent of a for loop

#

to create generators, lists, sets and dictionaries

vocal basin
thick nymph
#

huhh

#

got it

vocal basin
#

quoted text
comment related to original text

> no-formatting quoted text
or like this

vocal basin
#

yes

thick nymph
#

i cant able to talk in vc

vocal basin
thick nymph
#

i think i already did 50 messages

vocal basin
#

not yet

#

3739 rn

#

!e

print(*(x for x in range(10)))
print(*[x for x in range(10)])
print(*{x for x in range(10)})
print(*{x: x for x in range(10)})
wise cargoBOT
#

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

001 | 0 1 2 3 4 5 6 7 8 9
002 | 0 1 2 3 4 5 6 7 8 9
003 | 0 1 2 3 4 5 6 7 8 9
004 | 0 1 2 3 4 5 6 7 8 9
vocal basin
#

all four types created by comprehensions are iterable

#

e.g. can be used in a for loop, passed as *args, etc.

#

!e

def process(x):
    print('processing', x)
    return x * 10

gen = (process(x) for x in range(3))
for processed in gen:
    print(processed)
wise cargoBOT
#

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

001 | processing 0
002 | 0
003 | processing 1
004 | 10
005 | processing 2
006 | 20
vocal basin
jolly pumice
# vocal basin parts about integrating it or about the config format?

config format is fine, its just json. its the integration that im so lost in.

ive looked on the marketplace for specific problem matchers and what im looking for isn't listed. if it was something like the starter actions like setup-python or anything of that sort i think i would be fine.

also the build takes years to complete since its a massive project that has reached the limits of the standard runners

vocal basin
#

are you using caching?

#

or does it need to be rebuilt from scratch always?

jolly pumice
#

rebuilt from scratch always, if i could find something to cache brew or apt packages that would cut down so much time but the main crux is the actual project

vocal basin
#

have you tried docker-based actions?

jolly pumice
#

i havent but it is something in the works kinda

vocal basin
#

with all the installs happening during image build stage

#

idk how much GitHub caches the images

jolly pumice
#

✨magic✨

#

(i have no idea, a checksum of the image i think does the trick)

vocal basin
#

GitHub might just delete the image, they're not obliged to store it forever

#

storing base images on dockerhub might be an option
or on whatever GitHub has that actually has some retention guarantees

jolly pumice
#

they are not obligated which is fine, it only fetches the cache when there isnt an update and that is not a problem with something like pulling Qt from somewhere and caching it since that takes time depending on how the individual runner is feeling

vocal basin
#

but that didn't include apt dependencies and other system-level things

#

only target directory itself

#

(I used it for Rust)

jolly pumice
#

Im doing this with C++ husk

#

basically im converting a crumbling and slowly melting jenkins instance into a series of jobs for github actions, its been a task as ive spent many months doing this

vocal basin
#

> a massive project
is there an option to split it?
I'd expect C++ allows compiling static libraries separately for the most part

#

how long is the build taking right now?

#

several minutes? hours?

#

(days?)

jolly pumice
#

on average each build job takes about 3.5 hours, a codeql job takes like 7+ hours

#

the jenkins instance takes days to complete a single job, and thats praying the nodes running dont crash and go offline

#

and right now looking at that instance it is backed up by 139 jobs pending with no available runners

#

its okay if you tell me this is absurd and dumb since ive been telling myself this is stupid and dumb since ive taken this on

vocal basin
#

are some of those apt dependencies what the program links to?
or are all of them required for the build system itself?

jolly pumice
#

all of them are required. and then when you do the Cmake steps it then proceeds to download Chromium and even NodeJS to use as its also a dependency.

MPV was a nightmare too, since a specific version isnt available on ubuntu 20.04 and i cannot for the life of me get a consistent build of mpv without a dependency being broken for it

vocal basin
#

is chromium used as a library or as an executable?

jolly pumice
#

both

#

well, more a library

#

but it runs chromium

vocal basin
#

static or dynamic?
I'd expect dynamic for chromium

jolly pumice
#

dynamic

#

its an opengl app using chromium as its ui, and it also has its own ui for special things that the chromium doesnt have as its more developer or enthusiast

#

im not on the team building it, just a contributor who has spent many years working with the people building it

#
-----------------------------------------------------------------------------------
Language                         files          blank        comment           code
-----------------------------------------------------------------------------------
JSON                                29             15              0         233998
C++                                584          28261          28490         152201
C/C++ Header                       657          20029          42642          67168
CSV                                 25              1              0          13215
GLSL                               191           2235           5611           6647
CMake                               73            686           1882           4031
JavaScript                           5            872            401           3900
HCL                                  2           1072              0           3210
XML                                 12            111            140           2838
XSD                                  6            149            197           2071
Lua                                  7            198            116           1134
YAML                                 5             94             32            603
Python                               4            214            121            523
SVG                                  3              4              3            383
CSS                                  3             64             13            313
Handlebars                          10              1              0            265
Objective-C++                        1             45             33            206
Markdown                            12             49              0            164
INI                                  1             17              0            105
DOS Batch                            1             20              6             72
Windows Resource File                2             20             25             35
-----------------------------------------------------------------------------------
SUM:                              1633          54157          79712         493082
-----------------------------------------------------------------------------------

this is without the submodules even checked

sonic whale
#

fname = input("Enter file name: ")
fh = open(fname)
lst = list()
for line in fh:
line = line.strip()
line = line.split()
print(line)

dire quarry
#

hi guys
i just started coding and learning programming with python and work in backend.
i was worried about somethings.
that i really needs Data Structures and Algorithms ?
if i want to work as freelancering for long time do i really need that topic? or only by practice and coding more and learning more i can pass the way?
Thanks

somber heath
#

The more tools you have, the fewer you'll need to use for a given problem.

#

If you have the one correct tool for a job, you don't need additional tools for the job.

#

The fewer tools you have to use, the more elegant the solution.

dire quarry
dire quarry
somber heath
#

It won't hurt you.

#

It's a good idea to be able to know how to do a thing in a few minutes that would otherwise take the heat death of the universe and more gigabytes of ram than there are atoms to complete.

#

For the sake of "Should I learn x?" questions, let's just assume the answers range from, "Sure, if you want" to "Absolutely."

dire quarry
dire quarry
somber heath
#

Concentrate on understanding the foundational concepts of the language.

#

Build on that.

#

Keep building on that.

#

Until you reach where you:re building to

#

The more you know, the more you'll start having informed opinions on what else you need to know.

dire quarry
#

so you tell me that focus on Language completly syntax or should i learn data structures and logarithms and big O and ,,,?

somber heath
dire quarry
#

i mean full focus on language syntax and be good at it is enough? or shoud i follow another steps like big O and ....?

somber heath
#

It doesn't matter. Just keep learning things.

#

You will need to learn syntax at some point.

#

Otherwise what's the point?

dire quarry
#

yeah i undrestand now

#

i will need to other stuffs

#

for be better and better

#

exactly for Backend

#

yeah?

somber heath
#

I'm not a backend developer.

#

If I needed to be, I know enough to be able to pick up documentation and figure out what would be involved.

#

Possibly.

#

I think that if you focus on the language itself, first, then you aren't fighting to learn the language and something else at the same time. It'd be like having no knowledge of Lithuanian and having someone explain, in Lithuanian, how to do something you don't know how to do.

#

Whereas if you did understand Lithuanian fluently, you'd be able to concentrate on learning the thing.

dire quarry
#

ok brother, thank you so much for giving me your time.

turbid sandal
#

you're welcome

somber heath
#

My spokesperson, Super </dev>.

dire quarry
#

:)))

#

nice to meet u Spokesperson

turbid sandal
#

haha

wind raptor
#

Hey @turbid sandal

turbid sandal
#

hey

wind raptor
#

!stream 1053732836693258391

wise cargoBOT
#

βœ… @turbid sandal can now stream until <t:1697719339:f>.

celest mantle
# dire quarry hi guys i just started coding and learning programming with python and work in b...

@dire quarry if you need a place to start, you could do a lot worse than https://hyperskill.org/tracks/41. The study material is free although the quizzes are limited to 10 per day for free users. I think it has enough structure to set you on the right path and will cover 95% of everything you might need for 95% of jobs. Happy learning.

Hyperskill

Get theory, practice coding, and move beyond programming challenges to building your own working projects. Join over 600 000 learners at Hyperskill.

wind raptor
#

!stream 1053732836693258391

wise cargoBOT
#

βœ… @turbid sandal can now stream until <t:1697723074:f>.

dry jasper
fervent grail
#

May anyone help me ?

somber heath
fervent grail
#

just making a cli game

#

but i had a problem

rugged root
#

The performance profile of isinstance() checks against runtime-checkable protocols has changed significantly. Most isinstance() checks against protocols with only a few members should be at least 2x faster than in 3.11, and some may be 20x faster or more. However, isinstance() checks against protocols with fourteen or more members may be slower than in Python 3.11. (Contributed by Alex Waygood in gh-74690 and gh-103193.)

somber heath
#

@ornate mica πŸ‘‹

ornate mica
#

hi

rugged root
#

HA

#

Remove support for obsolete browsers from webbrowser. The removed browsers include: Grail, Mosaic, Netscape, Galeon, Skipstone, Iceape, Firebird, and Firefox versions 35 and below (gh-102871).

#

Oh no, whatever will I do without Netscape!?!?

hasty blaze
#

Chris How are you πŸ™‚

wind raptor
#

Good, thanks. How about you?

#

Did you get things working yet?

hasty blaze
#

no 😭

#

it started annoying me....

shell yacht
#

Any maniac that may have watched all Harvard CS50 courses yearly and would recommend a specific year to watch for today's standards?

#

Kinda off-topic, didn't seem to find an appropiate channel to ask but here lol

wind raptor
hasty blaze
rugged root
#

Dude this is going to drive me crazy

#

There's PyPy, pyjion, Numba, pyinstaller....

#

There's another one I just can't remember what the name is

#

Found it

#

Nuitka

woeful salmon
amber raptor
woeful salmon
#

seems pretty popular

rugged root
#

!pip cython

wise cargoBOT
#

The Cython compiler for writing C extensions in the Python language.

whole bear
#

Hi @vocal basin

woeful salmon
#

@rugged root ansble docs front page for yaml syntax 🀣 likes emacs: TRUE

rugged root
#

Jesus

woeful salmon
#

that's the only all caps one too

#

i've switched 100% to neovim at this point btw :x unless i'm working with java in which case i still use idea

amber raptor
#

!e ```python
a = list()
for x in range(0,50):
a += list(x)
print(a)

b = ()
for x in range(50):
b.append(x)
print(b)```

wise cargoBOT
#

@amber raptor :x: Your 3.12 eval job has completed with return code 1.

001 | Traceback (most recent call last):
002 |   File "/home/main.py", line 3, in <module>
003 |     a += list(x)
004 |          ^^^^^^^
005 | TypeError: 'int' object is not iterable
rugged root
#

!e

a = []
for x in range(0,50):
  a += [x]
print(a)

b = []
for x in range(50):
  b.append(x)
print(b)
wise cargoBOT
#

@rugged root :white_check_mark: Your 3.12 eval job has completed with return code 0.

001 | [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49]
002 | [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49]
amber raptor
#
$a = @()```
#

!e ```python
a = list()
for x in range(0,50):
a += [x]
print(a)

b = []
for x in range(50):
b.append(x)
print(b)```

wise cargoBOT
#

@amber raptor :white_check_mark: Your 3.12 eval job has completed with return code 0.

001 | [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49]
002 | [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49]
rugged root
#
a = [i for i in range(50)]
mild quartz
#

what is the syntax to use python

#

!e then what

wise cargoBOT
#

@mild quartz :x: Your 3.12 eval job has completed with return code 1.

001 |   File "/home/main.py", line 1
002 |     then what
003 |          ^^^^
004 | SyntaxError: invalid syntax
dusk raven
#

!e

a = [*range(50)]
print(a)```
woeful salmon
#

!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.

mild quartz
#

!e

for i in range(100):
  print("HEMLORK")
wise cargoBOT
#

@mild quartz :white_check_mark: Your 3.12 eval job has completed with return code 0.

001 | HEMLORK
002 | HEMLORK
003 | HEMLORK
004 | HEMLORK
005 | HEMLORK
006 | HEMLORK
007 | HEMLORK
008 | HEMLORK
009 | HEMLORK
010 | HEMLORK
011 | HEMLORK
... (truncated - too many lines)

Full output: https://paste.pythondiscord.com/NBPLTHCACVTEVIPYUSC45BEMKI

mild quartz
#

πŸ™‚

wise cargoBOT
#

@dusk raven :white_check_mark: Your 3.12 eval job has completed with return code 0.

[0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49]
mild quartz
#

!e

print("formatting?")
woeful salmon
#
- a = list()
- for x in range(0,50):
-   a += [x]
- print(a)

+ b = []
+ for x in range(50):
+   b.append(x)
+ print(b)
wise cargoBOT
#

@mild quartz :x: Your 3.12 eval job has completed with return code 1.

001 | Traceback (most recent call last):
002 |   File "/home/main.py", line 1, in <module>
003 |     python3
004 | NameError: name 'python3' is not defined
rugged root
#

!timeit

a = [i for i in range(1000)]
wise cargoBOT
#

@rugged root :white_check_mark: Your 3.12 timeit job has completed with return code 0.

5000 loops, best of 5: 45.1 usec per loop
amber raptor
#

!timeit

wise cargoBOT
#
Missing required argument

code

#
Command Help

!timeit [python_version] [setup_code] <code, ...>
Can also use: ti

Profile Python Code to find execution time.

This command supports multiple lines of code, including code wrapped inside a formatted code block. Code can be re-evaluated by editing the original message within 10 seconds and clicking the reaction that subsequently appears.

If multiple formatted codeblocks are provided, the first one will be the setup code, which will not be timed. The remaining codeblocks will be joined together and timed.

Currently only 3.12 version is supported.

We've done our best to make this sandboxed, but do let us know if you manage to find an issue with it!

amber raptor
#

!timeit python a = list() for x in range(0,50): a += list(x) print(a)

wise cargoBOT
#

@amber raptor :x: Your 3.12 timeit job has completed with return code 1.

001 | Traceback (most recent call last):
002 |   File "/lang/python/default/lib/python3.12/timeit.py", line 330, in main
003 |     number, _ = t.autorange(callback)
004 |                 ^^^^^^^^^^^^^^^^^^^^^
005 |   File "/lang/python/default/lib/python3.12/timeit.py", line 226, in autorange
006 |     time_taken = self.timeit(number)
007 |                  ^^^^^^^^^^^^^^^^^^^
008 |   File "/lang/python/default/lib/python3.12/timeit.py", line 180, in timeit
009 |     timing = self.inner(it, self.timer)
010 |              ^^^^^^^^^^^^^^^^^^^^^^^^^^
011 |   File "<timeit-src>", line 46, in inner
... (truncated - too many lines)

Full output: https://paste.pythondiscord.com/QW5D3HMEYEI7CMBJBGU6VTETPA

rugged root
#

!timeit

a = [*range(1000)]
wise cargoBOT
#

@rugged root :white_check_mark: Your 3.12 timeit job has completed with return code 0.

10000 loops, best of 5: 21.2 usec per loop
rugged root
#

!timeit

a = []
for i in range(1000):
  a += [i]
wise cargoBOT
#

@rugged root :white_check_mark: Your 3.12 timeit job has completed with return code 0.

1000 loops, best of 5: 157 usec per loop
rugged root
#

!timeit

a = []
for i in range(1000):
  a.append(i)
wise cargoBOT
#

@rugged root :warning: Your 3.12 timeit job timed out or ran out of memory.

[No output]
rugged root
#

!timeit

a = []
for i in range(1000):
  a.append(i)
wise cargoBOT
#

@rugged root :white_check_mark: Your 3.12 timeit job has completed with return code 0.

5000 loops, best of 5: 60.6 usec per loop
rugged root
#

!timeit

a = []
for i in range(1000):
  a += [i]
wise cargoBOT
#

@rugged root :white_check_mark: Your 3.12 timeit job has completed with return code 0.

2000 loops, best of 5: 152 usec per loop
vocal basin
#

+= [i] is O(1) time amortized

#

am finally back at the PC

#

!timeit

a = []
for i in range(1000):
  a.extend([i])
wise cargoBOT
#

@vocal basin :white_check_mark: Your 3.12 timeit job has completed with return code 0.

2000 loops, best of 5: 147 usec per loop
vocal basin
#

+= is extend usually

#

|= is update

#

!timeit

a = []
assert not a
for i in range(1000):
  a += [i]
wise cargoBOT
#

@vocal basin :x: Your 3.12 timeit job has completed with return code 1.

001 | Traceback (most recent call last):
002 |   File "/lang/python/default/lib/python3.12/timeit.py", line 330, in main
003 |     number, _ = t.autorange(callback)
004 |                 ^^^^^^^^^^^^^^^^^^^^^
005 |   File "/lang/python/default/lib/python3.12/timeit.py", line 226, in autorange
006 |     time_taken = self.timeit(number)
007 |                  ^^^^^^^^^^^^^^^^^^^
008 |   File "/lang/python/default/lib/python3.12/timeit.py", line 180, in timeit
009 |     timing = self.inner(it, self.timer)
010 |              ^^^^^^^^^^^^^^^^^^^^^^^^^^
011 |   File "<timeit-src>", line 44, in inner
... (truncated - too many lines)

Full output: https://paste.pythondiscord.com/SPEAMQ63U5S2Z2NH2CHHH3E4PM

vocal basin
#

!timeit

wise cargoBOT
#
Missing required argument

code

#
Command Help

!timeit [python_version] [setup_code] <code, ...>
Can also use: ti

Profile Python Code to find execution time.

This command supports multiple lines of code, including code wrapped inside a formatted code block. Code can be re-evaluated by editing the original message within 10 seconds and clicking the reaction that subsequently appears.

If multiple formatted codeblocks are provided, the first one will be the setup code, which will not be timed. The remaining codeblocks will be joined together and timed.

Currently only 3.12 version is supported.

We've done our best to make this sandboxed, but do let us know if you manage to find an issue with it!

vocal basin
#

actually, there should be three parts then

#

setup for all tests
setup for a single test
test

#

but that's too complex

#

!d unittest.mock

wise cargoBOT
#

New in version 3.3.

Source code: Lib/unittest/mock.py

unittest.mock is a library for testing in Python. It allows you to replace parts of your system under test with mock objects and make assertions about how they have been used.

unittest.mock provides a core Mock class removing the need to create a host of stubs throughout your test suite. After performing an action, you can make assertions about which methods / attributes were used and arguments they were called with. You can also specify return values and set needed attributes in the normal way.

rugged root
#

Forgot fuzz testing was a thing

vocal basin
#

@obsidian dragon just move to Russia for no youtube ads

#

they're not really in Russia

#

Cyprus/Czech Republic or somewhere else

#

headquartered at, at least

#

and many of developers fled the country because yes

rugged root
#

No YouTube ads and potentially no YouTube!

vocal basin
#

they're trying to force people to use government-controlled platform
but failing

#

that's a lot of money

#

(JetBrains)

#

half a billion dollar in assets

#

Russian Wikipedia lists these as "location":
Czech Republic, USA, Germany, Netherlands, Cyprus, Serbian, Armenia

#

it was founded in Prague

#

and it's still in Prague

#

by three Russian software developers

haughty fog
#

S-lang

vocal basin
#

@wind raptor there are legitimate reasons for is-even/is-odd to exist
but that specific implementation doesn't address those reasons, iirc

#

or at least not fully
and/or it's made as too much of a troll/meme/npm abuse

#

just copy and link to the original, yes

gentle flint
#

!pypi httpx

wise cargoBOT
vocal basin
#

futures in Rust are "unstable" too

#

but that for a different reason

gentle flint
rugged root
#

!pypi sniffio

wise cargoBOT
rugged root
#

Huh

#

It's really interesting looking through all the different dependencies the libraries we use have

#

Brony Hawk

vocal basin
#

Rust has necessity to detect async runtime too in some cases

#

mostly because tokio did something wrong

rugged root
#

That's the backend web thing? Or wait that's rocket...

vocal basin
#

in context of odd async, there is tornado

#

which did async before async/await was in Python

#

it's not dead but it's old

#

starlette rather than fastapi

rugged root
#

Right right

vocal basin
#

Flask has no ASGI support still

#

I think

#

oh

#

wow

#

that's new

#

yeah, that's still bad

#

i.e. it doesn't work

#

it's not ASGI

#

Django has proper ASGI

#

@woeful salmon if a worker process expects ASGI, there is a need for middleware

#

it's only for compatibility

#

there is 0 reason to use ASGI with Flask otherwise

#

it will negatively impact performance

#

Django

#

FastAPI

#

both support both, I think

#

(wsgi/asgi)

#

Quart (async Flask)

rugged root
#

Ah right right

vocal basin
#

I've seen something like two people use it

#

Flask is fundamentally broken

#

this is very wrong

from flask import request

@app.route('/login', methods=['GET', 'POST'])
def login():
    if request.method == 'POST':
        return do_the_login()
    else:
        return show_the_login_form()
#

request thing specifically

#

does it use contextvars?

#

!d contextvars

wise cargoBOT
#

This module provides APIs to manage, store, and access context-local state. The ContextVar class is used to declare and work with Context Variables. The copy_context() function and the Context class should be used to manage the current context in asynchronous frameworks.

Context managers that have state should use Context Variables instead of threading.local() to prevent their state from bleeding to other code unexpectedly, when used in concurrent code.

See also PEP 567 for additional details.

New in version 3.7.

rugged root
#

Which

vocal basin
#

I'd very much rather have request as an argument than a global implicitly scoped variable

#

FastAPI's approach also helps see exactly what routes access request metadata and which don't

#

at the cost of an extra argument

rugged root
vocal basin
#

Rust has two ways to use the builder pattern

#

which is something uncommon to think about for usual OOP languages

vocal basin
potent carbonBOT
#
Command not found

Command "mut" is not found

rugged root
#

I'm not going to use it.

#

I'm just thumbing through the standar lib

vocal basin
#

small self is not a type

amber raptor
#

You are going to learn beanstalkd

vocal basin
#

it's a variable and a keyword

amber raptor
#

my new company uses beanstalkd so I've confirmed it's in production

vocal basin
#

self: Self

#

self: Box<Self>

#

yeah, just a simplification

vocal basin
#

there are some more cursed things about Rust

#

for example, some pointers are twice as large

#

despite being called raw pointers

#

pointers to str, [T] and dyn Trait

#

object

#

dynamic dyspatch of trait methods

rugged root
#

Huh, there's a handful of beanstalkd Python implementations

vocal basin
rugged root
#

Or client lib I guess

vocal basin
#

you can't have dyn Trait on the stack

#

because it's unsized

#

just like str

woeful salmon
#

pointer to &str or just str?

vocal basin
#

&str, *const str both consist of two parts

#
  1. pointer to the first byte
  2. length
#

usize address + usize length

rugged root
#

@amber raptor Was greenstalk the one you've talked about before?

vocal basin
#

16 bytes normally

#

whereas &SomethingSized is 8 bytes

#

or whatever usize size is

#

and for objects it stores a pointer to the vtable

#

ig it is a term

#

zero
dynamic
non-existent

#

and extern

rugged root
#

Noted. Bookmarked to look at it later

vocal basin
#

zig helps to cross-compile Rust

amber raptor
rugged root
#

no u

amber raptor
#

I already did

rugged root
#

I'm working on the bot fix first

#

Or change I guess

amber raptor
#

Introduce BeanStalkd into the bot

vocal basin
#

doesn't Ocen still compile to C?

amber raptor
#

Someone put redis into the bot. Mistakes were long made

vocal basin
rugged root
#

HA

#

What lib is that

amber raptor
vocal basin
#

depends on the definition of "compile"

#

it relies on C to run

#

on compiling to C

#

well, ig, readme says "transpiles" so okay

#

weird terms meaning the same thing

cobalt cloak
#

im in the bomb shelter now

vocal basin
#

stability, human writability, etc.

cobalt cloak
#

i had an air raid alarm

rugged root
#

Stay safe

cobalt cloak
#

i will

vocal basin
#

(depends on complexity/intent/etc., I guess)

rugged root
#

I kind of think of transpiles just change the language, compilers make optimizations

#

I haven't seen some of these before

vocal basin
#

where did uck go

#

for a moment I though I haven't heard of Love2D before but then I remembered seeing it, like, 1~4 years ago

#

Lua game engine something something

#

is this what
replit?

#

yeah, they put game engines separately

#

to support graphics

rugged root
#

There's a handful of game libraries on there

vocal basin
#

extend node with Python.h
bundle that into electron
feel the pain

rugged root
#

It's a bit old, though

#

But it's the one that first jumps to mind

#

Another possibility

vocal basin
rugged root
#

Reason I'm familiar with, Emoticon I'm unfortunately aware of

ionic ferry
#

thanks for the info

vocal basin
#

Bloop was an ultra-low-frequency, high amplitude underwater sound detected by the U.S. National Oceanic and Atmospheric Administration (NOAA) in 1997. By 2012, earlier speculation that the sound originated from a marine animal was replaced by NOAA's description of the sound as being consistent with noises generated via non-tectonic cryoseisms or...

#

BlooP and FlooP (Bounded loop and Free loop) are simple programming languages designed by Douglas Hofstadter to illustrate a point in his book GΓΆdel, Escher, Bach. BlooP is a non-Turing-complete programming language whose main control flow structure is a bounded loop (i.e. recursion is not permitted). All programs in the language must terminate,...

ionic ferry
#

what do you think about it

rugged root
#

First time I'm hearing about it

vocal basin
#

Python is usually embedded in case of desktop apps

#

general purpose isn't any purpose

#

general purpose language just means
"not a DSL"

#

"my spelling skills decrease each day"

#

so it's by replit

vocal basin
rugged root
#

Also very pink

vocal basin
#

C extensions

#

I guess

#

(not necessarily as an intention of integrating it, but as an excuse)

rugged root
#

as an excuse
My favorite reason

vocal basin
mild quartz
#

ray is great

#

i use it to coordinate ml jobs across nodes

rugged root
#

What is?

mild quartz
#

i use it for a niche usecase

vocal basin
mild quartz
#

when model is too big to distribute across H100 node or TPU pod

amber raptor
#

When your AWS bill isn’t high enough

mild quartz
#

you would be disgusted by deep learning aws bills

rugged root
#

1 TB of ram

#

Dear god

pulsar light
#

@rugged root can u help me out

rugged root
#

With?

pulsar light
#

a tiny logical mistake

rugged root
#

Wait

vocal basin
#

also can just compare time instead

#

input when timed out => fail

#

I'm getting annoyed by typesetting/grammar errors in docs
but I'm too lazy to go make a PR

#

JS forces async

#

almost

#

there are holes

#

in both web and node

pulsar light
#

i see

vocal basin
#

httpxmlrequest and sync filesystem operations

rugged root
#

!e

from time import perf_counter, sleep

start = perf_counter()
sleep(2)
end = perf_counter()

print(end - start)
wise cargoBOT
#

@rugged root :white_check_mark: Your 3.12 eval job has completed with return code 0.

2.0001639989204705
vocal basin
#

monotonic is preferred in this context, I think

#

(just monotonic not perf_counter)

#

!d time.monotonic

wise cargoBOT
#

time.monotonic() β†’ float```
Return the value (in fractional seconds) of a monotonic clock, i.e. a clock that cannot go backwards. The clock is not affected by system clock updates. The reference point of the returned value is undefined, so that only the difference between the results of two calls is valid.

Use [`monotonic_ns()`](https://docs.python.org/3/library/time.html#time.monotonic_ns) to avoid the precision loss caused by the [`float`](https://docs.python.org/3/library/functions.html#float) type.

New in version 3.3.

Changed in version 3.5: The function is now always available and always system-wide.

Changed in version 3.10: On macOS, the function is now system-wide.
rugged root
#

!e

from time import monotonic, sleep

start = monotonic()
sleep(2)
end = monotonic()

print(end - start)
wise cargoBOT
#

@rugged root :white_check_mark: Your 3.12 eval job has completed with return code 0.

2.0001410259865224
vocal basin
#

"perf_counter is for perf_counting, monotonic is for monotonising"

#

time can go back in time

#

perf_counter too, possibly

#

but shouldn't

#

monotonic can't

rugged root
#

I'm not sure what the difference is, AF

pulsar light
vocal basin
vocal basin
wise cargoBOT
#

This module provides various time-related functions. For related functionality, see also the datetime and calendar modules.

Although this module is always available, not all functions are available on all platforms. Most of the functions defined in this module call platform C library functions with the same name. It may sometimes be helpful to consult the platform documentation, because the semantics of these functions varies among platforms.

An explanation of some terminology and conventions is in order.

β€’ The epoch is the point where the time starts, the return value of time.gmtime(0). It is January 1, 1970, 00:00:00 (UTC) on all platforms.

vocal basin
#

in Rust it's idiomatic to use Instant which is an equivalent of monotonic

wind raptor
#

I think it matters with daylight savings, if your time counter is running when your system goes back or forward an hour, it can count that maybe?

vocal basin
#

time will be affected

#

perf_counter -- likely no

#

monotonic -- never

wind raptor
#

right

vocal basin
#

2 seconds isn't short

lavish rover
#

perf counter is based on CPU metrics though isn't it?

#

or I guess that's the idea at least

vocal basin
#

The reference point of the returned value is undefined, so that only the difference between the results of two calls is valid.
on both

lavish rover
#

!e

import time
a = time.monotonic()
b = time.monotonic()
print(a-b)
wise cargoBOT
#

@lavish rover :white_check_mark: Your 3.12 eval job has completed with return code 0.

-1.4500692486763e-06
lavish rover
#

!e

import time
a = time.monotonic()
b = time.monotonic()
print(b-a)

a = time.perf_counter()
b = time.perf_counter()
print(b-a)
wise cargoBOT
#

@lavish rover :white_check_mark: Your 3.12 eval job has completed with return code 0.

001 | 1.1599622666835785e-06
002 | 6.598420441150665e-07
leaden garden
#

can i get voice verified i want to talk

wind raptor
#

!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.

leaden garden
#

and i want to show you guys my new dating app i made

#

yes in python

#

its like from the facebook

#

movie - the social network

#

you know the face smash thing?

lavish rover
#

!e

from time import monotonic, perf_counter
c0, c1, t = 0, 0, 100000
for i in range(t):
   c0 -= monotonic() - monotonic()
for i in range(t):
   c1 -= perf_counter() - perf_counter()
print("monotonic", c0/t)
print("perf_counter", c1/t)
wise cargoBOT
#

@lavish rover :white_check_mark: Your 3.12 eval job has completed with return code 0.

001 | monotonic 1.4436703640967607e-07
002 | perf_counter 1.3811212964355946e-07
leaden garden
#

if days = 3 and message = 50x:
return px333 = True

#

is it correct?

lavish rover
#

!e

import matplotlib.pyplot as plt
import numpy as np

# Data for plotting
t = np.arange(0.0, 2.0, 0.01)
s = 1 + np.sin(2 * np.pi * t)

fig, ax = plt.subplots()
ax.plot(t, s)

ax.set(xlabel='time (s)', ylabel='voltage (mV)',
       title='About as simple as it gets, folks')
ax.grid()

fig.savefig("test.png")
plt.show()
wise cargoBOT
#

@lavish rover :white_check_mark: Your 3.12 eval job has completed with return code 0.

lavish rover
#

!e

import numpy as np
from PIL import Image

# numpy.random.randint returns an array of random integers
# from low (inclusive) to high (exclusive). i.e. low <= value < high

pixel_data = np.random.randint(
    low=0, 
    high=256,
    size=(300, 300, 3),
    dtype=np.uint8
)

image = Image.fromarray(pixel_data)
image.show()
wise cargoBOT
#

@lavish rover :warning: Your 3.12 eval job has completed with return code 0.

[No output]
leaden garden
#

yo you should use the pomedoro techniqe

#

learn 25 min take a break and repeat

#

Einstain techniqe btw

#

what programming language should i use to create new facebook?

whole bear
#

python and typescript

rugged root
#

What did they use, PHP?

whole bear
#

started out as php i believe

leaden garden
#

mark zuckerberg used php

#

after he upgraded that language and changed that name to hack

lavish rover
whole bear
#

i mean you could reverse compiled C aswell.

leaden garden
#

!voiceverify

#

e yo why the bot is quite

#

!voiceverify

#

what the heck

rugged root
leaden garden
#

aha

#

P.P.A.P

#

i have a pen

#

i have an apple

#

apple-pen

whole bear
#

how is the C interop with Rust?

leaden garden
#

bruh i have allreaddy like 100+ messages so i dont care

rugged root
#

Ah true, you did hit the message threshold

leaden garden
#

whats that?

leaden garden
rugged root
#

It is, yeah

leaden garden
#

classic moderator face brainmon

rugged root
#

Meaning....

leaden garden
whole bear
#

your face is beautiful

leaden garden
#

they all put their faces into the camera thats what i mean

#

πŸ’πŸΏβ€β™‚οΈ

#

i love this emojis

#

discord nitro is so fun

leaden garden
whole bear
#

helplock

leaden garden
#

brainmon = discord moderators activate mega brain power

#

pithink = Picka Picka PickaChuuuuuuuuuuu

whole bear
#

I do

leaden garden
#

minecraft is fun with friends

rugged root
whole bear
#

crunch it

rugged root
willow light
leaden garden
#

@whole bear lol

lavish rover
leaden garden
#

am i allowed to do a yo mama joke?

willow light
#

Well my next question was going to be how do I skew the x-axis, so I can make a Skew-T Log P diagram

#

like this

whole bear
#

did you want hemlock's pfp to shake?

willow light
#

...i just noticed that temperature is misspelled in the image and now i'm upset

whole bear
#

could i please stream?

rugged root
rugged root
lavish rover
#

!e

import matplotlib.pyplot as plt
import numpy as np

# Data for plotting
t = np.arange(0.0, 2.0, 0.01)
s = 1 + np.sin(2 * np.pi * t)

fig, ax = plt.subplots()
ax.plot(t, s)

ax.set(xlabel='time (s)', ylabel='voltage (mV)',
       title='About as simple as it gets, folks')
ax.grid()

plt.show()
wise cargoBOT
#

@lavish rover :warning: Your 3.12 eval job has completed with return code 0.

[No output]
lavish rover
#

!e

import numpy as np
from PIL import Image

# numpy.random.randint returns an array of random integers
# from low (inclusive) to high (exclusive). i.e. low <= value < high

pixel_data = np.random.randint(
    low=0, 
    high=256,
    size=(300, 300, 3),
    dtype=np.uint8
)

image = Image.fromarray(pixel_data)
image.save("test.png")
wise cargoBOT
#

@lavish rover :white_check_mark: Your 3.12 eval job has completed with return code 0.

lavish rover
#

!e

import numpy as np
from PIL import Image

# numpy.random.randint returns an array of random integers
# from low (inclusive) to high (exclusive). i.e. low <= value < high

pixel_data = np.random.randint(
    low=0, 
    high=256,
    size=(300, 300, 3),
    dtype=np.uint8
)

image = Image.fromarray(pixel_data)
image.save("foo.png")
image.save("bar.png")
wise cargoBOT
#

@lavish rover :white_check_mark: Your 3.12 eval job has completed with return code 0.

lavish rover
#

!e

from PIL import Image, ImageDraw

images = []

width = 200
center = width // 2
color_1 = (0, 0, 0)
color_2 = (255, 255, 255)
max_radius = int(center * 1.5)
step = 8

for i in range(0, max_radius, step):
    im = Image.new('RGB', (width, width), color_1)
    draw = ImageDraw.Draw(im)
    draw.ellipse((center - i, center - i, center + i, center + i), fill=color_2)
    images.append(im)

for i in range(0, max_radius, step):
    im = Image.new('RGB', (width, width), color_2)
    draw = ImageDraw.Draw(im)
    draw.ellipse((center - i, center - i, center + i, center + i), fill=color_1)
    images.append(im)

images[0].save('pillow_imagedraw.gif',
               save_all=True, append_images=images[1:], optimize=False, duration=40, loop=0)
wise cargoBOT
#

@lavish rover :white_check_mark: Your 3.12 eval job has completed with return code 0.

rugged root
#

@whole bear I went ahead and gave you the 3 week probationary period, so you're good for a while.

#

Don't make the Hemlock regret it

whole bear
#

lol thanks

#

look at the shake

willow light
#

"Dzhemz"

#

Taumata whakatangi hangakoauau o tamatea turi pukakapiki maunga horo nuku pokai whenua kitanatahu

#

actual name of a small hill in new zealand

lavish rover
whole bear
#

Java class names be like

willow light
#

FactoryFactoryFactoryClassFactory

whole bear
#

and ofcourse you need a

lavish rover
#

!d abc.ABC

wise cargoBOT
#

class abc.ABC```
A helper class that has [`ABCMeta`](https://docs.python.org/3/library/abc.html#abc.ABCMeta) as its metaclass. With this class, an abstract base class can be created by simply deriving from [`ABC`](https://docs.python.org/3/library/abc.html#abc.ABC) avoiding sometimes confusing metaclass usage, for example:

```py
from abc import ABC

class MyABC(ABC):
    pass
```  Note that the type of [`ABC`](https://docs.python.org/3/library/abc.html#abc.ABC) is still [`ABCMeta`](https://docs.python.org/3/library/abc.html#abc.ABCMeta), therefore inheriting from [`ABC`](https://docs.python.org/3/library/abc.html#abc.ABC) requires the usual precautions regarding metaclass usage, as multiple inheritance may lead to metaclass conflicts. One may also define an abstract base class by passing the metaclass keyword and using [`ABCMeta`](https://docs.python.org/3/library/abc.html#abc.ABCMeta) directly, for example...
rugged root
wind raptor
#

Gotta head out for a bit. Cheers.

rugged root
lavish rover
#

!e

from PIL import Image
F=open(__file__,'rb').read()
I=Image.new("RGB",(128,128))
for a,b in zip(F,F[1:]):I.putpixel((a,b),(255,)*3)
I.save("foo.png")

import os
print(os.system("ls"))
wise cargoBOT
#

@lavish rover :white_check_mark: Your 3.12 eval job has completed with return code 0.

32512
whole bear
lavish rover
terse needle
lavish rover
willow light
#

SenPy notice me!

#

SymPy Gamma, for those who really don't want to use Wolfram Alpha

lavish rover
#
from PIL import Image
import requests
F=requests.get("http://placekitten.com/200/300").content
I=Image.new("L",(256,256))
for a,b in zip(F,F[1:]):I.putpixel((a,b),I.getpixel((a,b))+70)
I.save("foo.png")
rugged root
#

I'm getting old. The joints in my hands are achy

willow light
#

That moment when you reach this stage and realize you're all out of parmigiana

rugged root
#

@desert wolf Granted your perma stream

willow light
#

i learned everything i know about programming on the job. I was hired into a software engineering role with my only programming experience being matlab and fortran for the two-layer model of the atmosphere

rugged root
#

@velvet tartan Suuuuuuuup

willow light
#

fwiw i'd absolutely go to grad school just because i actually enjoy it. that and i'd definitely be doing more physics.

rugged root
#

@modest condor Yo

modest condor
lavish rover
#

i'd absolutely go to grad school just because i actually enjoy
good reason to go to grad school

think it might help me get industry job
not good reason to go to grad schoo

rugged root
#

Would rather go to dad school

#

But first I'd have to get my "no-longer-a-bachelor" degree

willow light
#

FFS hemlock

willow light
rugged root
#

DOCTOR ALL THE THINGS