You will be muted until you read the rules. Read them! @Rules_for_Python A group about the Python programming language. Offtopic things go here: @pythonofftopic Resources to learn python: @pythonres Group for Hy: @hylang Selenium: @SeleniumPython
the last line:
// res should be Config but not pycharm dont recognize
I have an issue with my code, from this
def create_functions():
functions = []
for i in range(3):
def f():
return i
functions.append(f)
return functions
f1, f2, f3 = create_functions()
print(f1(), f2(), f3()) # I Expected: 0 1 2, Actual: 3 3 3
Why does i=iwork? (Default args are evaluated at function creation.)
How does thiss relate to lambda in loops? Same issue
Have you done some searches on google regarding that? It is a basic conceot and should be there tons of articles and materials to learn
Читать полностью…hi, i have a problem with typing, could someone help me to solve this problem:
https://www.codebin.cc/code/cmd6bm9re0001i3032e4actvx:4biBzeifDz3CZHnBfK8isz5GQDwJRQT5LSACdBwUj3j8
repo: https://github.com/andrew-ld/LL-mtproto
Anyone give me the solution for template doesn't exist error in django
Читать полностью…So you didn't look at it. The official tutorial is very easy to follow, give it a chance
Читать полностью…The official documentation has the best tutorial you can use to start
Читать полностью…Please provide a full explanation including all the details that you consider relevant. Your statement is too broad and there is no clear way to answer you, you have to explain:
- what you're doing
- what you're expecting
- what you're using
- where you're running the script
- what Python version you're using
- what packages and their versions you're using
- and the most important thing: show the code YOU wrote (read rule 5️⃣ for that)
and more details, that way your chances to get help will increase.
Hey , I have modified a function but it’s working for the future inputs but not working for the existing ones which one is in my db
Читать полностью…If you define your base class as a protocol, then every class that implements that protocol should include all the functions (methods) defined at protocol
In this usecase, ABS is maybe a better choice as it gives you apstract methods that need to be defined by user supplied class, and a "general" - all instances methods (like run
or get_name
)
In your usecase, inheritance is better choice (i think)
Yea yea, surprised something this nit picky was thought of lol
Читать полностью…As @razorblade23 pointed thats a good solution but, also consider to sue a protocol instead of a base class to do duck typing
Читать полностью…can someone tell me where can I find data engineering project like real-time kind of ETL process to add on resume for free with datasets and all?
to do and learn and not just for show. would have tried myself but actively looking for job so
you said "could someone help me" - what help exactly do you need ?
Читать полностью…Guys
What extension do yall use
I want it to be interactive so it supports input()
That's what I was thinking but it's cool to know what's possible. Ty you and Charly for the help
Читать полностью…I find that a little challenging to understand.
Generally all documentations.
That's normal to import something "just for types" and it's usually no need for tricks with if TYPE_CHECKING
. It's meant for solving real problems, not creating noise.
I somewhat understand this. Seems crazy though you can pick and choose like that but i guess it makes no difference at runtime
So my base consumer has an abstract method process
the user needs to implement so they send the data wherever they want and 2 other normal methods run
and get_name
If i make it so the protocol is defined by those methods and attributes, or i guess even just process
and run
since that's what i expect in my code to be implemented, the user can build whatever class they want
You mean something like this?
from typing import TYPE_CHECKINGЧитать полностью…
if TYPE_CHECKING:
from package.things import Thing
def func(it: "Thing") -> None:
...
Well I'm only importing it for the type hinting. I don't actually use it in the code at allasync def run_pipeline(self, consumers:List[BaseConsumer]):
Just seems like a weird design choice since you can't really depend on imports to actually be used in the module then. Something could be imported just for types