#voice-chat-text-0
1 messages Β· Page 158 of 1
"is there really such thing as readable JavaScript?"
@wind raptor we had a long weekend recently but for different reasons lol
or whatever
idk how to call
Monday just after the mutiny was declared not to be a workday, for obvious reasons
@lavish rover do you work full time and also study at Univ, or only work?
work full time
So you wouldn't have an off for 4th of July due to Friday off, or you would still have it
I'm in Canada
Okay, makes sense now!
it's been
five hours
what I actually need to do to optimise it is to properly analyse deltas instead of re-walking the whole tree each time
!stream 191793436976873473
β @whole bear can now stream until <t:1688345165:f>.
@lavish rover
iterator.next. commands the iterator to return the next value whatever the conditions are
iterator.next? politely asks for the next value or queries whether there's a next value
iterator.next?! panics if there's a next value
iterator.next?! is confused
or it can just UB for more confusion
!stream 191793436976873473
β @whole bear can now stream until <t:1688354328:f>.
^
@lunar haven :white_check_mark: Your 3.11 eval job has completed with return code 0.
001 | 10k + 4 mod 7mod 7 5 5 0 6 4 5 0
002 | 10k + 4 mod 8mod 7 2 6 4 4 4 6 4
003 | 10k + 4 mod 9mod 7 6 2 4 2 6 1 6
004 | 10k + 4 mod 10mod 7 4 4 4 4 4 4 4
005 | 10k + 4 mod 11mod 7 1 2 1 0 3 4 0
006 | 10k + 4 mod 12mod 7 6 2 4 1 0 3 0
007 | 10k + 4 mod 13mod 7 6 3 0 4 5 2 1
Do you understand about assignment?
no
How a variable is a named reference to an object?
yeah
!e py a = "Hello" print(a)
@somber heath :white_check_mark: Your 3.11 eval job has completed with return code 0.
Hello
A for loop is that, but on repeat.
Over a sequence.
!e py for letter in "abc": print(letter)
@somber heath :white_check_mark: Your 3.11 eval job has completed with return code 0.
001 | a
002 | b
003 | c
!e py letter = "a" print(letter) letter = "b" print(letter) letter = "c" print(letter)
@somber heath :white_check_mark: Your 3.11 eval job has completed with return code 0.
001 | a
002 | b
003 | c
These two examples are roughly equivalent.
It looks at the first thing in "abc", then performs what's in the indent
Having assigned the first thing to letter
Then the second thing has letter assigned to it
the indented section is performed
The third thing has letter assigned to it
the indented section is performed
Then, because there are no more things, the for loop exits.
So, basically any iterable is a candidate for where "abc" is.
When you use a for loop, you are said to be iterating over that something.
idk what an iterable is
Integers are not iterable. Floats are not iterable. Complexes are not iterable. Functions are not iterable. A bunch of things are not iterable.
Lists are iterable. Tuples are iterable. Strings are iterable. Instantiated generator expressions are iterable. Many things from the itertools module are iterable.
Basically, if you can plug it into a for loop, it's iterable.
If you can give it to the list or tuple constructor, it's iterable. (But also possibly infinite, so take care!)
okay
!d iterable
An object capable of returning its members one at a time. Examples of iterables include all sequence types (such as list, str, and tuple) and some non-sequence types like dict, file objects, and objects of any classes you define with an __iter__() method or with a __getitem__() method that implements sequence semantics.
The Resources page on our website contains a list of hand-selected learning resources that we regularly recommend to both beginners and experts.
!resources
The Resources page on our website contains a list of hand-selected learning resources that we regularly recommend to both beginners and experts.
mb I didnβt heard good
Hey Guys, trying to find a website if anyone remembers something like this please let me know. Website has info about all the software licenses GNU, MIT, Apache and so on with info in short summed up paragraph.
Github has that stuff when you're selecting the license to use, if I remember correctly.
It's been a while.
Yep got it, https://docs.github.com/github/creating-cloning-and-archiving-repositories/licensing-a-repository thanks @somber heath
!pip discord.py
@silk gale π
!voice
humanities best decisiom
@ashen plinth π
Hi Opal!
Opal, do you also crochet?
got the opal gratification
guys i need course oop in python !
!resources
The Resources page on our website contains a list of hand-selected learning resources that we regularly recommend to both beginners and experts.
Corey Schafer, YouTuber. Playlist for Python Beginners.
Yes, Opal could you please discuss some of functions and claases/objects concepts if possible during some of the groupcalls
ive heard that a class is like really basic ice cream
and chocolate and strawberry, etc are the objects
or a car is a class and the engine, seats , etc are the objects
any such analogy. cars is a class, auidi, toyota are objects of that class
Oh gtg everyone ... my break is over π¦ bye bye
!e ```py
class Person:
def init(self, name):
self.name = name
def greet(self):
print(f'Hello. I am {self.name}.')
person_a = Person('Albert')
person_b = Person('Sally')
person_a.greet()
person_b.greet()```
@somber heath :white_check_mark: Your 3.11 eval job has completed with return code 0.
001 | Hello. I am Albert.
002 | Hello. I am Sally.
Is Self referring to person_a , or person_a.greet()? But I got that self doesn't refer to class person
!e ```py
class MyClass:
def init(self):
print('Hello, world.')
instance = MyClass()```
@somber heath :white_check_mark: Your 3.11 eval job has completed with return code 0.
Hello, world.
@somber heath can put into better words but, self will always represent the instance of class
Yeah, i am trying to understand by instance are we referring to the 'person_a' instance (object) as a whole or in particular to the 'person_a.greet()' attribute alone? Hope my question is correct
Thanks. Okay, got it, instance (or object) of the class as a whole. And we can have many instances of any given class
!e ```py
class MyClass:
def my_method(self):
return 'abc'
instance = MyClass()
print(instance.my_method)
print(instance.my_method())```
@somber heath :white_check_mark: Your 3.11 eval job has completed with return code 0.
001 | <bound method MyClass.my_method of <__main__.MyClass object at 0x7fa96db0c450>>
002 | abc
!e ```py
def func():
print('Hello, world.')
print(func())```
@somber heath :white_check_mark: Your 3.11 eval job has completed with return code 0.
001 | Hello, world.
002 | None
Okay, all functions have a return. Either none or other type
!e py r = print('abc') print(r)
!e
print(print('Print func'))
@somber heath :white_check_mark: Your 3.11 eval job has completed with return code 0.
001 | abc
002 | None
Β» environments
Β» envs
Β» exit()
Β» enumerate
Β» empty-json
Β» for-else
Β» on-message-event
Β» except
Sorry, I didn't follow the last point of instance.mymethod. can you please explain this
!e ```py
def func():
print('a')
return 'b'
print(func())```
@somber heath :white_check_mark: Your 3.11 eval job has completed with return code 0.
001 | a
002 | b
!e
class PyClass():
def __init__(self, value):
self.value = value
obj1 = PyClass(1)
obj2 = PyClass(2)
obj3 = PyClass(1)
print(isinstance(obj1, PyClass))
print(isinstance(obj2, PyClass))
print(obj1 == obj2)
print(obj1 == obj3)
print(obj1.value == obj3.value)
@rotund scaffold :white_check_mark: Your 3.11 eval job has completed with return code 0.
001 | True
002 | True
003 | False
Is self.value here evaluated as pyclass.value for both the below lines?
obj_1 = pyclass(1)
obj_2 = pyclass(2)
Line 3
Got it. Self.value equivalent to obj1.value , that is value =1. Is that correct?
!e ```py
class MyClass:
value = 'abc'
print(MyClass.value)```
@somber heath :white_check_mark: Your 3.11 eval job has completed with return code 0.
abc
!e ```py
class MyClass:
def init(self):
self.value = 'abc'
instance = MyClass()
print(instance.value)
print(MyClass.value)```
@somber heath :x: Your 3.11 eval job has completed with return code 1.
001 | abc
002 | Traceback (most recent call last):
003 | File "/home/main.py", line 7, in <module>
004 | print(MyClass.value)
005 | ^^^^^^^^^^^^^
006 | AttributeError: type object 'MyClass' has no attribute 'value'
You were trying to help me understand the difference between Myclass.value and objectname.value i think
Here in example1 it doesn't throw an error for myclass.value
this block
I follow this where it throws an error
it's okay. I am still trying to process why it doesn't throw error in first scenario where we have not created an instance/object yet for the class Myclass
!e ```py
class MyClass:
value = 'default'
def switch(self):
self.value = 'switched'
instance = MyClass()
print('a', instance.value)
instance.switch()
print('b', instance.value)
print('c', MyClass.value)```
@somber heath :white_check_mark: Your 3.11 eval job has completed with return code 0.
001 | a default
002 | b switched
003 | c default
You mean Scoping?
can we say after line 5 instance = Myclass(), then self.value is evaluated to instance.value?
and then after line 8 instance.switch(), then self.value is evaluated to instance.switch.value ?
TIL __get__ only gets called if it's defined
Yeah, Scoping is important. I know some basics, but not very confident on scoping concept
If any of those methods are defined for an object, it is said to be a descriptor.
Sorry, what is the double underscore __ get __ point. Can you please explain
!e
object().__get__
@vocal basin :x: Your 3.11 eval job has completed with return code 1.
001 | Traceback (most recent call last):
002 | File "/home/main.py", line 1, in <module>
003 | object().__get__
004 | AttributeError: 'object' object has no attribute '__get__'. Did you mean: '__ge__'?
the place you will it encounter most often is method calls
opalmist r u free anytime cuz i need to learn some basics of python cuz i am new to it
!resources
The Resources page on our website contains a list of hand-selected learning resources that we regularly recommend to both beginners and experts.
Corey Schafer, YouTuber,playlist for Python beginners.
can you please elaborate a bit on get method and function call, if possible with any example
oh thank you!
!e
class C:
def m(self):
pass
print(C.m)
print(C().m)
print(C.__dict__['m'].__get__(C(), C))
@vocal basin :white_check_mark: Your 3.11 eval job has completed with return code 0.
001 | <function C.m at 0x7fca8cfe8680>
002 | <bound method C.m of <__main__.C object at 0x7fca8d04c310>>
003 | <bound method C.m of <__main__.C object at 0x7fca8d04c350>>
last two lines do the same, but the last one is desugared
!e
class C:
def m(self):
pass
print(C.m)
print(C.__dict__['m'].__get__(None, C))
print(C().m)
print(C.__dict__['m'].__get__(C(), C))
@vocal basin :white_check_mark: Your 3.11 eval job has completed with return code 0.
001 | <function C.m at 0x7f6eebec8680>
002 | <function C.m at 0x7f6eebec8680>
003 | <bound method C.m of <__main__.C object at 0x7f6eebccc2d0>>
004 | <bound method C.m of <__main__.C object at 0x7f6eebccc310>>
with desugaring for first thing too
opalmist can u accept my frnd req? so i can dm you when i get stuck in python
you can just ask here or in #1035199133436354600
ty
Hey @rugged root Any idea when the CodeJam for this year is ? Or which channel to get in touch with. GameJam has a channel none for Codejam
is pycharm good for programming??
still not sure what this does
yes
super() is one of the weirdest objects in Python, imo
there's, like, so much obscure stuff combined
well, it's somewhere in-between
okay
!e
class C:
def __init__(self):
print(super())
print(type(super()))
C()
@vocal basin :white_check_mark: Your 3.11 eval job has completed with return code 0.
001 | <super: <class 'C'>, <C object>>
002 | <class 'super'>
okay
> <class 'super'>
^ this thing
I.... huh
Is it like a wrapper?
it lives in some sense by the same rules as .__name attributes
(when called without arguments)
because it "knows" the class context it gets invoked in
you still probably should specify those attributes if you ever choose to inherit from two classes
I am not following this point. May i know What is this in context to?
!e
class C:
def __init__(self):
self.__something
C()
@vocal basin :x: Your 3.11 eval job has completed with return code 1.
001 | Traceback (most recent call last):
002 | File "/home/main.py", line 5, in <module>
003 | C()
004 | File "/home/main.py", line 3, in __init__
005 | self.__something
006 | AttributeError: 'C' object has no attribute '_C__something'
appends _ClassName to the start of the attribute name
Do you mean it prepends _classname to the attribute name when we use "." ? [actually "" just double underscore, without the dot]
with some nuances in terms of how it handles the name
#bot-commands message
#bot-commands message
value.__attribute is handled differently, compared to value.attribute and value.__attribute__
Okay
do you have a degree in computer science more specifically ai?
me? No, and n o
I am very keen to learn though
you need to understand the underlying mathethamatics to ever begin to understand how to create your own models
only to some extent
I'd draw the line somewhere between knowing what derivative of a certain activation function is and actually proving it
(for example)
Yeah, I am reading up from the deeplearningbook.org
there was a good book one of the admins here linked me which would actually be a good tool for self teaching
lemme see if i can find the link
oh that would be great thanks!
Thank you for sharing this!
yeah it's a great tool I've seen some of the ebook
Oh fantastic! Thanks a lot!
You mean the 3/4 pages of the book on the website or is there a ebook link?
no my friend has it and he screen shared it
Okay:)
in Factorio trains don't wear out/break down, right?
nope
in OpenTTD they do
I haven't played either of those two games long enough to properly understand how to use trains
the only recent change I remember is them changing how rivers are generated
yes, you can
you can choose between two or three main packs
Hey all π
Yo
OpenTTD also changed how they distribute binaries for Linux, so a relatively popular docker image of it no longer builds
Sounds like DockerFile maintainer problem
actually yes
OpenTTD Dockerfile is relatively simple to put together now, compared to earlier
just unpack the archive, move things where necessary, done
battlebit has cosmetic dlcs
wait, how many players can one OpenTTD server handle?
somewhere near 256
255
Multiplayer Tycoon games just don't make sense to me
I think if it's cooperative it's not much different from singleplayer
It's competitive in OpenTTD
πΊπΈ we're bring democracy to local life πΊπΈ
Freedom the FUCK out of it
"why avoid polluting the local environment if you can just convince the locals it's better for them?"
And take their one singular fish
Interesting. There's a potential reason why the fish is required.
oh shoot it's expensive
Since it's tough to automate raw fish, it makes it tough to make fucktons of Spidertrons on the regular
maybe that's why they did it
Yeah, seems purely to be a balance thing
Hello again Mr Hemlock
realistic and reasonable balancing mechanism
Hello
What do you do?
I do IT
Yeppers. I enjoy it
Fair
what got you into it
Always loved computers and fixing them. Although it wasn't my original major
That was Mass Communications: Radio/TV
Symantec -> NortonLifeLock -> Gen
I was at one college that had a studio on campus, so there was a lot of hands on stuff there. But when I switched, there wasn't, so it became all just theory and not application
It put me off of it, so I swapped to Computer Information Systems
Since the mass comm route I was aiming for the tech side anyway
Eh....
I mean it gave me tons of tools, but IT always makes you think on your feet anyway
Uh huh
In fairness I only got my associates
I went to like 6 different colleges across 3 different states. Lot of moving, a lot of transferred credits being turned into elective credits, so a lot of lost progress
I just couldn't handle it anymore
Wow
Having like 100+ credit hours in electives really takes the wind out from under your wings
Rabbit sounds like a very interesting person
He's knowledgable
steps to get caught:
write everything down
brag
True
Basically
Hahahahahaha
haay
why is it so quiet π
Talking with our IT
You're at work?
Yep
@dense ibex do you work with deep learning models?
@rugged root
for x : vec.iter()
or
for x in vec.iter()
is first anywhere other than C++?
Ocen currently lol
in iterates over all members
of iterates correctly
haay
something went very wrong
(same plots as earlier, but now on Rust repo)
and different commit ordering
@viscid scaffold #career-advice
ty
I come here to ask for help, I have an interview in a couple of days but I am not native speaker, I would like to play some kind of role where someone interviews me
euh
are they tho
oooh
i tried to learn japanese and then I gave up
cinamon tree
Weird right?
yeh
"extroverts" -- quite an assumption
I'm here because it is really the most interesting voice chat in the whole of discord
Nobody said introverts don't have friends
Lmao nice one
Shades of grey
like 50 shades
I'm becoming more extroverted as I grow older. These days I can maintain eye contact AND do small conversations.
it's wild.
is it though
0x50 Shades of Gray
it's like. what will I do next.
!e py print(int('50', 16))
just smile and wave
@somber heath :white_check_mark: Your 3.11 eval job has completed with return code 0.
80
do u guys use github or gitlab
git clone
.
.
sorry I'm just trying to get the gif out of my screen
in Rust, you can define a funtion inside another function
but that's just scoping
in, like, namespace sense
it's still not closure
!stream 271317820812427265
β @polar cedar can now stream until <t:1688401762:f>.
like in javascript
no
fn function declarations in Rust don't involve closures
function function declarations in JS do
last is true for def and lambda in Python
yeah i dont think anyone can avoid devops completely these days
haha ok i take that back
for behaviour similar to JS, you need || thing
it's just too many ... configurations
@polar cedar Can you change your stream quality to better text readability mode?
yaml yaml yaml
love that
@elfin bone It's typically better to ask your question in here or in the help system (see #βο½how-to-get-help for more details on that) so that more eyes can see the problem and help you
someone will definitely end up making another SGML derivative trying to fix YAML
yasgmld
yet another sgml derivative
XML is one of things that evolved from SGML
also HTML
pfft
HyTime (Hypermedia/Time-based Structuring Language) is a markup language that is an application of SGML. HyTime defines a set of hypertext-oriented element types that, in effect, supplement SGML and allow SGML document authors to build hypertext and multimedia presentations in a standardized way.
HyTime is an international standard published by ...
the vc after midnight is so nice I should stay up more often
> DSSSL (ISO/IEC 10179) β Document processing and styling language based on ...
> scheme
domain-specific-specific-specific language
also need to un-collapse the category if that's the case
cuz the Europeans have finished supper and the Americans are all awake
what is there anything now other than Sphinx and MkDocs?
uh
something else
# there is always markdown
but I forgot what it's called
oh so markdown doesn't auto render on here. π¦
well aren't you special
gitbook I think
Just use Obsidian Publish.
it absolutely does
Python-centric I meant
not sure if this describe mkdocs well, though
not really
that's what my mom says abt my room
I am going to make a "basic python for java and javascript developers" guide in Obsidian Publish at some point, intended for my coworkers.
Such as "just use black and watch as code reviews stop turning into flamewars."
precisely why we do that at work
My workplace looks at python the same way it looks at they/them pronouns: without understanding
so, just use specific commits instead of versions?
for internal development it may be okay
but for anything public I'd say it's cleaner to openly/plainly specify what the dependency versions are
@lavish rover rewrite mdBook in Ocen?
thing used to make Rust book
Markdown
it uses the same visual format as cargo doc, but it's a separate tool
?
scar tissue is good
Do you want to hear something interesting?
3 men, an idiot, a mathematician and a physicist die in a car crash and appear in front of the gates of heaven
Unfortunately, heaven is full and st peters and the devil have a hard time deciding who goes where. The devil then proposes that a challenge will be given to each of the three men.
Those who succeed will be allowed to enter heaven and those who fail would spend the rest of eternity in hell
The mathematician gets a complex math equation. Unfortunately, he fails and the devil sends him to hell
oh fuck no I butchered it
It's the other way round. Each of the three men challenge the devil. If the devil fails, they go to heaven
aay
Alright, so the mathematician gives the devil a complex equation. The devil solves it and sends the mathematician to hell
The physicist gives the devil a complex question. The devil solves that too and sends the physicist to hell
Finally it's the idiots turn
He asks the devil for a chair. With a snap of a finger a chair appears out of thin air
The idiot drills multiple holes into the chair and sits on it
then what
He lets out a loud fart and asks the devil which hole the air came out of
The devil thinks for a while and takes a close look at the chair
He does some analysis and says it's the fourth hole from the right
The idiot smiles and says, "No, it came out of my a**hole" and goes to heaven
@lavish rover Pointer video
OO @lavish rover have you worked with diffusion models?
Oooh I was working on something and I've been stuck for sooo long
lols
Have any of you used DDPMS?
Also, can you please share few points related to how references (or something similar to pointers) are handled in Python
Dictionaries.
everything is passed by pointer already
Hashmaps.
@lavish rover hey have you used ddpms?
@lavish rover could you please share the video you mentioned related to pointers
Python does pointers so you don't have to.
C representation of Python object is just PyObject *
I misunderstood and thought you were asking about variables.
differences are just in whether you can change stuff that pointer points to
Yes, that is what i am trying yo understand as i am new go programming itself. I dont know how other languages work. So, i am trying to know how does Python handle or work with respect to references, pointers
in Python itself, notion of reference/pointer doesn't usually make much sense
it's when you dig into the machinery of it, where pointers appear
!d weakref
Source code: Lib/weakref.py
The weakref module allows the Python programmer to create weak references to objects.
In the following, the term referent means the object which is referred to by a weak reference.
A weak reference to an object is not enough to keep the object alive: when the only remaining references to a referent are weak references, garbage collection is free to destroy the referent and reuse its memory for something else. However, until the object is actually destroyed the weak reference may return the object even if there are no strong references to it.
!d gc
This module provides an interface to the optional garbage collector. It provides the ability to disable the collector, tune the collection frequency, and set debugging options. It also provides access to unreachable objects that the collector found but cannot free. Since the collector supplements the reference counting already used in Python, you can disable the collector if you are sure your program does not create reference cycles. Automatic collection can be disabled by calling gc.disable(). To debug a leaking program call gc.set_debug(gc.DEBUG_LEAK). Notice that this includes gc.DEBUG_SAVEALL, causing garbage-collected objects to be saved in gc.garbage for inspection.
The gc module provides the following functions:
sys.getrefcount(object)```
Return the reference count of the *object*. The count returned is generally one higher than you might expect, because it includes the (temporary) reference as an argument to [`getrefcount()`](https://docs.python.org/3/library/sys.html#sys.getrefcount "sys.getrefcount").
Rc in Rust, if you don't use unsafe, will at most cause a memory leak
because of recursive references
that's why this exists
https://doc.rust-lang.org/std/rc/struct.Rc.html#method.new_cyclic
A single-threaded reference-counting pointer. βRcβ stands for βReference Countedβ.
@lavish rover have you trained ddpms?
:(((
Mustafaaaaaa
thank you hemlock
Denoising diffusion probabilistic models
they perform better than GANs for things like image synthesis
openais repository isn't very well documented so it's a bit hard to use
Diffusion models are the future of generative ai
what's the question?
Thank you
How can someone join chat voice if i have a question?
You can ask in here.
What's up?
Oh also, for details on the voice gate: #voice-verification
ok thanks
"No Access"
@vocal basin Was not aware of 'weakref', just referring to the doc. Is it possible to share any ex for this?
By default, when we use variables, functions, classes: are those referred to as 'deepref'?
!stream 1053732836693258391
β @turbid sandal can now stream until <t:1688405923:f>.
How do you have such a positive outlook on life mr hemlock
She leaked her password?
Oh shit my bad
@elfin bone What's your question?
age = int(input("How old are you?: "))
if age >= 18:
print("You are an adult!")
else: print("You are a child..")
so basically
if the person says hes a child (therefore below 18)
i want to say
You are a child, only ___ years to go!
therefore the ___ stands for the distance between 18 and the persons age
so my question is
hello
how do i find the distance between two int on python
from the input placed by the user
did i explain that well?
!e
age = 4
print(18-age)
@rugged root :white_check_mark: Your 3.11 eval job has completed with return code 0.
14
Same way you would do math in general
ohhhhhhhhhhhhh
Ye
I'm using colab and want to share a specific folder of my drive because it's a project with multiple other collaborators
Where can i start learning python for free ?
watch yt videos
Is there a way I can limit the access to only that particular folder instead of my entire drive
besides youttuve
any website that has like curricullm on where to start
!resources
The Resources page on our website contains a list of hand-selected learning resources that we regularly recommend to both beginners and experts.
there are
ok thank you, people here are saying youtube but yotutube can be disorganized with starting points
hemlock
crazy how so many people said youttube
youtubes great
lando
youtube
is good
for this
its really good
like
REALLY
good
trust me
just do it
you watch videos
and ask questions here
no thanks, hey bro can you dm the website name?
This is getting pretty spammy. Please just write more on a line.
hey hemlock do you believe if all the vc worked on a website they'd finish it in a week
specifically a sales website
Hello, Chris
@wind raptor how do i get access to vc?
Hey! How are you?
!voice
Canβt talk in voice chat? Check out #voice-verification to get access. The criteria for verifying are specified there.
You should qualify now @elfin bone just visit the channel above and follow the instructions
well
i should be qualified
why isn't it giving me it
can u rank me
i'm active on this server
and ask questions
im busy rn im watching hemlocks class
can u rank me
You are right on the 3rd day, so it might just be a little later
No
fine
how many days have i been here? how can i tell
Everyone goes through the same verification
1304 days
so you should qualify
ok can you add me when you have time
@rugged root#0#0 can we not pass the arguments to a function (second approach), similar to first approach using classes?
For line 12 and 13 we have passed the arguments to a class
Similarly can we pass the variables of sally/billy to a function is my question and the pros/cons of it?
what does innit do
Hemlock's voice is so comforting
he's livin the laptop lifestyle
what does with do
It's called a context manager. It makes sure that the __enter__ and __exit__ methods of the object given to it are called, even in the event of errors. For with open, it means that the file gets closed properly, without needing to call file.close.
Safe buildup/teardown, essentially.
@rugged root note sure if I missed your explanation earlier. can you please share the cons/pros of using a function student and then as in line 12 and 13 we pass the function arguments related to sally, billy?
Basically pros&cons of function vs classes
Yeah, I am trying to make sense of how to understand these two use cases. Or how to decide
For example, When i write my code for some code problems and have to choose between classes and functions
Wait are you in VC
I understand that both can be used for repeating a block of code
Sorry, my connection has some issues. I am back
So we put in common functionality in the Base class both goblins and players should be able to attack
Will you record this stuff for those who can't make it to the end ?
@rugged root could you please go over the super related point as i didn't grasp that?
Soup or related? You decide!
I mean super(). Can we please go over the super() part on this ex single inheritance example for class player
@rugged root if age >= 18:
print("You are an adult!")
else: print("You are a child"+", "+"only"+str(18-age))+"years to go!"
i did the 18-age
else: print("You are a child"+", "+"only"+str(18-age))+"years to go!"
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^
TypeError: unsupported operand type(s) for +: 'NoneType' and 'str'
what is going on
age = int(input("How old are you?: "))
if age >= 18:
print("You are an adult!")
else: print("You are a child, only "+str(18-age))+"years to go!"
whats the problem with the code?
!e ```py
class A:
def init(self):
print('A')
class B(A):
def init(self):
super().init() # A is printed
print('B')
b = B()```
@somber heath :white_check_mark: Your 3.11 eval job has completed with return code 0.
001 | A
002 | B
)
?
age = int(input("How old are you?: "))
if age >= 18:
print("You are an adult!")
else: print("You are a child, only "+str(18-age))+"years to go!"
Β°vΒ°
i know some
indentation
and parentheses position
well
start by posting it properly because I can't read it properly like this
!e age = int(input("How old are you?: "))
if age >= 18:
print("You are an adult!")
else: print("You are a child, only "+str(18-age))+"years to go!"
@elfin bone :x: Your 3.11 eval job has completed with return code 1.
:warning: Note: input is not supported by the bot :warning:
001 | How old are you?: Traceback (most recent call last):
002 | File "/home/main.py", line 1, in <module>
003 | age = int(input("How old are you?: "))
004 | ^^^^^^^^^^^^^^^^^^^^^^^^^^^
005 | EOFError: EOF when reading a line
you can't run input in the discord bot
you don't have an interface to input it into
else: print("You are a child, only "+str(18-age))+str(" years to go!")
~~~~~~~~~~~~~~~~~~~~~~~^
TypeError: unsupported operand type(s) for +: 'NoneType' and 'str'
so basically
i need to add str
to youare a child
?
but its already an str
you're closing your print statement too soon
before the last +
count them and you'll see
age = int(input("How old are you?: "))
if age >= 18:
print("You are an adult!")
else: print("You are a child, only "+str(18-age)) +str(" years to go!"))
im not sure what ur trying to say
can u fix the position so i can understand bc
next to the +
the last one
i still see no problem
what you have right now is this
age = int(input("How old are you?: "))
if age >= 18:
print("You are an adult!")
else:
print("You are a child, only "+str(18-age)) +str(" years to go!"))
yes
the problem is in your last line
print("You are a child, only "+str(18-age)) +str(" years to go!"))
# ^ you're closing your print statement here already
yes
but where
is the problem
thats what i dont get
i know its the last line but im not sure where
Point1: Basically when we pass a classA as an argument into another classB using class classBname(classAname) , Then this means class B extends class A (similar to other languages where we use extend keyword).
oh
age = int(input("How old are you?: "))
if age >= 18:
print("You are an adult!")
else: print("You are a child, only "+str(18-age)+str(" years to go!"))
this better?
yes
except you don't need the last str()
because it's already a string
np
!fstring @elfin bone
Creating a Python string with your variables using the + operator can be difficult to write and read. F-strings (format-strings) make it easy to insert values into a string. If you put an f in front of the first quote, you can then put Python expressions between curly braces in the string.
>>> snake = "pythons"
>>> number = 21
>>> f"There are {number * 2} {snake} on the plane."
"There are 42 pythons on the plane."
Note that even when you include an expression that isn't a string, like number * 2, Python will convert it to a string for you.
one thing at a time, perhaps
Point2: when super keyword is used, compiler will firat look for it the parent class. Basically parent class takes precedence is it?
@mr.hemlock @somber heath can i please know if my understanding in point1 and 2 is correct?
that doesn't change the fact that if you cram in everything at once nothing will stick
plus i prefer when theres a big mess
now that is a bad reason
b/c it reminds me of my soul... im emo...
Half the problem was the concatenation.
the problem was the parentheses
my love..
what the fuck
reminds me of my
dark
emo
soul
....................
my meo soul.........
my emo.........
meo
im so emoo... so goth
meow
cool
good with python
and be able to become
bill gates
jk
hey guys
do u believe if the entire vc
Step away from the enter key.
I think in about 2 minutes you'll be warned if you keep spamming single sentences in a gazillion messages
worked together
wai ok
wait
if the entire vc worked together
do you think they can recreate amazon in less than 2 weeks
that requires money, not programming knowledge
ok wait
how
explain
other than getting
investors
and getting products
if you have a finished website
you can somewhat easily get
investors
doubt
maybe not great
investors
but small
but do u think
the vc can
recreate amazon
in less than 2 weeks
the website in general
peradventure
blah_the_second.py
shut up @cosmic lark
pwnadventure
no u
Stop the spam @elfin bone
ok fine
@rugged root are you recreating Shantae: Risky's Revenge in python?
im going to ban you too chris
can i get admin?
so i can ban
people
also this isn't bad spam its only a few lines
if you need any values i can tell you
It's burying any other conversation
@rugged root i got a question, what does the moderator badge on ur discord profile mean
@wind raptor can i get vc now
:=
+=
no
It's not like a vote thing
no
lets vote people
no
!voice veriy
Canβt talk in voice chat? Check out #voice-verification to get access. The criteria for verifying are specified there.
after u
Keyword args kwargs
if (x := some_expensive_function()) != 3:
y += x
what does the function = too
to
!e py print((text := 'abc')) print(text)
@somber heath :white_check_mark: Your 3.11 eval job has completed with return code 0.
001 | abc
002 | abc
= doesn't even occur in that code
a conversation
Hemlock is explaining Python concepts.
the variable
@elfin bone you are not making sense
!e
lambda x : print(x)
@cosmic lark :warning: Your 3.11 eval job has completed with return code 0.
[No output]
sadge
@whole bear yes, that is the basic concept of kwargs
look
basically
what im trying to tell you
is that, there is a variable named some_expensive_function
some_expensive_function stands for something, right? like it can stand for a tree or the amount of people in a class
what does some_expensive_function stand for
oh, a function which takes a long time to execute
any function, it doesn't really matter what
ok wait
plome
do you know how to make a calculator that will calculate the digits of pi
@rugged root Sorry, the sentence was interrupted. I didn't follow what is the pint about single quotes that was just being made?
!e
import math
print(math.pi)
@gentle flint :white_check_mark: Your 3.11 eval job has completed with return code 0.
3.141592653589793
that will go on forever
!timeout 715259748504698924 1h You were asked multiple times to stop splitting your sentence into 2-3 word lines, as it is spammy. Take a break.
:incoming_envelope: :ok_hand: applied timeout to @elfin bone until <t:1688414684:f> (1 hour).
@elfin bone if you continue DMing me I will block you
I do not provide help via DMs
@whole bear that's some weird game you're playing
@rugged root can you please share the shortkey that you used to correct the multi cursor at end of line or something like this ( but basically multiple line editing)?
is there an issue or something?
@gentle flint
was just surprised
oh ok
!stream 651519394673065989
β @whole bear can now stream until <t:1688412005:f>.
thanks for going through that with us @rugged root
wfh today & the market closed early today so was able to join early today
self, *, ...
^ makes you use kwarg syntax only
!e
def f(a, b = None, /, *, c, d=None):
pass
@vocal basin :warning: Your 3.11 eval job has completed with return code 0.
[No output]
"This person is in the voice chat and is voice verified, therefore I am somehow going to assume that their DMs are open."
If I had a nickel for every time I experienced that on here, I could retire already.
Back on in a moment, delivery run
Python has a different model of types/polymorphism compared to Java/C#
duck typing is more pythonic
!d typing.Protocol
class typing.Protocol(Generic)```
Base class for protocol classes.
Protocol classes are defined like this:
```py
class Proto(Protocol):
def meth(self) -> int:
...
``` Such classes are primarily used with static type checkers that recognize structural subtyping (static duck-typing), for example...
^ if you ever wish to express duck typed methods more strictly
!e
from typing import Protocol
class DuckLike(Protocol):
def quack(self) -> None: ...
# class Duck(DuckLike)
class Duck:
def quack(self) -> None:
print("quack")
class FakeDuck:
def quack(self) -> None:
print("quackn't")
def quack_twice(duck: DuckLike):
duck.quack()
quack_twice(Duck())
quack_twice(FakeDuck())
@vocal basin :white_check_mark: Your 3.11 eval job has completed with return code 0.
001 | quack
002 | quackn't
works for everything is Any
that's just interfaces, i want DUCK TYPE
most of the time you wouldn't even have DuckLike
i want my type checker quacking at me
somewhere between interfaces, traits and neither
worst of both worlds, specify everything and not have it enforced
interfaces, the way they are in C#/Java, need to be listed when you declare the class
Bourne Supremacy
my templates are duck typed come @ me
supremaC++
why did I laugh
def quack_twice(duck):
duck.quack()
quack_twice(Duck())
quack_twice(FakeDuck())
if it has quack implemented, it's an instance of DuckLike, as far as type system is concerned
!e
def quack_twice(duck):
duck.quack()
quack_twice("duck")
@vocal basin :x: Your 3.11 eval job has completed with return code 1.
001 | Traceback (most recent call last):
002 | File "/home/main.py", line 4, in <module>
003 | quack_twice("duck")
004 | File "/home/main.py", line 2, in quack_twice
005 | duck.quack()
006 | ^^^^^^^^^^
007 | AttributeError: 'str' object has no attribute 'quack'
@lucid blade
this is exactly me
how do i make a calculator
π
!d decimal
Source code: Lib/decimal.py
The decimal module provides support for fast correctly rounded decimal floating point arithmetic. It offers several advantages over the float datatype:
if you want arbitrary precision
you should use something other than Python
for example, Wolfram (Mathematica)
or specialised system
arbitrary, dynamic precision is not something simple
Next timeout is a day. Please don't spam the chat.
Is it that hard to use sentences without hitting enter between every word?
yes, kind of, sometimes, but i prefer editing messages
shut up bro @vocal basin just sent like 8 messages bro
can you shut the fuck up actually
youre getting really targeting as if i'm the bad guy here
im just trying to learn and you're being fucking annoying
I'm not breaking sentences after each word.
ok fine
!rule 3
ill respect him if he stops targeting me,
a guy made a racist remark a few minutes ago
and he didn't do anything to him
im reading the doc u sent me @vocal basin
For Cython sure
very helpful
But that's a special case
https://www.bol.com/nl/nl/p/mok-koffiemok-schedel-patronen-punk-cartoon-mokken-350-ml-beker-koffiemokken-theemok/9300000089520196/
https://www.bol.com/nl/nl/p/magische-mok-foto-op-warmte-mokken-koffiemok-schedel-patronen-punk-cartoon-magic-mok-beker-350-ml-theemok/9300000089520208/
Mok - Koffiemok - Schedel - Patronen - Punk - Cartoon - Mokken - 350 ML - Beker - Koffiemokken - Theemok. Grote mok - Schedel - Patronen - Punk -...
what is that?
My vote for 2nd one as well!
the two options for my sister's birthday present
I wasn't targeting you. You were the only one spamming 2-3 word messages in the chat in quick succession and other people were getting annoyed. I asked you to stop and you didn't. I feel like I've given you plenty of leeway here. At this point, you choose your own destiny.
p.s. I don't see everything in text chat because I'm not always watching it. If you feel like reporting something, you can use the mod tag to call something out.
I forgot the names, turns out
it's cinit and dealloc
meanwhile the delivery instructions:
What lang or code is this?
Considering this group is beginner friendly, many questions could have been stupid I guess!
koi-8 to iso-8859-1
pseudocode is meant to be understandable by humans
who burger
English
Haha, I thought the same!
@vocal basin Which sort of encoding or language is this?
Software is complicated. Machine learning, microservice architectures, message queues... every few months there's another revolutionary idea to consider, another framework to learn. And underneath so many of these amazing ideas and abstractions is text.
When you work in software, you spend your life working with text. Some of those text files a...
"no, I will not fix your compiler"
Wack a Penguin: How to take all your frustrations with Arch out
especially
You muted me exactly when the racist talk was coming in
on the same channel
oh, the memes start only at the second page of aliexpress search
why is there so many with Python logo
well, obviously, because ones with Rust logo aren't allowed
@gentle flint @lavish rover
@vocal basin it say "infinity" is a code in python (i want to calcualte digits of pi)
but when i write it in
nothing appears
I like how there's no product title