#python-discussion
1 messages · Page 191 of 1
er?
entity/relation
just for reference I'm paying not even 4€ a month for a 2 core 4gb ram 40gb storage vps, only concern here should be usability and to a lesser degree maintainability, as there's no way that amount of records should be hitting any machine limits
you just need some identifier, you could try to force them to keep the same identifier as a course evolves, or when modifying something one could note somewhere "X is the modified version of Y" or whatever
correct
with my method:
try to differentiate each lessons by their class number
if that does not work
add the day
if that does not work
add the venue
so on and so forth
that's exactly what i meant by having to do a lot of "guess work"
as you can imagine, this logic will be quite complex
you can only do so much with garbage data

so now the question becomes: do i add this
the thing with a "course number" shouldn't be part of the lesson, it should (I think) be a separate relation table.
would this mapping be easy to make for a human?
pushing for making the data saner would be a good idea
hmm
the thing is, the method by which we get this data from the university is not stateful, it does not read the current database during ingress
the method (we call it scraper but it's more like API caller) runs without calling the API to access the previous set of data
i can see how you can map the old data to the new data and assign each unique a course number/id
i guess that's something to consider
how should thing work between years?
is a course repeating annually the same course?
all of this will be so much easier to understand if we just got to see some examples of data lol
is it completely independent? or is there a connection between the instances of the course?
What about something like
uh wait
the timetable is something like semesterData
i see a moduleCode in there
and the problem we are trying to solve is ?
this is one module, with multiple class number and each class number may have multiple lessons
covidZone in 2026?
technical debt
oh, so you're having trouble finding which specific lesson changed and in what way
there are no identifiers for lesson themselves
currently we are using the index in the list, which as you might imagine, is very unstable
yep, can add or remove lessons
anyway so each student can have any combinations of these lessons for every module
can you explain why a mapping needs to be made from old to new to begin with? I assume there is some (user-specific?) info which is stored against each lesson which needs to be carried over, but I am not sure what it is
so basically each student receives a semesterData that has schedule of all subjects and all lessons without any indicator for which subject it belongs to ?
i assume "one module" means "one semester" ?
@bronze dragon
nah, each JSON is for one subject I believe
each module json contains multiple semesters
yea
so... is it something like the course is offered simultaneously on (say) Tue/Wed and Mon/Thu tracks, and as a student I can choose to attend whichever?
any combinations of lessons, because the student might be Teaching Assistant
the string representation looks like this now: https://nusmods.com/timetable/sem-1/share?CS2103T=LEC:(27,47,49)
so if an update happens to one of the classes which the student had assigned themselves with, you've to figure out the diff and get the updated value for what the student was assigned to.
Are the updates one at a time, or multiple at a time
we also want this share link to work across data changes by the faculty
kinda
obviously the implementation is not hard
but is it maintainable?
this problem really surrounds around the lack of identifiers, isn't the most logical solution to add some form of identifier?
yea im thinking of how we might be able to do that
it sounds like it'd break very often
why?
you're pretty much guessing what changed
im assuming you are talking about this method
yeah yea
if you gave it to a human, would they be able to generate a correct mapping easily?
I'm thinking, since you have a large userbase, you could get the mapping crowdsourced
what's the ownership of the initial json api, can you modify it or is it faculty provided
i will note that down as a suggestion
it's generated from a list the faculty provides
also, 3 hour lecture from 1200 to 1500 is diabolical
the API is maintained by us
it's more like 1 hour with a break and another hour, in practice
i can see how you can generate an identifier from comparing the old dataset from calling the API and comparing with the new list
so im going to write that down too
you'd have to maintain a db of states then
And, if you need to, you can use similarity measures to try to cluster "like" lessons (if needed).
w each lesson getting an ident in the beginning and modifications happening over the db like you defined
But more importantly, the goal is to fit the data into a data model... so the focus should be: what end state (data model) do we want to end up in?
or better yet, if you can write a script to port the faculty lists to have identifiers in them
this is the current string representation
we want to be able to make the string representation stable across data modifications
there are no stable items within the size of unit of data to have a stable representation from initial to final unless you're tracking it all and providing them fixed uuids from the start
randomly generated works ig
it wont work across data modifications would it
or autoincrement on the db if you're using that to track it
it'd be based off of whatever method you choose to track the changes
right now you're not storing the history of changes anywhere, right? you just have the present moment's schedule data
yes
though, while generating a new set of data, technically you could write some code to call the API to get the current set of data
it doesn't seem like it would be a huge increase in storage burden to store a history of changes
Do they modify it during the semester?
if not history of changes, you could have a db that poulates random uuid for a lesson at initial and then you update the db everytime you detect a change
only storing the uuid and the lesson
even if they were issuing new schedules every week, that's not a lot of data from a storage POV
no, but they do during the course registration period, depending on the vacancy and number of people who are bidding
Hello
the university's API is not pub sub
if I had a dynamic database and I am interested in getting the top 10 (positive and negative) values from a column, what data structure would be suggested? I was looking into heapq, but not sure if it loads all the data into memory
we run the "scraper" every hour (iirc)
man, this problem is hard to solve
maybe the constraints so far don't allow for better solutions
if i represent the data as a "minimally-differentiable-identifier" i was thinking it can be stable enough
isn't heapq a data structure? why wouldn't it be in-memory
actually
How about "course-version" which increments if any lessons changed?
i suddenly had a revelation
for all normal students, we can just store the class numbers
Sorry I miswrote, but do you have any suggestions?
i think heap is the perfect data structure for your case, you want max and min right? and want it to be dynamic too
What database engine are you using?
for the teaching assistants, we store the class numbers and some other bit of information, but if that changes beyond recognition, we just inform the user that the matching could not find the lesson that matches
pgsql
yes
mm
because we can expect that a student wont have more than one or two TA modules, the string representation is not going to be very long
even with the extra bit of info, like venue or day
the class number is like 2 chars
oh lol
. 👍
I guess I will try with heapq first 😄
as yous might have been able to tell, im quite averse to touching the API, because quite a few other apps have actually popped up that piggybacks on this API to work
create table myvals as SELECT * FROM generate_series(1, 100) t(x);
with q1 as (select *, row_number() over (order by x) rn from myvals)
select * from q1 where x < 10 or x > 90
oof
and if some changes i make causes some major issue, it's bringing down the entire ecosystem
Thanks I will try this implementation as well
Didn't know about this tool, nice
ive just remembered
i also have to talk to the other peeps
about this change
since some of them also use this string representation
but at least the next release period is in 7 months
so we should have quite some time
it's not recommended
Why so?
From: #python-discussion message
If you prefer to watch video tutorials Corey Schafer's playlist is also really good: https://www.youtube.com/playlist?list=PL-osiE80TeTskrapNbzXhwoFUiLCjGgY7
Alr
the pedagogy leaves much to be desired because they only show the code and does not prompt you to actually think for yourself
Ohh
Right
quite a few people actually came to the server from the video
and they encountered an issue that they could not solve
because they copied the code wrongly from the video
ideally we want to help everyone develop the critical thinking skills to read and understand errors
and solve it themselves
Hiiii I just started to learn python can someone help me a lil bit? Ty❤️
ask, people will help!
Specific questions help us to help you.
Where do I start from, started to learn python 2 days ago and idk 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.
Automate the Boring Stuff is a really good book for complete beginners and it's free to read online: https://automatetheboringstuff.com/#toc
If you prefer to watch video tutorials Corey Schafer's playlist is also really good: https://www.youtube.com/playlist?list=PL-osiE80TeTskrapNbzXhwoFUiLCjGgY7
I also recommend Harvard’s free online course, CS50P: Introduction to Programming with Python: https://pll.harvard.edu/course/cs50s-introduction-programming-python
This is an alternative online course with lots of integrated practice problems you can do directly in the browser: https://programming-25.mooc.fi/
Yo ty so much 🙏 ❤️
i should make a list of my own
this is way too long
i made the pokemon game
then vsc just gave out an error and the file got marked red and lost 😭
not even in the recycle bin
i dont remember anything i wrote in it
oh no...
how did you delete it?
i switched to zed there after
I didn't do anything
For some reason, the file got strikethroughed
I HAVE NO IDEA EXACTLY
I was so confused, I started typing print(bye world) without the quotations
hello everyone! I wasnted to ask a quick question, how do i check if something is an int or a float or a bool, I'm using a list
name_list = [
("name", "name desctription", int(1)),
("name 2", "name 2 desctription", float(0.0)),
]
for name, name_desctription, name_type in name_list:
#idk what to do after this point
if?
like if thisvariable==bollean
i've no idea im new
use isinstance
don't put non-numbers where the numbers are. then you don't even have to check

btw, int(1) is the same as 1, and float(0.0) is just 0.0
I'm working with blender and for whatever reason it gets mad at me when i don't add the type before
interesting. Can you show us more details about the bad thing that happens? I don't understand why that would be.
i'm creating a custom property for an object, when it comes to int and float, nothing happens really, but when i try to add a bool, it turns into an API defined property and i can't edit it in the UI, I'll give you an example
you are using vscode now right?
try using vscodium
im using zed
rn im on zed
who recommended zed to you?
I'm a bit new, what does this mean exactly? :') thank you
zed is quite new, and it's not exactly widely recommended to beginners
my friends
Four is too long?
I can't send pictures in here, but it doesn't return any specific error, its just to avoid from being locked out of being able to modify the custom property through the UI (cause API defined properties aren't editable in the UI), i just add the type before to avoid any unwanted lockouts (cause i can't even delete the custom property through the UI if its API defined)
!d isinstance
isinstance(object, classinfo, /)```
Return `True` if the *object* argument is an instance of the *classinfo* argument, or of a (direct, indirect, or [virtual](https://docs.python.org/3/glossary.html#term-abstract-base-class)) subclass thereof. If *object* is not an object of the given type, the function always returns `False`. If *classinfo* is a tuple of type objects (or recursively, other such tuples) or a [Union Type](https://docs.python.org/3/library/stdtypes.html#types-union) of multiple types, return `True` if *object* is an instance of any of the types. If *classinfo* is not a type or tuple of types and such tuples, a [`TypeError`](https://docs.python.org/3/library/exceptions.html#TypeError) exception is raised. [`TypeError`](https://docs.python.org/3/library/exceptions.html#TypeError) may not be raised for an invalid type if an earlier check succeeds.
Changed in version 3.10: *classinfo* can be a [Union Type](https://docs.python.org/3/library/stdtypes.html#types-union).
For the attention deficit:
- CS50 is a widely recommended course here for fundamentals of programming with python
- Automate the Boring Stuff is a good, free book for beginners, goes into using python in many real life scenarios
- If you prefer Youtube, this playlist by Corey Schafer is good
- Regardless, you have to write code to actually learn, try these online practice problems
not this shit again
that's what i got banned for last time
I could see why bool might need special handling
sup neddy
not much Hoodster
i actually loled at that
are you a real cpython guy
yeah bool does need special handling, but i don't mind adding the type before hand, if anything it makes it easier for me at least, me personally
certainly, but this seems like an odd thing to ask.
idk what you mean by a real cpython guy
let's drop it
That's nice. The last point is maybe a bit misleading, it's not a practice problem site, it's a full Python course with practice problems with editor and runner integrated into the course material.
I see hold on
your taf
i think that snippet is long, but bullets would make it more accessible to the overwhelmed. Maybe also use markdown to make the links more implicit in the titles of the pieces.
idk what taf means
Good points, thanks for the feedback.
How about something like this?
- CS50 is a widely recommended course here for fundamentals of programming with python
- Automate the Boring Stuff is a good, free book for beginners, goes into using python in many real life scenarios
- If you prefer Youtube, this playlist by Corey Schafer is good
- Regardless, you have to write code to actually learn, try this course with practice problems and an editor for you to write and run code in
does anyone like to use kivy?
it's interesting to see us each develop our own custom "embeds"
I do hope at least one of them makes it into @edgy kraken
maybe we could make embeds like these version controlled
@edgy kraken would be a good home
I was under the impression that the existing tag embeds were in version control. As opposed to being in the database.
not one kivy py lib user?
What would you ask someone who claimed to be?
- Automate the Boring Stuff is a really good book for complete beginners and it's free to read online:
- If you prefer to watch video tutorials Corey Schafer's playlist is also really good
- I also recommend Harvard’s free online course CS50P: Introduction to Programming with Python
- Python Programming MOOC 2025 is an alternative online course with lots of integrated practice problems you can do directly in the browser
How's that?
only change i might make is to change the I to we
My b wrong place
i said this hastly not out of curiosity.
because quite a lot of people recommend CS50
I use "I" because this is my list
ah ok
I don't want to speak for other people
nice! You have a stray colon at the end of the first bullet. (I would also use periods at the ends of the sentences, but I am old)
- @pallid gardenand I also recommend Harvard’s free online course CS50P: Introduction to Programming with Python
Hi, from where do I take the CS50 course. EDX or cs50.edx.org. I'm looking for free options
Just for you:
- Automate the Boring Stuff is a really good book for complete beginners and it's free to read online.
- If you prefer to watch video tutorials Corey Schafer's playlist is also really good.
- I also recommend Harvard’s free online course CS50P: Introduction to Programming with Python.
- Python Programming MOOC 2025 is an alternative online course with lots of integrated practice problems you can do directly in the browser.
comma after "tutorials" in the second bullet
comma after "course" in the third bullet
/pedantry
of course, we dont want to have to open a PR that is just 2 commas
i have built a offline facebook clone (no ui just backend) what should i add next i have how to add friends and name and follow others with see your following etc and with bio and with login and sign up and friend request and chat(its random for now) what should i add next in python
Sorry, just ran out of fucks.
say what should i add next?
can you post?
yup
can your followers see your posts?
the followers are just
all_users=[
{"id":1,"name":idk so they all are just data
to 100 users in all_users
well, try to make a system where you can logout of your current account and log into another account and see the posts from your first account
ok i will be working into it in like 5 min thanks for your time
add breakpoints
i dont think ive ever used breakpoints
To be clear i'm already using pycharm but im considering switching to another IDE if im gonna be learning more than just python.
pycharm literally only does python im pretty sure
same!
use vscode
what's the usecase here, that's just unnecessary
isn't that what pros do
no, that's a dumb thing to do unless you're debugging
can i make a custom dict that lets me do dict[index]
You an make any class work with [index]
welp imma try it then
using the __getitem__
__getitem__
that's what he said
class MyClass:
def __init__(self):
self.a = 1
self.b = 2
def __getitem__(self, key):
if key == "a":
return self.a
elif key == "b":
return self.b
now obj = MyClass(), obj['a'] and obj['b']
He said using index not keys
that's close but not exactly
i mean, the syntax doesn't change tho?
index?
do i need an init
you mean to have both the dictionary and the ability to run integer indexes on the keys?
i believe so
i suppose you would have to create a separate list to maintain order for indexing
but insertion and deletion would be expensive op, so prolly a b-tree for larger data
wait
b tree won't work, it'd be a rope
What's the use case of this?
idk
huh
but something similar to that, where each parent node knows the total lengh of the child nodes
def __getitem__(self, index: int):
return self.keys[index]
obj = Custom_dict({12: 2})
print(obj[0])```
Hey @fossil steeple!
Add a py after the three backticks.
```py
print('Hello, world!')
```
This will result in the following:
print('Hello, world!')```
i am just blabbering to myself atp, ignore
can you give an example of what you want?
built in dictionary does maintain order since v3.7 iirc
doesnt it ?
afaik dicts are now ordered according to the insertion order
I didn't knew that's crazy.
😭
YEAH IT WORKS
def __getitem__(self, index):
if isinstance(index, int):
return self[list(self.keys())[index]]
return self[index]```
wouldn't calling list() be expensive?
tuple then
no i mean, calling list(self.keys()) would be expensive
i'm gonna ignore that cos i don't wanna put in smth i don't understand
Hmm yeah
.keys() gives a view which you can't directly index
def __getitem__(self, index: int):
return tuple(self.keys())[index]
obj = Custom_dict({12: 2})
print(obj[0])
that's true but that's exactly why I didn't suggest that as a possible soln
i wonder what else i can do
list() on a hot path function like getting items by integer indexes is really expensive, unless the use case is not meant for larger dictionaries or if the use case is very rare
k
even tuple() for that matter
mm, i wonder too
Why would I ever need to get a dict value by index?
i've not ever had to use such a thing in the decade i've programmed
lads what are context managers
idk i just kept wanting to do it so i said sure i'll make it
with open("file") as fp:
fp.write("HELLO")
you see the with block? the file object implements a context manager
similarly, there are other functions that can do this neat trick
not sure what they're exactly
huh
I tried to number my dictionaries before I learned about hashmaps and enumerate, it's just a conceptual misunderstanding
enumarates are enums yeah?
which are just those constants
Basically Context managers help in cleaning up actions.
enumerate numbers an iterable, providing you a counter of sorts
The enumerate function and the Enum type are not related
for i, x in enumerate(['a', 'b', 'c']):
print(i, x)
0 a
1 b
2 c
ah okay
Like If you open a file normally i don't remember the syntax ahh
f.open()
f.write("Hello")
f.close()
If write throws an exception, the file will never be closed and cleanup won't happen correctly , context mangers ensure that the file will be closed.
.
Same with SMTP requests, database connections etc.
With python can I automate working with excel like same excel but different details ?
yes
But then I have to input all the details which is not pretty automated
I wanted to automate it it's pretty boring stuff doing same thing everyday atleast 3 or 4 time
what specifically are you trying to automate
def print_pattern2_diff():
n=int(input("Enter a number: "))
for i in range(1,n+1):
for j in range(1,n-i+1):
print(" ", end="")
for k in range(1,2*i):
print("*", end="")
print()
can anyone explain me the logic of this code. I just don't understand
Anyone got experience with papertrail logging and than with https?
do you know how for loops work?
yes I do, but I don't settle with the output
*
***
*****
*******
*********```
how can this be output????
!d str.center
str.center(width, fillchar=' ', /)```
Return centered in a string of length *width*. Padding is done using the specified *fillchar* (default is an ASCII space). The original string is returned if *width* is less than or equal to `len(s)`. For example...
find a piece of paper. write down what i will be if you use an input like 5
let me try
I mean string multiplication would be better for this but anyways ._.
how many times will the i loop run? what is the first i, what is the last i
count the number of spaces and asterisks on each line, with the line number
notice the mathematical pattern
this is way quicker method I found, which makes sense to me
def print_pattern2():
n=int(input("Enter a number:"))
for i in range(1,n+1):
print(" "*(n-i)+"*"*(2*i-1))```
Basically I work in bike showroom so as per bike sold I have to make excel of it with many details ofcourse like name address chasis model blah blah and it's pretty boring like atleast I have made those 3000 time or more and in season I do this thing morning to night so I was thinking if python could help in this but I'm not experienced in python to judge that if it could
so what you don't understand is the end= part?
it means that how will the statement ends, by default it is /n
what do you mean?
Yeah exactly that's what I was saying.
so what about the first one doesn't make sense?
I mean doing dict[1] to get the value at the first value.
isn't that like, what a dict is for?
let me try on page(paper)
I didn't come up with anything better so my game map is saved in a dict as x y coordinate tuples
I got it, thanks @pallid garden
I was not completing the initial nested loop in my mind ( am so dumb 😭 )
i did nothing lol
pov: you're a rubber ducky
haha yes
How do goy code in py vs non-goy?
<@&831776746206265384>
you have to use friendly language while you are here and stop whatever this is.
def print_pattern2():
l1=[]
l2=[]
n=int(input("Enter a number:"))
for i in range(1,n+1):
l1.append(" "*(n-i)+"*"*(2*i-1))
l2=l1[::-1]
for item in l2:
print(item)
Dude I am a genius. I think
Can please anyone answer me in yes and no?
this is a very common usecase for python
what is this obfuscatory looking piece of code doing?
Yeah ok but do I have to input all the details or is there anyway?
Enter a number:6
***********
*********
*******
*****
***
*
you have to input something yeah, but there are ways to get things done more efficiently
ah cool
@inland karma your profile picture is Scary
i dont mean to be scary
Hmm thanks
python is very good at automating boring stuff
there is also a very good beginner book to get you started. do you want me to share it?
That's why I choose it
!res
The Resources page on our website contains a list of hand-selected learning resources that we regularly recommend to both beginners and experts.
automate the boring stuff with python
Ofcourse
atp it wouldn't be a very bad idea to have a command for the book and cs50p
my code is compiling for like 5mins lol
Oh yeah I have it already but I want to learn python as fully not just for automating
great to hear!
def stars(n: int) -> None:
for i in range(n):
nstars = 2 * i + 1
print(("*" * nstars).center(2 * n - 1))
A simple way to learn python is watch some basic python, and start practicing more you practice more you learn!!
I don't understand this one
really? which part
the center function puts space around the string to place it at the center.
Is it worth it adding detailed comments even though it adds a bunch of lines to the code?
like it costs nothing right
Lines of code does not matter, correct.
'*****'.center(9) what does this do?
awesome :) thank you
wong ping
'*****'.center(9) what does this do
I am still new
Hii one quick ques!!
try to run it
Having a program crash because you forgot the parentheses for sys.exit() is kinda ironic.
And it's a mistake I've made more than once for various functions.
shouldn't crash though, should just do nothing
sys.exit would just be sittin' there
create this diagram with python?
how? slides like this!!
Are .GitHub.io links trustable?
same md file and how it's turn into slides!!
slides is cool!! i want to built my prsentations etc like this!!
thats just a github page
!pypi graphviz
I am proud to announce that I became an applicant for entering into master's science degree at Kyiv Polytechnic Institute in Computer Engineering for 2026 (Faculty of Software Systems and Applied Mathematics).
i am talking about this one!! the slides!!
it can still execute arbitrary js
As trustable as any random webpage is
its javascript
congratulations, I hope you are able to stay safe over there
but this is using something called mermaid @steep roost
ok cool!! understand!!
Thanks!! evil!!
the js framework is called reveal, and the graphs are made with mermaid
If you're just looking to create similar graphs manually, https://graphviz.org/ is also an option
ok okay thanks!! u guys r helpful and cool!!
Yo
!ban 1072804156257095691 "1 year" You've been given many chances to reflect on your behavior here and learn how to behave properly, and you're still being problematic. Take some time to mature before you get another chance to engage with this server.
:incoming_envelope: :ok_hand: applied ban to @reef lily until <t:1800113959:f> (1 year).
!pypi tikzpy
PyLaTeX + Manual TikZ
Noooo
MY friend hoodie is gone 😭
heh hoodie has multiple accounts... he'll be around
you can DM them.
!pypi tikz-python
I don't want to 
that kinda stuff is not something u wanna send on a public server </3
Lol
If anything you should be happy that he had SOOO many chances to correct his behavior, the server tries to be welcoming.
Why you gave only 2 repo
@inland karma what were you saying about tikz?
i linked the wrong repo
hidden the rest
i asked if there were any bindings cause someone else asked about the diagrams
though, i dont think there are python bindings outside sphinx, for reveal
Guys what are you makin these days
Can anyone recommend me good python book that cover atleast most of the python?
the one we talked about is a great place to start
there is also crash course and a byte of python
Finding good python book was more harder then finding a good book for assembly
...
did you read our resource page?
heat as it is cold with our building under low power short so cannot write code until the apartment place fixes the problem. Issue is the Arctic temps are making things worse and all our blankets are not enough.
Not enough power to run:
- any appliances including the stove top/oven.
- any space heater
- computer/TV
- any refrigerator/deep freezer

@steady rain How would you feel about pinning some day 1 starter projects if I formatted a list with instructions?
I FUCKING HATE LOKI SPAMMERS
please be kind when your talking here @steel whale
!kindling
The Kindling projects page contains a list of projects and ideas programmers can tackle to build their skills and knowledge.
we already have this
I know but I'm sure its pretty focus in just automating and not to teach python fully I also try crash course and have read pretty much of it but then I realised it skip lots of things it was pretty good book my favourite but
I'm talking about literal day one projects, I don't recall seeing rock paper scissors or high/low there but I'll double check
Not yet
you will learn all the important things if you use automate the boring stuff with python just remembner to read all the words and write all the code yourself
you should take a look, then you will not have a trouble finding good resources.
Hello.world
ya even project 1 in the big book of small projects would be difficult for someone who's just starting. anywho just thought I'd offer
I feel a byte of python is better than automate cuz its not beginner friendly
a byte of python is suited for those who know some programming
Hmm if you can say that I will then, automation is the things I'm most interested in so great but there is also other problems like I have no pc just phone so it's not fun but I try my best with python what I have
Ohh that was my first book and it worked out for me but the other one feels not quite of my liking
you said you used excel, that runs on a computer does it not? you ccould use that
Yeah lol I meant I doesn't have pc in home like personal stuff I have pc in my work place but I doesn't do much of personal stuff in there
could always go to a library
oh i see... it is not easy to use a phone to write code, i know people try, but its not really something i would recommend
if you're going to write code on your phone, at least use a bluetooth keyboard
it will still suck, though
Yeah it just doesn't give the feeling of compiling in it ofcourse but I already have try to write assembly in browser which is hell so it's better then that
Atleast I have app for it
hello :p
you dont have to think about the compile step with python, the interpreter does that when you run the code
all you need is a python interpreter, and you can run it on a phone
or use an online editor
or use an app with it build in
but i would just not recommend it, even though you can
colab might be easiest if you intend to work on something at home that you'll use in your workplace
there are tons of options but "google"
Yeah I do that I doesn't have choice here I was thinking if I could use the pc in my workplace but that has its own story
nice thing about my suggestion is you can access it from home, work or even a library! Consider it, none of us would be here if we were worried about nerd status.
im new to python , can someone tell me how i can learn it?
used to be a Scratch user , but i wanna learn something new this year !
!res might help you
The Resources page on our website contains a list of hand-selected learning resources that we regularly recommend to both beginners and experts.
ok thanks !
also, btw: Python is basically just Scratch but you express it as text
lol the top pinned message in this channel is just "be staff"
unemployment shaming is rude!
is pydroid a good app for python coding ?
im on android.
Try Termux
I should finally make 'blockly but it's x86 assembly'
phone keyboards are ass for programming bc they hide all the symbols behind a lot of menus btw, prolly will be painful 😭
im a fast typer .
dont worry
trust me.
🫡 u can use google colab or some online replit also tho if u have a computer u can go on a browser
u dont have to download anything
im computerless.
mb ya android should work then
at least its better than IOS 😭
I mean i lowkey still might recommend hitting up library if ur tryna do bigger project 😭
phone will work fine it will just be a lot easier to type and see lol
this server is making me smort.
i have a big brian now.
@idle nimbus
Yo
Wsp
🗿
Yo
termux still on 20% download 😭
my wifi is kinda speedless.
please internet, i need this.
Yo
Termux sucks
stop using discord 💀
And touch grass
whats the alternative
Get a pc
😭
it ain't portable bro
bro obv doesnt have a pc 😂
yeah otherwise they'd know
Then use Termux
What is LFX
Anyone did that
Laptop better
LFX is a suite of tools built by the Linux Foundation to facilitate every aspect of open source development. The toolkit operationalizes the organization’s proven methodology for transforming projects into category leaders, providing direct support to projects, and empowering open source developers to write better, more secure code and grow sustainable ecosystems.
too many buzz words 🤮
Is it like gsoc
Btw anyone preparing or got chance for gsoc?
idk what that is but it looks like azure devops or like github actions type workflow manager
with other stuff
No its kind of opensource promotion campaign
Where beginners get paid for open source
contributions
lfx is an umbrella org for fostering/growing new projects/ open source initiatives
i mean idk abt all that but their page says LFX is a suite of tools for project development
linux kernel, cncf, risc-v etc
🫡
Oh intersting
altho gsoc is a beginner friendly program u cant really contribute to big open source projects with little background or experience you do need some prerequisites
also its very competitive to get in
ya i never have heard of this 😂
also hyperledger too
yea i meant beginner in opensource
Not like programming
i tried last time and got ghosted
I think they expect contributions before gsoc starts
there are stipends based on project size
Yo
u submit a proposal to a problem statement
hello
But it's very competitive as said...
ya but it says u work with organizations who submit ?
idk pull requests ig
lmao the proposals have shot up since llms
bc theres like sign up for orgs and contributors right
Wsp
@thick crown come online 🙂
What 
Come dm
^ Joined today to tell people to touch grass, that termux sucks and to DM them. 
termux does suck
nah it saved me plenty
👀👀
Termux sucks
is that different from tmux? I love tmux.
yeah
Termux Is a app that runs terminal on mobile
You can use tmux too using muile
side note: I wish it was easy to turn old android phones into raspberry pis
Muxile*
anyone use / heard of jscpd
that would be something, kinda makes you wonder why it's not a thing now that you say it
vendor lock-down
Hello! does anyone know regex? :)
Can termux even little bit replaced terminal? I just try downloading pandas in it and it doesn't works
Tbh userland is better than termux
it's better to ask your question directly.
my old phones are unlocked google ones and I can re-flash them. I never botherd to do it, though.
Userland?
at least, i think i can. i remember doing it back in the day but I forget which device.
Here i really can't seem to figure out decorators
How to use them or how to make them?
Me too
Making one is pretty advanced material
making them seems simple it's just:
def decor(func)
... def wrapper()
...blahblah
... func()
return wrapper
ARM devices require custom descriptions of the onboard hardware for each device, and often rely on custom drivers that aren't in the mainline kernel
O wait, I was thinking context manager for some reason 😅
What is your question about decorators
ok so why r we returning wrapper
The wrapper is the function that the original function will be replaced by
I'm using regex to find whether a name has a prefix
import re
#any word with the prefix DEF or ORG, case insensitive
pattern = r'(?i)(DEF|ORG)(.+)'
names = ["DEF_test","org_test"]
match = re.fullmatch(pattern, names)
if match:
prefix = match.group(1)
if prefix == "DEF"
so at the very end i get a bit confused, because I'm trying to check if the prefix is either "DEF" or "def", but if i write
if prefix == "DEF"
it only gives me the names with "DEF" capitalized, I'm not sure how to "capture" the first alternative within the group, or how to call it
@decorator
def example():
print("test")
Is syntactic sugar for
def example():
print("test")
example = decorator(example)```
but then why do we need the wrapper function in the first place
To add functionality to the original function
Typically with a decorator you replace the original function because you need to
There are some cases where you don't, at which point you don't actually need the wrapper
yes but can we not just put the stuff in decorator instead of def a new function
If we do that it will run when we call the decorator, we don't want that
hello ppl
first, you can't call re.fullmatch on a list of strings.
setting that aside, maybe you want if prefix in ("DEF", "def")? alternatively, if prefix.lower() == "def", and so on
The decorator is a function that only runs when the function is being defined, not later when the function that you @'d is being run
wait does the @ make it run
Yes, see my comment here
Doing @decorator calls the decorator with the function as an argument
Hello friends
ok so first the decorator is called when you @ it
I see that most python books avoid writing about the match keyword.This is so strange.
it's a pretty new feature
It's called immediately after the def runs
!e ```py
def decorator(func):
print("Decorator called with", func)
def wrapper(*args):
print("Wrapper called with", args)
return func(*args)
return wrapper
@decorator
def example(name):
print("Hi my name is", name)
print(f"{example=}")
print("Starting program")
example("Bob")
:white_check_mark: Your 3.14 eval job has completed with return code 0.
001 | Decorator called with <function example at 0x7ff13b05efb0>
002 | example=<function decorator.<locals>.wrapper at 0x7ff13b05f060>
003 | Starting program
004 | Wrapper called with ('Bob',)
005 | Hi my name is Bob
ah okay
The decorator syntax is fairly identical to doing this instead:
def decorator(func):
print("Decorator called with", func)
def wrapper(*args):
print("Wrapper called with", args)
return func(*args)
return wrapper
def example(name):
print("Hi my name is", name)
example = decorator(example)
print(f"{example=}")
print("Starting program")
example("Bob")
was this for me?
nope
😭
wait so then i don't see when wrapper is called
so is there someone to help me?
or should I perhaps make every prefix into it's own pattern?
def_prefix = r'(?i)(DEF)'
if prefix == def_prefix
something along these lines
@bronze dragon I know that match was introduced in 3.10 version and according to this infographic, this is the oldest version that someone should use:
SO THEN WHEN YOU CALL EXAMPLE YOU'RE REALLY JUST CALLING WRAPPER
how many books did you look at?
The Resources page on our website contains a list of hand-selected learning resources that we regularly recommend to both beginners and experts.
@cerulean ravine Many
but not u right?
ask away
ig u wont help me @fossil steeple
um...
i js wanted sme courses to learn this language
and i provided u with res
Yes you got it 😄
Suggest me a book that includes match usage please!
fluent python
👍
it doesn't seem to.
you might need to work with other materials. Have you read !pep 636 ?
fluent python used match case
which edition do you have?
@cerulean ravine What do you mean?
nevermind, the last one worked!! Thank you :)
!pep 636
i looked in the 2nd edition and didn't see it. maybe i missed it.
my legal team has advised me not to answer this question
it might be that i don't have the latest.
@obsidian hollow did you check Fluent Python?
@cerulean ravine Yes I am now between Learning Python: Powerful Object-Oriented Programming (6th ed) and Fluent
Fluent Python has it.
Here lads is logging worth learning at about an intermediate level?
It's the next chapter in the video and it sounds boring
yes
@cerulean ravine So between the two books you are suggesting the second one?
Fluent Python is very good, but it's also big. I don't know where you are in your learning, or what you need to learn about match/case.
grand
You can skip boring stuff. You'll eventually learn what you need. Logging is a useful practice tho.
also, there are two parts to logging: writing log messages, which is very simple, and you will pick up in no time; and configuring logging, which no one understands.
Is there a laugh+cry+^ emoji?
😂
Hello, can some1 share thoughts on websites such as codewars and similar? are they worth for learning? If so which one is the best in yours opinion?
and then the fancy people want to aggregate and store and query and ... 😩
"distressed fumino" is a good template for this
I.... Am steve...
Can someone teach me in #1461777837030899884
Logging isn't about whether it's fun or boring, it's about how figuring out the cause of bugs can either be pretty quick and easy or a huge pain in the ass if you didn't add any logging.
do i need to understand
It's useful knowledge.
mentoring isn't a commitment most people will make, and even fewer for free. Your best bet is to start learning then ask specific questions, we also havehttps://discord.com/channels/267624335836053506/343944376055103488
configuring i mean he said no one understands
applications need pretty minimal setup to get pretty good gains, logging.basicConfig is nice
print("CHICKEN JOCKEY")
I have to think it's partly in jest. There are plenty who understand how to configure logging. It's not as common, by far, as people who understand how to write a log line.
I'm taking your python rights
You don't need to do a deep dive on that, no. You can just run with the default configuration and learn what you need as you need it.
does being in a python server mean saying C++ or Java is a crime?
🤨
Logging configuration can get pretty hairy for large and complex systems.
the questions are crazy
was python made by a guy who was bitten by a python?
yes
You can talk about other languages in the off topic channels
Absolutely. The larger, the more dense the configuration becomes. It's all the same pieces though. Handlers and their three rules: What do I log? Where do I log it? What does the log line look like?
tbh, as a beginner, I don't think you need to learn "logging" explicitly. Just use print statements to emit useful messages, and worry about how to make it better later.
my brain can barely understand python...
We all start somewhere
🤓 um actually i'm not a beginner i'm actuall 3hrs and 40 minutes throught a yt video titled "Intermediate python course" for your information 🤓
:p
contrary to popular belief, you are not born knowing how to code
honestly the only reason i wanna learn python is to make minecraft python edition 🥹✌️
pfft, you'd be a master by now if you'd watched it at 2x
I believe there is a tutorial for that using the Panda3D engine.
You should first gain some beginner knowledge though
im on mobile...
Hello world
Can someone teach me in #1461777837030899884
That's gonna be tough then :/
kinda makes you appreciate the days when computers were still big
its been an hour and termux is still at 90% download....
Yeah they really fell out of fashion now /j
we just need a programming language that's written purely by swiping left or right
tindary
it just iterates through all language features until it gets to the one you want
🤣
Singly-linked list implementation so you can't go backwards
Better not miss it!
hm? you could just not allow iterating backwards. linked lists suck
reminds me of this language that's based around linked lists
The point was disallow it naturally instead of explicitly
I could make some really slow algorithms by continually indexing the list
it doesn't even make sense though. you're talking about user interface and implementation at the same time. if there's no "go back button", how would the user go back? implementation isn't relevant here
ok I'll just go fuck myself
um, are we okay?

how was your day stel
it's still going, and it's great, but I want to make sure NoWayJay is alright.
what projects do employeers like looking for because i doubt theyll give a shit about a chess engine
they don't care about any of your projects as projects. They care about any of them as showing that you can build things and then talk about them later. A chess engine is great.
If you can talk about the challenges you faced and how those learning experiences apply to your abilities, it's a good project. How did overcoming the unexpected in a side-project prepare you to do the same for said employer?
So maybe a project that I can add features to but also show I know what Im on abt and how I could change stuff?
if you're doing a project, you already know these things. you just need to be prepared to talk about it
And in fact there's a reasonable chance that one of your interviewers is a chess nerd and wants to talk about what goes into building a chess engine, heh
I know someone who landed an internship in part because he listed skydiving in the hobbies section of his resume, and the interviewer wanted to bring him in at least in part to ask some questions about skydiving, haha
To this: D&D helped me land my internship. I got asked what databases I've worked with and I brought up a character database we keep for D&D. Three of the team members at the table immediately leaned forward and we talked about our favorite character classes for 10 minutes. The team lead was just sitting back going "okay, they can work with my team... that's sorted". 
guys what color is urbuggati?
Do you ever get to know who your interviewer is before the interview?
Me when I hack together a quick C program:
Maybe a name, usually just a title. If you ask.
invoking vacuous truth, my bugatti is red
Eh wrong quote, I meant that about inefficient algorithms
because ik someone who found who their interviewer was found their social media and just acted like they had the same hobbies as what the interviewer had posted
Social engineering. Good skill.
I should probably do the same
Woah
At the very least, read the sports headlines for the morning and have that small talk on your mind. Sports is another one of those high chances that someone at the table is interested.
I searched udemy too, for courses that teach match (v3.10 and above) and decided to buy the Complete 2026 Python Bootcamp: Learn Python from Scratch (Haris Ali Khan)
It's better to not put topics on table which u aren't familiar with a lie spotted is worse
by the way 80% of the udemy courses do not even mention match
However, that type of conversation requires the comfort and skill of controlling the conversation. Unless you have a deep knowledge, if you don't control the conversation you'll be caught out of water quickly.
i wouldnt be surprised footballs very popular in the uk
if you don't mind me asking, why are you focused on match/case?
I mean if i can find something they like they'll just end up talking loads because everyone likes yapping abt a specific topic they like
Retail taught me this. I can talk for quite a while on a topic I know nothing about. 
U seem offtopic
@cerulean ravine Because I am a software developer with more than 15 years of experience with different programming languages and I consider match very helpful for the experienced software developer.
where have you used it before? Have you read about the basics of match/case?
Never used match at work tbh 😛
Thanks for letting me know.
@cerulean ravine I use it all the time
cool, in what language?
Isn't match on docs too would be a rip off to learn it on a paid course
I have gotten some value out of my Udemy sub but for every great course I find there are 2-3 that are mid or even just plain bad
Hi
@cerulean ravine Java, C#, Javascript, Typescript
I think I've used match once since it was added in Python. Not often I need pattern matching over an if-statement.
those all have switch/case. match/case is different. You should take a look at pep 636
hiiii what vs should i use? (im a beginner)
vscode if you want to use python
what is "vs"?
VS as in Visual Studio or?
vs being visual studio I assume? or "version"?
Java and c# have real pattern matching these days. idk about typescript
interesting, can you give me a link?
I disagree at least from my experience so far with python's own implementation
@cerulean ravine Is this (still) a doc bug, or is it intentional since powersort is a derivative of it? "The Timsort algorithm used in Python does multiple sorts efficiently because it can take advantage of any ordering already present in a dataset." https://docs.python.org/3/howto/sorting.html. I think this came up before in this channel, but someone asked recently about it again.
it's interesting to be looking for a resource to learn about match/case and also have strong opinions about how it works.
on my phone.. try searching "java switch expression records". I think c# is just called pattern matching
i don't know much about the subtleties of sort algorithms. The /howto/ pages often lag.
@cerulean ravine I have watched another udemy course on it and I have already used it
great, maybe you don't need a book
@cerulean ravine Also "so far" is not a strong opinion
they really like this "enhanced" word
This is neat, I haven't had a chance to use it... relevant jep: https://openjdk.org/jeps/406
It's basically rust's match
damn
with sealed classes, you can even determine pattern exhaustion at compile time
cant you do that with normal type unions as well
This actually works, tysm!
Java doesn't have type unions
oh you were talking abt java lol
the examples look like they are checking the type of the value. Are there deeper patterns at work also?
!pep 636 I really recommend a quick read through this.
I think you can also destructure records
@cerulean ravine As chat gpt says this is an added feature that I have not learned so far, so I stay at the common with switch feature of value matching for the time being
i didn't see an example of that in the jep. Maybe I'm just not good at reading Java.
ok, take my word for it: there is much more to it than that.
"We expect that, in the future, general classes will be able to declare deconstruction patterns to specify how they can be matched against. Such deconstruction patterns can be used with a pattern switch to yield very succinct code."
double checking
Looks like destructuring is a future, at lesat from that JEP
it's in a different jep, 405
i think python probably has the best native pattern matching support out of all the imperative languages
which is an impressive feat
Yeah I see the other 5 extra things in the chat gpt comparison table
How come when I press End inside a code block in discord, it goes to the end of the current word instead of the line?
what does ctrl end do?
Same thing
Can anyone recommend a good YouTuber who teaches Python?
@cerulean ravine By the way I must state at this point that python is the most friendly language for the programmer that I have ever seen.Everything I learn feels so natural.
I think it's somewhat confusing when switching to Python because: we're (developers from other langs) are used to "case/switch" being used as an alternative for if/elif/else chains, and not very familiar or used to the idea of "structural pattern matching". I've very rarely used a python match, I think just because it's so different / not in my mental patterns.
(╯°□°)╯︵ ┻━┻
I already have a key to go to the (next) end of the current word. It's Alt+Right
but other languages have pattern matching 🤨
Now if only we had if let X(y) = z:
lads whywhen using decorators we define a func that returns wrapper? would we not just make the func wrapper instead
yeah i agree that if you dont model things mentally the way match wants you to, youre not going to find much use with it. I personally use it everywhere since I code in functional languages as well
Can anyone recommend a good YouTuber who teaches Python? plss
I guess maybe java 19, but that's brand new 🙂 and, not yet in C++ right?
it can also be a little confusing that this is a syntax error:
RED, BLUE = 1, 2
match color:
case RED: print("Red!")
case BLUE: print("Blue!")
of course, those are the only other languages
oh yeah ive run into that before lol
When I want to destructure an object, I do not want to do this. ```py
match x:
case Y(z): pass
case _: raise TypeError()
print(z)
I'd like to organize my code better and use match/case but that's like 14th item on my priority list
For sure, +sql ofc.
it's a bit annoying that constants cant be used in place of literals idk
php match statements are weird, idk why they are even called match
They are basically an if/elif chain that throws an error if there is no match
C# and rust have pattern matching as well.
it's a pretty big paradigm shift
Isn't that what python's match is, but without the error?
Scala has some lovely match statements (https://docs.scala-lang.org/tour/pattern-matching.html)
or do you have to repeat the condition for each case?
match/case doesn't use equality checking on the cases.
Java 19 was released in 2022...
and at the same time
class C: RED, BLUE = 1, 2
match color:
case C.RED: print("Red!")
case C.BLUE: print("Blue!")
match is made for enums
Pattern matching in Java was included as a preview feature in Java 17 apparently
By the way nested elif is not as ugly as in other programming languages because of the lack of the curly braces and the mandatory nature of the identation.Just my 2 cents
it's like
match(value) {
condition => result,
condition2 => result2,
}```
Where it evaluates the condition expression and if it's true returns the result expression
and deep datastructure patterns.
One thing people do is
match(true)
and then just do a bunch of conditional expressions
that is odd
🥴
I once had to debug code that relied on side effects in the condition expressions 😔
Do traditional switch blocks even support non-static cases?
in C?
Sure.
or tagged unions
values must even be convertible to integers in C
IIRC Not TypeAliases. (type X = int | str cannot be used in match/case, but X: TypeAlias = int | str can.)
Let me test this actually.
nah they work fine, i use them all the time
What's up?
Ah, you just can't call type aliases like type MyStr = str; MyStr()
and yes the labels also need to be integer constants
while looking into this i found a new horror
someone is suggesting to use an iife to get around the single return expression
(gotta do MyStr.__value__())
type NodeMsg = Advertisement | Stable | NetworkConverged
def serialize_node_msg(msg: NodeMsg) -> bytes:
s = stream.new()
match msg:
case Advertisement(id, sequence_number, links):
stream.write_uint32(s, 0)
stream.write_uint32(s, id)
stream.write_uint32(s, sequence_number)
stream.write_uint32(s, len(links))
for neighbor in links:
stream.write_uint32(s, neighbor.id)
stream.write_uint32(s, neighbor.distance)
case Stable():
stream.write_uint32(s, 1)
case NetworkConverged():
stream.write_uint32(s, 2)
return stream.to_bytes(s)
You'd be surprised by how much Java 8 is in the wild.
I wouldn't, because Java is instant legacy code.
Did Python ever consider an LTS cycle? Not sure I ever saw any discussion of it.
It's still the default download on java.com
Well, given that there's a lot of COBOL still around, not that surprised I suppose
so they haven't updated that, or the number of devices that run java
Java Version 8 Update 471
Release date: October 21, 2025
Filesize: 38.48 MB
It's still supported
anyone run a code duplication checker tool
that's basically Javas main appeal, very long support Windows and backwards compat
so if you're an enterprise, you can be fairly sure your code will still run with minimal faff for a decade
which is also great if you're maintaining a legacy system
ah, found a discussion: https://discuss.python.org/t/python-lts-and-maintenance-cycles/68277
TL;DR: Support for most releases should be shorter (18 - 36 months) with periodic LTS releases supported for 10 to 12 years. This will allow package and tooling maintainers to focus support on a few specific releases. It would also allow users who are unable to move to new versions frequently to use current packaging and tooling. The pace of d...
you can often upgrade the jvm to get improvements without having to touch code, and it's not a pita to get your dev environment up
are you looking for the support cycle, or the reason for the support cycle?
I was primarily curious a. if it was discussed, and b. the arguments against. Definitely understand it is a decision, just curious the history of it.
what do y'all use to listen to keyboard presses? is pynput well-established, or are other modules preferred? i just need something simple that can raise an exception when a key is pressed while other stuff is happening
ok so i get decorators but how tf does this work:
def repeat(numtime):
def decor_repeat(func):
def wrapper(*args):
for _ in range(numtime):
res = func(*args)
return res
return wrapper
return decor_repeat```
Sony WX1000-XM4's
Oh nice, never saw this before: https://hugovk.github.io/pypi-tools/charts.html#requests
as in how does it work now that there's two cos wouldn't it then turns the funciton into decor repeat
I prefer non-clicky keyboards myself... cherry reds.
This is a decorator that returns another decorator
yes, but then wouldn't the function then be said other decorator and not wrapper
and also how come we start by having numtimes as an arg and then it magically beocmes func
(for real though, thoughts on pynput vs keyboard vs other similar modules?)
You can call this decorator to return a new decorater
So repeat(3) will return a decorator that will repeat something 3 times
You can use it like
@repeat(3)
Hello can anyone give me voice access please.
Check out #voice-verification
wait so am i wrong to say that really its:
@main_decor
def decor_ repeat
So
@repeat(3)
def func(): ...
is doing
func = repeat(3)(func)```
You are not currently eligible to use voice inside Python Discord for the following reasons:
- You have not been active enough on the server yet.
wait why do we have tow brackets
We don't let people bypass the system
repeat(3) returns the decor_repeat, then the second () is called on the decor_repeat and returns the wrapper
oh
is it calling decor repeat with numtime
as in is it decorrepeat(func, numtime)
it calls it with the func
it remembers what the numtime is because of something called a closure
a function inside another function will remember the variables from the outside function
ah okay
all that's left now is multiple decorators on one func but i'll do that tomorows
thanks
What is difference between range function and enumerate funtion ?
Is this homework?
I have doubt . When to use
range returns integers in a given range with a given step size
enumerate iterates over an iterable and returns a tuple of index (can be offset) and element for each element
range() should be used when you need a sequence of numbers
enumerate() should be used when you need to count something
Usage: ```py
for i in range(0, 20, 2):
print(i) # prints 0-20 evens
for i, n in enumerate(range(0, 20, 2)):
print(i, n) # prints 0-20 evens, plus index starting at 0
(excluding 20)
enumerate is cleaner, leads to less mistakes, and doesnt' require you to know how many items are there beforehand
Understand thanks
!d range
class range(stop, /)``````py
class range(start, stop, step=1, /)```
The arguments to the range constructor must be integers (either built-in [`int`](https://docs.python.org/3/library/functions.html#int) or any object that implements the [`__index__()`](https://docs.python.org/3/reference/datamodel.html#object.__index__) special method). If the *step* argument is omitted, it defaults to `1`. If the *start* argument is omitted, it defaults to `0`. If *step* is zero, [`ValueError`](https://docs.python.org/3/library/exceptions.html#ValueError) is raised.
For a positive *step*, the contents of a range `r` are determined by the formula `r[i] = start + step*i` where `i >= 0` and `r[i] < stop`.
For a negative *step*, the contents of the range are still determined by the formula `r[i] = start + step*i`, but the constraints are `i >= 0` and `r[i] > stop`.
Ok
!d enumerate
enumerate(iterable, start=0)```
Return an enumerate object. *iterable* must be a sequence, an [iterator](https://docs.python.org/3/glossary.html#term-iterator), or some other object which supports iteration. The [`__next__()`](https://docs.python.org/3/library/stdtypes.html#iterator.__next__) method of the iterator returned by [`enumerate()`](https://docs.python.org/3/library/functions.html#enumerate) returns a tuple containing a count (from *start* which defaults to 0) and the values obtained from iterating over *iterable*...
hello guys i don t know where i will start learn can u help me
- Automate the Boring Stuff is a really good book for complete beginners and it's free to read online.
- If you prefer to watch video tutorials Corey Schafer's playlist is also really good.
- I also recommend Harvard’s free online course CS50P: Introduction to Programming with Python.
- Python Programming MOOC 2025 is an alternative online course with lots of integrated practice problems you can do directly in the browser.
I wonder if adding step to enumerate would be accepted...
honestly the doc blurb the bot gives for range and enumerate aren't that helpful in understanding what they are. Click into the docs page to learn more.
The "Equivalent to:" section in enumerate may help understand what's happening
thanx me very much
Hi!
hey
!ytdl
Per Python Discord's Rule 5, we are unable to assist with questions related to youtube-dl, pytube, or other YouTube video downloaders, as their usage violates YouTube's Terms of Service.
For reference, this usage is covered by the following clauses in YouTube's TOS, as of 2021-03-17:
The following restrictions apply to your use of the Service. You are not allowed to:
1. access, reproduce, download, distribute, transmit, broadcast, display, sell, license, alter, modify or otherwise use any part of the Service or any Content except: (a) as specifically permitted by the Service; (b) with prior written permission from YouTube and, if applicable, the respective rights holders; or (c) as permitted by applicable law;
3. access the Service using any automated means (such as robots, botnets or scrapers) except: (a) in the case of public search engines, in accordance with YouTube’s robots.txt file; (b) with YouTube’s prior written permission; or (c) as permitted by applicable law;
9. use the Service to view or listen to Content other than for personal, non-commercial use (for example, you may not publicly screen videos or stream music from the Service)
Doh
Is it in python ?
⟦AES⟧ 5x> Δrƚħυя mØЯgΔη > 3x> yØʊ’Яε gØØd mΔn > 1x> ⧫
Is that your AES encryption key?
!d for
is it worth type hinting -> None if your type checker knows this anyways
That's up to you. I would say it is, for readability and the chance that the next dev doesn't have your type checker.
It's up to you, just note that mypy will ignore function bodies that have no annotations. So def _() -> None would be required if there are no args.
I will say that providing return type helps the type checker. Without it, it has to do more work and read the body to determine the return type.
Sometimes it's trivial, but with more complex functions with complex types...
doing -> None feels like a chore, but it does make things more explicit and clear
mypy treats lack of return type annotation as -> Any, not -> None. So if you want mypy to work, that's not an option
It prevents you from accidentally transmuting it from -> None as well
yeah do it
-> None "this doesn't return anything, and shouldnt"
transmuting?
Adding a return accidentally
You mean, if you intend to return None but are actually returning something now?
yeah, that's also a good reason
unless you have some tooling that warns you when you omit an annotation on a function that doesn't return None (you'd have to write such a tool yourself)
right, the type checker would infer the return from the body
(if the type checker is not mypy)
Function signatures are contracts: I take this, I give you this
Write them as needed, basically
it gets really annoying sometimes