#python-discussion

1 messages Β· Page 441 of 1

kind thicket
#

we need more FAQs for these

charred tusk
#

That's the longest FAQ I've ever seen

#

This is why people don't like GPL

#

Every question turns into a speech

kind thicket
charred tusk
#

yes
exactly

silver plover
charred tusk
#

Whos that again?

silver plover
#

The GNU guy

#

And not Gary.

stray field
silver plover
#

(of which, only 2 people here will get the joke)

undone grove
#

Gary the Snail

stray field
#

Every man page I open, his name is at the bottom

silver plover
#

This is gary gnu, for the rest of you:

rocky gust
#

gnary

silver plover
#

That is not a picture I wanted to click on.

undone grove
#

make it show

grave tree
#

!compban 1426949078738276525

edgy krakenBOT
#

:incoming_envelope: :ok_hand: applied ban to @solemn mantle until <t:1775866698:f> (4 days).

flint jewel
#

hi

#

is this general chat?

swift sparrow
#

This is for discussing python

flint jewel
#

ok, good

swift sparrow
#

We have off-topic channels if you want a more "general" chat

flint jewel
#

oh ok

#

so when I am assigning a string to a variable

#

do I use this ' or "

#

like string = 'hello'

swift sparrow
flint jewel
#

or string = "hello"

brisk gazelle
#

One assigns variables to objects.

flint jewel
#

I don't get it what's the difference ?

swift sparrow
brisk gazelle
#

Yes.

swift sparrow
#

Then why confuse the poor fella?

flint jewel
#

lol

#

so they are the same ?

swift sparrow
brisk gazelle
#
'abc' == "abc"```
#

This expression evaluates to True.

flint jewel
#

oh ok, so I can use either for strings.

#

oh cool

pallid garden
#

but if you start one with ' you cannot end it with "

#

you have to end it with '

flint jewel
#

thanks for the guidance

swift sparrow
#

and you have to be careful if you want your string to literally contain the other

flint jewel
swift sparrow
#

so if my string contains an apostrophe, I should start with "

#

"can't you see how cool this is"

pallid garden
flint jewel
#

I'll be here for a while to show you my "art" lol

swift sparrow
#

or 'art'

brisk gazelle
#
'My code's problem. See if you can understand why there is one.'```
#

Also, good parsing work, Discord syntax highlighting.

charred tusk
brisk gazelle
#

Anyway, as I was saying. One assigns variables to objects. One does not assign objects to variables. foo = "abc"Here, I am assigning the variable, foo, to the string object, "abc". I have not assigned "abc" to foo.

#

@flint jewel

swift sparrow
#

isn't english fun?

brisk gazelle
#

The meaning was understood.

charred tusk
brisk gazelle
#

It did a job.

flint jewel
#

I really don't get it

swift sparrow
brisk gazelle
flint jewel
#

the whole thing is confusing

brisk gazelle
#

Lefthand is assigned to righthand.

flint jewel
#

and bring me back memories of C++

brisk gazelle
#

Righthand is not assigned to lefthand.

swift sparrow
flint jewel
#

I am reading a book right now. we will continue this discussion when I get the chance

brisk gazelle
#

I will conceed my timing was poor.

#

I do not conceed any invalidity of my point, otherwise.

#

Programming is specifics.

flint jewel
#

so interestingly enough using ' has it cons

brisk gazelle
#

There are ways around it.

flint jewel
#

like assigning to the variable string = ' python's a lovely language '

swift sparrow
pastel sluice
#

you can use double or single quotes as needed

swift sparrow
#

"the person said "hello""

shrewd plinth
#

I'm so bad at using ' vs " consistently. I come up with theoretical rules and then I just start typing.

The only thing I try to be consistent with is using " when the sentence/string has a single quote in it

flint jewel
#

oh right mb

pastel sluice
#

s = "It's a beautiful day, isn't it?"

swift sparrow
shrewd plinth
#

s = "some of my favorite punctuation marks are ' and ", they said while shouting "wheeeee where are dog's at?"'

#

(That is probably not a valid string)

brisk gazelle
#
'For example, an apostrophe\'s drawbacks may be worked around.'```Though it is probably better to use " for avoiding the apostrophe problem.
#

This gives you a string with the ' within it

#

and no \

pastel sluice
#

For a mix, use triple quotes
s = '''He said, "Why can't you be honest?"'''

shrewd plinth
#

That's a good suggestion!

#

But what if the person is ALSO talking about how they use triple quotes in python πŸ’€

pastel sluice
#

Use one quote style and escape the others.

shrewd plinth
#

Yeah

charred tusk
#

GOD I MISS MY NITRO

hot glen
#
accum("RqaEzty") -> "R-Qq-Aaa-Eeee-Zzzzz-Tttttt-Yyyyyyy"
accum("cwAt") -> "C-Ww-Aaa-Tttt"```
swift sparrow
hot glen
#

split it

swift sparrow
swift sparrow
#

no need to split here

hot glen
#

oh it doesnt

swift sparrow
#

you will want a list to store all the items you create

#

Can you think of how you might end up with a list like this?

['A', 'Bb', 'Ccc', 'Dddd']
brisk gazelle
#

Fun fact: enumerate has a start parameter.

sudden timber
#

Does anyone know if there's a way to connect my python games, I made 3 games including the main menu. But idk how to connect the games. Anyone know how?

rugged pawn
swift sparrow
hot glen
swift sparrow
swift sparrow
flint jewel
#

"PS C:\Users\seraj\downloads> python -c 'print("hello")'
Traceback (most recent call last):
File "<string>", line 1, in <module>
NameError: name 'hello' is not defined. Did you mean: 'help'?
PS C:\Users\seraj\downloads> python -c "print('hello')"
hello
PS C:\Users\seraj\downloads>"

sudden timber
brisk gazelle
flint jewel
#

how can I format it ?

edgy krakenBOT
#
String formatting mini-language

The String Formatting Language in Python is a powerful way to tailor the display of strings and other data structures. This string formatting mini language works for f-strings and .format().

Take a look at some of these examples!

>>> my_num = 2134234523
>>> print(f"{my_num:,}")
2,134,234,523

>>> my_smaller_num = -30.0532234
>>> print(f"{my_smaller_num:=09.2f}")
-00030.05

>>> my_str = "Center me!"
>>> print(f"{my_str:-^20}")
-----Center me!-----

>>> repr_str = "Spam \t Ham"
>>> print(f"{repr_str!r}")
'Spam \t Ham'

Full Specification & Resources
String Formatting Mini Language Specification
pyformat.info

rugged pawn
swift sparrow
swift sparrow
rugged pawn
swift sparrow
charred tusk
#

Do you have an uncle named Bob?

rugged pawn
sudden timber
brisk gazelle
# hot glen ok wait ill try

Programming is little mechanics that make up larger mechanics that make up larger mechanics and so on. You can avoid using enumerate altogether and still achieve the same effect. It's just a nice way to condense the longer way of doing it.

swift sparrow
swift sparrow
sudden timber
swift sparrow
# sudden timber Yes they are pygame, all of them

I don't know much about pygame, but you'll likely need to retool them a bit so they can share the same overall process. Otherwise each game is going to spawn its own event process which won't really work

brisk gazelle
#
a, b, c = (1, 2, 3)```Here, a == 1, b == 2, c == 3.
#
my_list = [(1, 2), (3, 4), (5, 6)]
for ab in my_list:
    ...```Here, ab == (1, 2), then (3, 4) and so on.
hot glen
rugged pawn
swift sparrow
brisk gazelle
swift sparrow
#

!e

text = ['a', 'b', 'c']

print('.'.join(text))
print('---'.join(text))
print(' and '.join(text))
edgy krakenBOT
swift sparrow
#

here's some examples of it in action. Is this clear how it works?

hot glen
#

yay

#

got it but had to get hint from gemini once

swift sparrow
#

let's see the result

hot glen
#
def accum(s):
    res = []
    for i in range(len(s)):
        res.append((s[i] * (i + 1)).capitalize())
    return "-".join(res)```
swift sparrow
hot glen
#

im 120 honor in code wars

swift sparrow
#

I think I stopped somewhere around 400

hot glen
hot glen
swift sparrow
swift sparrow
crisp jay
hot glen
swift sparrow
edgy krakenBOT
swift sparrow
#

Does this make sense?

hot glen
#

oh

#

it is the index

crisp jay
hot glen
#

got it

swift sparrow
#

in general though, most people won't use range this way. Enumerate is much cleaner

stuck flame
#

hey

swift sparrow
#

!e

text = 'abcd'

for i, letter in enumerate(text, 1):
    print(letter * i)
edgy krakenBOT
hot glen
#

its 2 am for me

#

ill go sleep

crisp jay
swift sparrow
#

I should be around

stuck flame
#

@iron bear i can do it

swift sparrow
stuck flame
#

What kind of function do you want to create?
If you are interested, please send me a DM.

brisk gazelle
#

*Shave and a haircut* Do you wanna build a chatbot? 🎡

charred tusk
#

*Frozen* It doesn't have to be a chatbot 🎡

crisp jay
#

im starting to like html

charred tusk
#

you need Jesus

carmine depot
pallid garden
charred tusk
#

He was so off key I had to step in

brazen patrol
#

Is anyone here building TUIs in Python?

slow gust
#

Hi

dry basin
#

Hello

brisk gazelle
slow gust
#

Guys could a game made with Python be exported into the App store?

charred tusk
#

I have [redacted] at $WORK and [redacted] at $SIDEHUSTLE

charred tusk
surreal knot
slow gust
brazen patrol
slow gust
brisk gazelle
brazen patrol
charred tusk
brazen patrol
charred tusk
#

YES

brisk gazelle
#

There's your endorsement.

brazen patrol
slow gust
brisk gazelle
surreal knot
crisp jay
slow gust
#

Im just new to it sorry.

brazen patrol
surreal knot
#

yes

shrewd plinth
#

It only curses when it doesn't get the job done, just like me

slow gust
# crisp jay wdym whats that

Like I wanna get started on learning python.Yet i dont even know where it is coded ans what to do with it after the game or app I created is done?

crisp jay
# slow gust Im just new to it sorry.

python is a programming language (interpreted),in order to execute it you need another software that is called an interpreter (the default one is cpython).

shrewd plinth
#

We use editors or IDEs for coding. There are a lot of really good ones out there, people with have different opinions on them though.

#

Sometimes very strong opinions

edgy krakenBOT
#
Go-to beginner resources

Here are the top free resources we recommend for people who are new to programming:

For a full, curated list of educational resources we recommend, please see our resources page!

slow gust
surreal knot
#

if you want to make a mobile applications, there are languages that are might be better suited for that purpose like Swift (iOS) or Kotlin (Android) for example @slow gust

brazen patrol
slow gust
brisk gazelle
slow gust
slow gust
swift sparrow
surreal knot
slow gust
crisp jay
brisk gazelle
slow gust
slow gust
slow gust
brisk gazelle
#

The computer being the machine itself.

#

The machine runs the software.

slow gust
brisk gazelle
#

Some software runs other software.

swift sparrow
slow gust
charred tusk
# crisp jay isnt python native?

iOS apps have to be in Swift and compiled to an IPA -- "iOS App Store Package"
Android apps have to be in Java and compiled to an APK -- "Android app package"

In the definition of "native" that you're thinking of, no Python is not native because it uses an interpreter instead of compiling to machine code.
But "native" here means "the platform's first party systems" and all the app stores have their own systems with their own expectations for what languages you're going to give them.

brisk gazelle
swift sparrow
#

if your entire goal is "I want to make money with it", then no

slow gust
swift sparrow
slow gust
flint jewel
#

anyone cares to explain type errors in python

brazen patrol
young path
swift sparrow
slow gust
surreal knot
charred tusk
# crisp jay huh

Don't do something you don't like just because you think it wil earn you lots of money
You'll hate it and just be angry

vale wasp
slow gust
flint jewel
#

like print(23)

crisp jay
swift sparrow
surreal knot
swift sparrow
#

What's 5 plus elephant?

brisk gazelle
flint jewel
swift sparrow
vale wasp
brazen patrol
flint jewel
swift sparrow
#

!e

print(5 + 'elephant')
edgy krakenBOT
# swift sparrow !e ```py print(5 + 'elephant') ```

:x: Your 3.14 eval job has completed with return code 1.

001 | Traceback (most recent call last):
002 |   File "/home/main.py", line 1, in <module>
003 |     print(5 + 'elephant')
004 |           ~~^~~~~~~~~~~~
005 | TypeError: unsupported operand type(s) for +: 'int' and 'str'
charred tusk
slow gust
brisk gazelle
#

Mm.

vale wasp
slow gust
vale wasp
flint jewel
charred tusk
vale wasp
vale wasp
charred tusk
vale wasp
charred tusk
#

Can I install Python on my phone now?

vale wasp
blazing badge
#

Hello

brazen patrol
charred tusk
vale wasp
charred tusk
#

no, its an emulator thats been around for years

flint jewel
swift sparrow
#

datatypes exist for a reason

vale wasp
brazen patrol
crisp jay
crisp jay
#
Welcome to Node.js v25.8.2.
Type ".help" for more information.
> 5 + 'string'
'5string'
flint jewel
swift sparrow
surreal knot
vale wasp
cerulean ravine
brazen patrol
charred tusk
#

Oh shit, I thought it was just now coming out in 3.15
I didn't release PEPs 730 and 738 were all the way back in 3.13

vale wasp
cerulean ravine
vale wasp
flint jewel
brazen patrol
#

Is Python 2 still being supported ?

flint jewel
#

lol

surreal knot
vale wasp
flint jewel
#

he explained it well

charred tusk
swift sparrow
#

I think ned is trying to show that it's quite ambiguous what the result should be, that's why it errors

charred tusk
#

!pep 730

edgy krakenBOT
charred tusk
#

!pep 738

edgy krakenBOT
vale wasp
charred tusk
#

That would be boring

vale wasp
#

I miss reactions. I go away for one week on vacation...

surreal knot
#

-# πŸ˜”

brazen patrol
wraith shore
#

can somone help me?

charred tusk
vale wasp
charred tusk
wraith shore
# vale wasp Probably. Ask and find out.

i downloaded of a fake friend a exe in py and it was a passwort stealer and python stealer but i only download and dont run it ai says wehn i dont run it its all god ?

vale wasp
wraith shore
#

is this real?

#

or im cooked?

vale wasp
#

I don't know.

wraith shore
#

oh okay πŸ™

rocky gust
wraith shore
rocky gust
#

(unless it ran on download)

swift sparrow
#

Also never download and run random exe that people send you

wraith shore
rocky gust
wraith shore
wraith shore
charred tusk
wraith shore
#

It's a password stealer

#

and a Python /Discord stealer

charred tusk
wraith shore
#

I have another question, but it has nothing to do with Python.

charred tusk
#

sus

wraith shore
#

wdym

swift sparrow
charred tusk
wraith shore
#

somone did all my info of my ip in a group chat all in a text waht can i do xD

tired dirge
#

Guys wanna see my new site i just did it go visit it its about explination of python terms hard stuff and easy

rocky gust
#

ur public IP only hides an approximation of your location

wraith shore
tired dirge
#

Its a useful site to learn from i just crated it

rocky gust
charred tusk
tired dirge
wraith shore
tired dirge
charred tusk
dry pike
#

chat ded

wraith shore
harsh anchor
#

they really cannot

silver plover
crisp jay
tired dirge
silver plover
rocky gust
wraith shore
rocky gust
wraith shore
rocky gust
wraith shore
wraith shore
#

im new at the pc sorry for all my questions

charred tusk
silver plover
vale wasp
wraith shore
charred tusk
vale wasp
wraith shore
wraith shore
charred tusk
wraith shore
charred tusk
#

uh oh

bright shoal
# wraith shore What?

are you able to upload the file to a file sharing host or something? I'm curious, I want to look into it

vale wasp
charred tusk
#

I woke the Fish

wraith shore
vale wasp
bright shoal
charred tusk
#

Malware

bright shoal
vale wasp
#

Someone did mention Windows.

brazen patrol
#

Why is it prefixed with C instead of plain python

wraith shore
charred tusk
charred tusk
wraith shore
vale wasp
bright shoal
brisk gazelle
#

Python is the language. CPython is one implementation of an interpreter that runs Python scripts. It is also the primary one.

grave tree
charred tusk
spare condor
#

so I just spent the last hour doing this because I didn't want to deal with regex, then the more I got into the project, the more dealing with regex will save me developing time. so it was an educational hour lol

for e in first_split:
    if ']' in e:
        if e[-1] != ']':
            chunk = []
            if e[-2] != ']':
                for i in reversed(e):
                    if i != ']':
                        chunk.append(i)
                    elif i == ']':
                        rev_chunk_str = ''.join([kana for kana in reversed(chunk)])
                        second_split.append(e.replace(rev_chunk_str, ''))
                        second_split.append(rev_chunk_str)
            else:
                second_split.append(e[0:-1])
                second_split.append(e[-1])
        else:
            second_split.append(e)
    else:
        second_split.append(e)
vale wasp
spare condor
#

I know

spare condor
#

I just so didn't want to deal with them today πŸ˜‚

vale wasp
brazen patrol
#

Why is it prefixed with C instead of plain python

spare condor
#

so I thought I could finesse my way out of it lol

crisp jay
#

going to refactor it without regex

wraith shore
#

but cool

grave tree
vale wasp
charred tusk
vale wasp
spare condor
vale wasp
charred tusk
#

Is it open source?

rocky gust
#

gruvbox light mode ftwftw

wraith shore
#

do some has cool py tools cmd (can send the code) i want to feel like a real skid

rocky gust
#

only acceptable light mode

wraith shore
rocky gust
edgy krakenBOT
#

5. Do not provide or request help on projects that may violate terms of service, or that may be deemed inappropriate, malicious, or illegal.

wraith shore
crisp jay
# spare condor it's absolutely cursed lol
for e in first_split:
    if ']' not in e:
        second_split.append(e)
        continue 
    if e[-1] == ']':
        second_split.append(e)
        continue
    if e[-2] == ']':
        second_split.append(e[0:-1])
        second_split.append(e[-1])
        continue

    chunk = []
    for i in reversed(e):
        if i != ']':
            chunk.append(i)
        else:
            rev_chunk_str = ''.join([kana for kana in reversed(chunk)])
            second_split.append(e.replace(rev_chunk_str, ''))
            second_split.append(rev_chunk_str)
#

always reverse the condition

wraith shore
bright shoal
charred tusk
#

damn kids these days

crisp jay
vale wasp
charred tusk
#

MAKE ME

vale wasp
charred tusk
#

😱

rocky gust
bleak nacelle
#

hi guys! I'd like to ask, i didn't really get the purpose of Class, can anyone explain what is the purpose of it? it doesn't seem different from def

swift sparrow
crisp jay
bleak nacelle
brazen patrol
swift sparrow
vale wasp
wraith shore
vale wasp
rocky gust
#

-# ## yo

crisp jay
#

strange,in repl you cant do help(class) but in the help utility you can

bright shoal
vale wasp
charred tusk
#

yo?

rocky gust
#

yo!?!

#

logo_atom my first editor πŸ˜”

vale wasp
pallid garden
rocky gust
vale wasp
crisp jay
pallid garden
charred tusk
#

I still have the fact that their docs were named "flight manual" ingrained as a core memory and I really want to make something named like that

vale wasp
charred tusk
#

My autism is addicted to planes

pallid garden
charred tusk
#

Though I don't have the kind of autism where I actually learn things
I just like them

vale wasp
pallid garden
#

πŸ₯€

charred tusk
#

Hey it was fine until Ingress died

dry pike
#

Goobersnotties

charred tusk
#

wat

dry pike
#

kubernetes

pallid garden
#

kubectl is just a silly goober fr fr

crisp jay
#

is kubernetes nixos in disguise?

charred tusk
#

kinda

pallid garden
#

it's more like

#

the nix package manager

#

if you want to use that metaphor

dry pike
#

Is nixos "nicksows" or "nix-o-s"?

pallid garden
#

but even then it's a stretch

charred tusk
crisp jay
rocky gust
dry pike
pallid garden
charred tusk
vale wasp
rocky gust
pallid garden
#

duh, 🐺🌈 is cuter

charred tusk
#

Just because you decided to be mean

dry pike
#

when are the roles going away

#

If they were an April fools prank

charred tusk
vale wasp
crisp jay
pallid garden
#

-# i just realized that looks like im celebrating the end of april fools, no i was celebrating the return of 🐺🌈

vale wasp
#

What roles??? I go away for a vacation and miss everything!

charred tusk
vale wasp
charred tusk
#

NYC?

#

You didn't want to go somewhere where you could breathe?

vale wasp
vale wasp
pallid garden
#

shall we head over to OT?

charred tusk
#

It’ll be like a whole new vacation for Dan!

pallid garden
#

xD

rocky gust
#

what if python was named boa constrictor

#

actually boa is a cool name

pallid garden
#

2027 april fools idea

vale wasp
#

And this is what I get on the last day of vacation (took off all of the kids' spring break but then they ended up having school today because too much snow...)

vale wasp
rocky gust
brazen patrol
rocky gust
#

boa would be a cool name for a python affiliated project

pallid garden
vale wasp
pallid garden
#

xD

rocky gust
#

eally πŸ˜”

#

te hni ally i ant say anything with the se ond letter of the alpha et as well ecause its also a language

flint jewel
#

does anyone care to explain the for loops in python ?

#

like the syntax

#

I am reading from a book and it says wiered things

pallid garden
#

do you want to open a help thread?

flint jewel
#

no

pallid garden
#
my_list = [1, 2, 3]    # this creates a list of numbers 1, 2 and 3
for number in my_list: # our for loop loops through my_list
    # note that this is one indentation in
    print(number)
    # on the first iteration, number will be 1, so print(number) will give 1
    # on the second iteration, number will be 2,
    # on the third iteration, number will be 3
    # there is no fourth element, so the loop ends
flint jewel
#

What are you writing x_x

raven urchin
flint jewel
#

like I have to write number?

vale wasp
raven urchin
#

All the code works but I hate having giant if statements

pallid garden
flint jewel
#

no, like for number in my_list number here is what exactly

pallid garden
raven urchin
pallid garden
#

1, 2 and 3

flint jewel
#

we call them indices

pallid garden
#

the for loop will run through the code inside the loop 3 times

flint jewel
#

I am bit confised and it's my first day

pallid garden
#

the first time round, number will be 1

#

the second time round, number will be 2

flint jewel
#

yeah I know, that's not my question

#

so number is the name of the variable ?

pallid garden
#

you mean the name?

flint jewel
#

like for number in my_list

pallid garden
#

the name is something appropriate you choose to describe it

flint jewel
#

oh so it's up to me

pallid garden
#

yea

flint jewel
#

like, for x in my_list

#

that would work

pallid garden
#

you would want to use something that you can easily understand just by looking at the name

flint jewel
#

so it's arbitrary

#

ok thanks it's used only by the for right ?

vale wasp
#

It's arbitrary but should be descriptive.

flint jewel
#

for loop*

flint jewel
pallid garden
grave tree
flint jewel
#

what I meant it's arbitrary and only used by for loop

vale wasp
#

for value in my_list value is for the loop, my_list is external.

flint jewel
pallid garden
#

sorry let me check

grave tree
#

!e

for my_var in ["a", 2, 3, "banana"]:
    continue
print(my_var)
vale wasp
flint jewel
#

that's what I am asking

edgy krakenBOT
grave tree
flint jewel
charred tusk
#

It can be awkward when you rely on it by accident and then break it

vale wasp
grave tree
#

It's handy for early breaks

pallid garden
#

sometimes i wonder how is it that i can code for this long without knowing that this exists

rocky gust
vale wasp
pallid garden
#

it might be because my main language does not have this feature

#
  for (let i = 0; i < 5; i++) {
  }
  console.log(i) // Cannot find name 'i'.ts(2304)
charred tusk
pallid garden
#

also, i dont use for loops very much anymore

vale wasp
#

I can count on the fingers of one hand the number of times I've needed this. Much more often is that I forget that the loop doesn't have its own scope and I overwrite a variable that I need.

grave tree
#

I used it for part of the levels implementation, it's useful to know

pallid garden
#

i can imagine me debugging an issue and tracing it to this and getting very confused

flint jewel
#

Python is wiered lol

vale wasp
#

Scoping is hard.

pallid garden
#

and being all like "WAIT WHAT THIS EXISTS?"

velvet trout
#

You usually don't care about that leak. Python code is very readable

deep zenith
#

guys can anyone tell what is the issue in this code

class Animal:
    name = ''
    type = ''

    def __init__(self,name,type):
        self.name = name
        self.type = type

    def say(text):
        print(text)

Dog = Animal("Pip" , 'puppy')
Dog.say("WOOF WOOF!!")

its giving me error
Dog.say("WOOF WOOF!!")
~~~~~~~^^^^^^^^^^^^^^^
TypeError: Animal.say() takes 1 positional argument but 2 were given

velvet trout
flint jewel
# velvet trout why

I don't know I was printing this list in a for loop and printed each entry in a newline without me explicitly puting a newline there

vale wasp
deep zenith
#

do i need to add self in every function

crisp jay
vale wasp
grave tree
charred tusk
#

Well done

crisp jay
#

!d print

edgy krakenBOT
#

print(*objects, sep=' ', end='\n', file=None, flush=False)```
Print *objects* to the text stream *file*, separated by *sep* and followed by *end*. *sep*, *end*, *file*, and *flush*, if present, must be given as keyword arguments.

All non-keyword arguments are converted to strings like [`str()`](https://docs.python.org/3/library/stdtypes.html#str) does and written to the stream, separated by *sep* and followed by *end*. Both *sep* and *end* must be strings; they can also be `None`, which means to use the default values. If no *objects* are given, `print()` will just write *end*.

The *file* argument must be an object with a `write(string)` method; if it is not present or `None`, [`sys.stdout`](https://docs.python.org/3/library/sys.html#sys.stdout) will be used. Since printed arguments are converted to text strings, `print()` cannot be used with binary mode file objects. For these, use `file.write(...)` instead.
deep zenith
#

solved it

velvet trout
deep zenith
#

alr

deep zenith
#

how can i practice oops

bright shoal
#

Well that malware was underwhelming πŸ˜”

deep zenith
#

what is the project i should make

crisp jay
flint jewel
deep zenith
flint jewel
#

it's loop number in my_list: print(number)

velvet trout
velvet trout
crisp jay
velvet trout
#

Huh

crisp jay
#

is encapsulation a unique thing in oop?

charred tusk
#

Do you not hide your sensitive objects?

deep zenith
# velvet trout I am asking your reasoning for adding it
class Animal:
    name = ''
    type = ''

    def __init__(self,name,type):
        self.name = name
        self.type = type

    def say(self,text):
        print(text)
    
    def info(self):
        print("name:" ,self.name)
        print("type:" ,self.type)

pokemon = Animal("Pip" , 'fire')
pokemon.say("WOOF WOOF!!")
pokemon.info()
grave tree
deep zenith
#

so that i can assign name

#

by default they will be empty

grave tree
deep zenith
#

i know

charred tusk
#

Then remove it

grave tree
deep zenith
#

i will not

#

remove it

grave tree
charred tusk
deep zenith
charred tusk
#

Aight I’m out

grave tree
# deep zenith i know

your __init__ requires both name and type to exist/be passed in. There's no "they'll be empty by default" here because your initializer requires it

vale wasp
charred tusk
#

Good luck Kat

deep zenith
#

already

vale wasp
#

OK

grave tree
limpid meadow
#

Maybe but you're using class variables for nothing

deep zenith
#

whihc one

grave tree
crisp jay
grave tree
crisp jay
#

i forgot the name

charred tusk
grave tree
charred tusk
grave tree
#

Having class variables with defaults is different than having an initializer with defaults

grave tree
bleak nacelle
#

is this the correct way to do a class?

class Character:
    
    def __init__(self, name, hp, attack_power):
        self.name = name
        self.hp = hp
        self.attack_power = attack_power
    
    def attack(self, target):
        target.hp -= self.attack_power
        print(f"{self.name} attacked {target.name} for {self.attack_power} damage!")
        print(f"{target.name} now have {target.hp} HP left\n")
    
    def is_alive(self):
        return self.hp > 0
edgy krakenBOT
#

src/letsbuilda/pypi/async_client.py lines 13 to 17

class PyPIServices:
    """A class for interacting with PyPI."""

    NEWEST_PACKAGES_FEED_URL: Final[str] = "https://pypi.org/rss/packages.xml"
    PACKAGE_UPDATES_FEED_URL: Final[str] = "https://pypi.org/rss/updates.xml"```
`README.md` lines 27 to 29
```md
pypi_client = PyPIServices(http_session)

print(await pypi_client.get_rss_feed(pypi_client.NEWEST_PACKAGES_FEED_URL))```
charred tusk
#

Class variables attach to the class itself and are shared across all instances of the class

deep zenith
#

i solved it

shrewd plinth
#

Is there an elegant way to like..... get two items from a for loop? Like a container that I need to process two items at a time for.

shrewd plinth
#

I was thinking zip, just wondering if there was something better

grave tree
#

Like [1, 2, 3, 4] will give you 1, 2 and 3, 4 or something else?

shrewd plinth
#

Not sure. I have a container of pairs.... yeah, 1,2 then 3,4

grave tree
#

Or do you need 1, 2 then 2, 3 then 3, 4?

shrewd plinth
#

nah, 1,2 then 3,4 is fine

charred tusk
shrewd plinth
#

I mean I could enumerate and skip every other step but

grave tree
#

you could do some iter bullshit probably

shrewd plinth
#

seems cursed

grave tree
#

let's see if I can pull something together without itertools...

charred tusk
charred tusk
#

!docs itertools.batched

edgy krakenBOT
#

itertools.batched(iterable, n, *, strict=False)```
Batch data from the *iterable* into tuples of length *n*. The last batch may be shorter than *n*.

If *strict* is true, will raise a [`ValueError`](https://docs.python.org/3/library/exceptions.html#ValueError) if the final batch is shorter than *n*.

Loops over the input iterable and accumulates data into tuples up to size *n*. The input is consumed lazily, just enough to fill a batch. The result is yielded as soon as the batch is full or when the input iterable is exhausted...
grave tree
#

What does it having to be a single function call have to do with anything?

elder plaza
charred tusk
shrewd plinth
#

Why didn't I see batched in itertools docs. Am I looking at the wrong docs or outdated docs?

shrewd plinth
#

I was looking at the 2.0 docs >.>

#

Good job, self

charred tusk
shrewd plinth
#

batched is perfect, ty

#

I don't know! I just clicked the first documentation looking source on google

#

or duckduck go

charred tusk
#

They’re BLUE!

charred tusk
charred tusk
grave tree
charred tusk
#

That’s less fun

#

But more seriously I did ask

shrewd plinth
#

SIGH. The notebook environment for this course is disallowing an itertools import

#

gg

grave tree
grave tree
#

!e

my_list = [1, 2, 3, 4, 5, 6]
my_iter = iter(my_list)
for a in my_iter:
    print(a, next(my_iter))

look ma, no imports!
-# At what cost though

edgy krakenBOT
shrewd plinth
#

wow, nice

grave tree
#

It took some fiddling to remember what I needed to actually iter and loop over

shrewd plinth
#

That looks slightly better than my enumerate() with if i%2==0: continue

charred tusk
#

I should ask fix if Python ever added a way for me to replace that ... with a reference to size

shrewd plinth
#

it's still kind of cursed but w.e. This isn't production code, this is just for a lab assignment

#

I kind of can't believe python lets you do that

steady rain
shrewd plinth
#

Fair

steady rain
#

someone I used to know once said "I like C because it doesn't hold your hand"
and Python is much the same way, but on the other end of the spectrum.
||The thing that he didn't say was that he was married, and that's why I used to know him.||

velvet trout
grave tree
velvet trout
#

πŸ₯€

steady rain
#

.topic

verbal wedgeBOT
#
**What is something you know now, that you wish you knew when starting out?**

Suggest more topics here!

velvet trout
#

Change it again mod

steady rain
#

no

velvet trout
#

I have seen those two questions for like 4 times by now

steady rain
#

when I learned decorators, I didn't really get how they're called once.

velvet trout
#

Decorators are cute

deep zenith
velvet trout
# deep zenith lmao

But don't do that again, not a good behaviour, especially there are many people helping you but you were not cooperating with it.

deep zenith
#

i solved it

#

what i did bro

velvet trout
#

my internet got down the moment i asked so i wasn't ragebaited lmao

#

Nvm

steady rain
#

.topic

verbal wedgeBOT
#
**If you could change one thing in Python, what would it be?**

Suggest more topics here!

shrewd plinth
undone grove
velvet trout
undone grove
#

make it show

fiery yarrow
velvet trout
#

Missing my old py2 days

#

class Name(object) too to bring back

dry pike
#

uncool

velvet trout
#

:P

#

print stmt used << or something like that for file argument right?

fiery yarrow
velvet trout
#

Yeah

#

How did this was in grammar?

print >> file, "hi"

Like ... What was >> recognized as ?

#

is it possible with modern pegparser too?

dry pike
velvet trout
#

seems like C's cin

dry pike
#

oh I was late

velvet trout
#

Or C++

deep zenith
#

i would involve brackets instead of :

dry pike
#

I want to make it immune to being used with AI in any form

#

baibai to the ai

deep zenith
#

python is used to make ai

#

lol

dry pike
#

yeah I would include that in what I said

wraith shore
#

yo yo yo

#

wsp

velvet trout
#

My internet is down again πŸ₯€

oblique spindle
velvet trout
#

{ } are called brackets?

#

is the definition vague or loosely

deep zenith
oblique spindle
#

: is better than {}

deep zenith
#

no

grizzled solar
# wraith shore wsp

U were xen 5 min ago, now ur my history teacher (her name was also Lina) lol

velvet trout
#
func main() {
    print("Hello, world!")
}


if __name__ == "__main__" {
    main()
}

Seems good to me.

grizzled solar
velvet trout
#

go needs a naming convention book

#

go can't go with me

raven urchin
#

I don't think that's something you should mention here

wraith shore
grizzled solar
grizzled solar
#

Go

undone grove
#

@raven urchin another miku tag wearer

velvet trout
#

So it has public/private issues?

grizzled solar
#

Imagine having to name a struct in lowercase only to make it private :(

velvet trout
#

how do you work in pub/pvt in Go

unborn lagoon
grizzled solar
# velvet trout So it has public/private issues?

It doesn't have an issue but their current approach is very lame

If u are making a library, then all the functions, variables, structs, constants, etc which starts with an uppercase is public but anything which starts with a lowercase is private

velvet trout
#

Yet another reason to Thank Lord Guido and Python for existing in my life.

grizzled solar
#

Lmaooo nahhh

#

Once u have used go or zig, you wont think the same way

velvet trout
#

visibility of stuff must be by something leading (like an underscore) or a keyword to mark them pub/pvt instead of such naming conventions

velvet trout
#

Also I like mangoes πŸ₯­

grizzled solar
#

Python is yet another tool, it has its pros n cons

I'd argue go has more pros if we ignore the private public convention

undone grove
#

if you really want to avoid those pesky python problems you can learn typescript

thick bluff
undone grove
#

but this is a python server

velvet trout
grizzled solar
raven urchin
raven urchin
wraith shore
#

forget all waht i say

#

yall forget now waht i was saying!!

undone grove
#

nah that's a crazy thing to say

thick bluff
undone grove
#

who does that

thick bluff
#

My stomach as issue so I need to get one

grizzled solar
velvet trout
thick bluff
grizzled solar
velvet trout
#

"pYtHoN iS sLoW"

raven urchin
#

It took me a full 5 minutes to figure out "7 - n"

velvet trout
#

What do you mean

swift sparrow
raven urchin
#

😭

#

such an easy solution...

jade robin
#

i should have thought of ts

raven urchin
#

I wonder how many of these I have that could be solved in a prettier way

swift sparrow
#

That's extremely common though. Things are easy when you look back on them like that

raven urchin
#

That's the feeling that has me hooked on programming

#

"oh, I hate ts".

WAIT I GOT IT, I LOVE TS.

jade robin
swift sparrow
raven urchin
#

I still can't comprehend what self is

jade robin
#

it's a name

swift sparrow
#

I can show you in a help thread if you like

raven urchin
#

I mean, I kinda get it, I but if you tell me how to explain it, my brain bugs out

pallid garden
#

it's hard to explain just what self really is

swift sparrow
pallid garden
raven urchin
jade robin
#
class A:
    def __init__(nothinglikeself, x): print(nothinglikeself)
z = A(10)
print(z)
raven urchin
#

A class instance

#

Object? Idk

swift sparrow
raven urchin
jade robin
#

the main reason is you often want to work with the object you recieved the call from (maybe change it in someway, read from it etc)

swift sparrow
chilly whale
pallid garden
#

plus, self is not really a builtin like print neither is it a variable you declare yourself

bronze dragon
jade robin
chilly whale
raven urchin
jade robin
#

unlike java for example, which always uses this

pallid garden
jade robin
#

if you mean it's passed by default, yes (but you can always just do that in the function)

raven urchin
swift sparrow
chilly whale
raven urchin
swift sparrow
raven urchin
#

Ohhhhhhhh

swift sparrow
#

so it's basically taking a local variable and "upgrading" it to an attribute

jade robin
#

btw @raven urchin do you understand the difference between

class A: pass
x = A()
x.f = 10

and

class A: pass
x = A
x.f = 10
raven urchin
#

Uhhh

#

I think I'm lost there, but I know you're making x an instance of A in the first example, wouldn't the second one error out?

swift sparrow
#

A() is an instance. A is the class

jade robin
#

(yeah and classes can have attributes too, so the second one doesn't error out)

raven urchin
jade robin
#

eh not exactly, they're using/modifying attributes of objects normally, not the class

swift sparrow
#

sort of, except dataclasses automatically convert those class attributes into proper instance attributes

thick bluff
#

Piru piru piru

raven urchin
#

I used them to unpack values from a list to use them with names, so instead of result[i] I had result.thing and it looked cooler

#

Isn't there an easier way to do that?

#

I remember it was like...

swift sparrow
raven urchin
#

Let me do it on a help thread

modest flicker
#

I was wondering if we're allowed to recruit in here or not for paid positions?

swift sparrow
modest flicker
#

got you, thanks for lmk

raven urchin
swift sparrow
pallid garden
#

huh

#

im just not going to question that too much

rugged barn
#

Hey, y'all.

#

πŸ‘‹

bronze dragon
#

πŸ‘‹

shrewd plinth
#

🌊

inland karma
#

good morning

pallid garden
#

good morning

peak egret
#

hi guys

#

we are back at work

quartz fulcrum
#

good morning

peak egret
#

resolving merge conflicts and waiting for claude

quartz fulcrum
#

i just opened the discord..and saw the morning message

inland karma
#

πŸ˜„

white knot
#

anyone help me with compiler design annotated tree traversal/evaluation

#

i am confused

quartz fulcrum
peak egret
#

im searrching for a full time job

#

where the codebase wouldn't make me wanna kms

quartz fulcrum
#

kms?

inland karma
#

use kind words

white knot
#

kilometer per second

late wyvern
#

it means: keep myself safe

autumn pelican
#

^

peak egret
#

i have an interesting problem to solve

#

i want to give someone access to my account

#

without giving them my username/password

#

and that too, on their device

#

and this account can be of any platform, any website like linkedin or instagram

inland karma
#

it is not common for sites to allow account sharing, most explicitly forbid it and has mechanisms in play to detect account sharing

half pewter
#

It's the security admin's job to prevent that...

peak egret
#

i want to hire someone to apply to jobs on my behalf

quartz fulcrum
#

do you have any siblings?

#

convince him/her for a small exchange of reward

edgy krakenBOT
#

8. Do not help with ongoing exams. When helping with homework, help people learn how to do the assignment without doing it for them.

frigid trout
peak egret
rugged barn
#

<@&831776746206265384>

spice hill
#

!cleanban @opaque yarrow crypto scam

edgy krakenBOT
#

:incoming_envelope: :ok_hand: applied ban to @opaque yarrow permanently.

quartz fulcrum
#

error fixed

timber knoll
#

hii

rare gazelle
#

hello there

frigid trout
#

Doesn't need to be AI but

frigid trout
inland karma
#

cleans messages and bans

frigid trout
#

Okay

fiery yarrow
#

"cleans messages" = deletes all their messages from the past hour

lament terrace
#

Btw I made another wrapper function after doing a wrapper function 😈

#

notifications/notify-send

frigid trout
#

!cleanmessage @Velcrix

lament terrace
#

🀨

frigid trout
#

How do I use dirb on windows?

#

I saw that you can use dirsearch from Python, how do I do that?

inland karma
#

what are you trying to solve?

frigid trout
#

@ocean ridge this person