#python-discussion
1 messages Β· Page 381 of 1
Thx for telling will look that later but gonna stick on this one for now
What should i make in python?
!kin
The Kindling projects page contains a list of projects and ideas programmers can tackle to build their skills and knowledge.
Why cant i click the link?!
guys i finally fixed a feature after 10 hours of working π
On your game editor?
yes. it was totally unoptimized for exporting
Thank you!
3 hours yesterday and 7 hours today
im gonna open source it tmrw or day after tmrw.
its usable now 
(you have to click the blue "Kindling projects page" text, not the "Kindling Projects" heading, I guess is what went wrong)
i have worked like 50 hours+ on the game editor now π
Why was blue color picked from the rest of the colors for hyperlinks on internet.
Its attractive or smth
idk rlly maybe cuz they just seemed proper
Is there a way that i can hide all of the outputs in a python program?
Like is there a function where I can hide all previous outputs and start from a clean shell?
reimplement CLI utils like :
head, tail, nl, rev
grep, cut, tr, sort, uniq
paste, wc
cat, seq, tac
What do those mean?
certainly not make a compiled language
why?
its horrible
Linux
how is python horrible for implementing a compiler?
how is the python language itself at fault for this? what problems did it give you?
depends on how you're running your code. if you're just in a terminal, you can use a command like clear (may vary by OS) to clear everything
just implemeneting compiler is horrible no matter language honestly python is the best way
honestly just a few memory managment before full compilation
its not horrible, just hard
nothing serious but it was still better
but at least it was worth it, a dynamiclly typed compiled language
did you do nan tagging for primitives
honestly i was just doing stuff it doesn't even have a tokenizer

its justa homebrew of stuff
how do you handle nested constructs?
like?
like for example modules
so u do import stuff
stuff.function()
i just do stuff__function()
I think contextlib had something to control stdout/in/error
!d contextlib.redirect_stdout
contextlib.redirect_stdout(new_target)```
Context manager for temporarily redirecting [`sys.stdout`](https://docs.python.org/3/library/sys.html#sys.stdout) to another file or file-like object.
This tool adds flexibility to existing functions or classes whose output is hardwired to stdout.
For example, the output of [`help()`](https://docs.python.org/3/library/functions.html#help) normally is sent to *sys.stdout*. You can capture that output in a string by redirecting the output to an [`io.StringIO`](https://docs.python.org/3/library/io.html#io.StringIO) object. The replacement stream is returned from the [`__enter__()`](https://docs.python.org/3/reference/datamodel.html#object.__enter__) method and so is available as the target of the [`with`](https://docs.python.org/3/reference/compound_stmts.html#with) statement...
Not sure if that's the appropriate thing
For your case, but worth checking stuff here and there
is this to me?
cuz i don't want to like ignore someone
lmao i had the same thought
like i understood what thing they are talking about but i dont understand to who they are saying it
hi guys
prolly to me or just forgot to add reply
hi
the file-like object to which sys.stdout will be set to
Oh
kinda
usually yeah
but it can also be say, a StringIO - just needs to support read and write methods
Im running idle 3.11 on my chromebook through the crostini enviornment. Does this work on my system?
Chromebook π
btw my language is called boblang cuz why not totally not stolen from golang its syntax looks like this idk if its good or not https://paste.pythondiscord.com/W57Q
IDLE? then you'll need to see if there's an option to clear the output somewhere... probably there is but I don't use IDLE
:0
its like python at home but at least compiled
how is the memory management done? seems to be automatic but im not sure what the semantics are
Can you make fun instead of func π₯Ί
it looks like if nim and go had a child (it looks good)
is that a kotlin reference
yea but why ?
Please
no its an SML reference
Because why not
all programs should be written in Standard ML
i just have a weird amalgamation vars objects and funcitons are on heap but literals and such stuff is semi manually freed by compiler
that's no fun! (ba dum tss)
Guys
Why not from __future__ import func_as_def ?
We have one for != To <> then why not for just a keyword?
yeah but like are you reference counting are you garbage collecting are you doing ownership semantics with scope drops
Idk ask to Guido
gc
Why go directly to guido lmao
what gc? boehm?
Or fun_as_def for fun
Maybe he knows how
yea more exactly i was too lazy to do it myself so just a sneeky #include <gc.h>
I don't think so
maybe i should allow you to switch keywords
Yeah!
how useful do you (the reader of this message) think this comment is?
# level 2
Level(
width = 32,
height = 16,
name = "Your First Threat",
window_sprite = '#',
blocks = [],
enemies = [Enemy(Vector2(16, 13), '?')],
coins = [],
player = level_player,
time_left = 300,
end_pos = Vector2(16, 14)
)]
Does the python docs explain how import works?
what's the context?
it's in a list?
There was a pep i think which talked about a proper mechanism for import system IIRC
yeah
I mean you could add a level_id as the number of the level
I think I would prefer to have that a dict, with the keys being the level number
k
well now i need to get to implementing standard libraries among which will be a fast version of pygame
how are you going to make SDL faster?
i just won't use it, after all opengl exists and i always wanted to learn it
Why does __import__() even exist? And when is it appropriate and recommended to use it?
Is it python 2 leftover?
Like whats make import better than define in C/C++ and how it works
levels: dict[int, Level] = {
1: Level(width = 32, height = 16, name = "Humble Beginnings", window_sprite = '#', blocks = [Blocks(Vector2(5, 5), Vector2(2, 2), '#')], enemies = [], coins = [Coins(Vector2(10, 12), Vector2(4, 3), '$')], player = level_player, time_left = 300, end_pos = Vector2(31, 15)),
2: Level(
width = 32,
height = 16,
name = "Your First Threat",
window_sprite = '#',
blocks = [],
enemies = [Enemy(Vector2(16, 13), '?')],
coins = [],
player = level_player,
time_left = 300,
end_pos = Vector2(16, 14)
)}
current_level_number: int = 1
current_level: Level = levels[current_level_number]
Doesn't define not about importing code from other files?
you mean compared to #include?
like this?
yeah
it's useful when you need to import something named in a variable
(dynamic imports - say, a plugin system. though then importlib will usually be the proper choice, not dunder import)
Yeah that's what i thought
thought*
please use a formatter lmao
yea, i'm going to have everything on separate lines so it's easier to read
I can understand that, although i see importlib preferred, isn't it? what exact appropriate usage would be to use this over importlib?

yes, kwargs must be with no spaces around = unless there is a typehint
btw how much faster than python should my language be
hmm, that I don't know
this is for you to decide.
this isnt really a sensible question
it will depend on the specific programs
okay three times it is
i wonder, time to google to check what other says
oh wait
Doesn't this server have a channel for this type of question
Yea
include probably pulls and paste the code in that place ig xD
Love how C++ took +30 years to make an import system thats not even implemented in all compilers (I think)
well they are atleast somewhat implemented in gcc clang and msvc
just not fully
I heard that only gcc has implemented it fully
Ohh shi i accidentally left this server as i was cleaning all inactive servers from my server list
π
Most easiest way to remember
what makes it better? namespaces => no name collision
how it works? modules are objects with their global variables being the attributes
Fr fr , tyvm
import minecraft
Minecraft.Minecraft
Look guys, I made Minecraft
Like needing to use header guards/pragma once so that you dont get errors bc the compiler just ctrl c ctrl v all the code in the preprocessing step
an iq too high
Of course
hi robin automatic reference counting
Your pfp is too cute
dont
Where is it from
What?
class Copier(type):
def __getattribute__(cls, name):
print(name)
return super().__getattribute__(name)
class Weapons(metaclass=Copier):
EXCALIBUR = Weapon("Excalibur", "A mighty sword that deals 25 damage.",damage=25)
hey lads what am i doing wrong here
oh wait nothing i didn't have my test right lol
theres too much metaprogramming going on here lol
you def dont need to subclass type
i need to be able to intercept classvars
how come?
bc i need to give copies of the classvars cos i'm gonna start adding like durability to weapons
Hi
why not just make durability a field on the weapon class?
class Weapon:
durability: float
for what
i love how inefficient my compiler is and stil outperforms python
ig they meant permission for images
Now try it out against PythonJIT
how are you benchmarking it?
k
compiler for what lang
literally a single inefficient algorithm that just in method of O(n**2) searches for primes ina given range
my language
huh
you mean the cpython jit? or pypy?
oh alr alr
Try to implement Sieve of Erastosthenes
yeah but the weapons store types of weapons and we don't wanna have all the swords going down when one does
Whatever the one that works
yea i can do that but then i have to get a lot bigger numbers to get the two languages to compare
and you do it once or do you timeit? How do you timeit in your language?
consider distinguishing a Weapon from a WeaponType
that doesnt make sense
so like have weapon type have a tuple instead of the actual weapon
each weapon has its own durability
well my language is just python with easier c importing support so i just written ismple get time funciton in c and it looks like this https://paste.pythondiscord.com/VDYQ
1 million
Its really not as bad as people say it is
Then what do you use?
i might do this but i'm tryna cut down on the amount of idea i'm getting from other ppl cos i wanna make the mistakes and fix it myself
Bruh no spaces around operator and operands!
i sometimes do it i sometimes don't
hi guys
why isn't each sword a separate object, with its own attributes?
Is there a way to make python type things with out pyautogui (I am learning python atm)
Keyboard
I just started learning python 2-3 days ago.
def is_os_good(os):
if os.can_delete_system_files:
return True
else:
return False
!pypi keyboard
Ema write a PEP for your language then
you could try using pydearimgui
Ain't no way i letting inconsistency appear
a seperate class?
there's gonna be more objects in there in a sec
Ty
pyautogui is not for making gui, its for automating interaction with guis - moving the mouse, pressing keys
well my language is free i tolerate any amount of whitespaces
god i forgor
Yeah don't be Python, just ignore whitespace
That's not the issue, it's the aesthetics/appearance
sorry no i am just stupid and gave wrong answear
Hi Ned
(they asked how to do it with pyautogui)
yes ik
Especially consistency
Oh
i don't understand. In your game, there will be multiple swords, right? Each with its own durability?
Is there a way to make python type things with out pyautogui (I am learning python atm)
You guys have any idea how do i add empty lists outside of my loop. Because it keeps giving me a NoneType error when the variable strikes in the loop.
with out
or i am just dumb.
we need to see your code
you are probably over looking something
do i copy all of it or....
happens all the time
ah, you are right, didnt notice the out because of the space
wait
.append([])
!code
why not pyautogui?
Unexpected indentation smh
Slow
Would be more appropriate if you give us the exact code even if long so we can give appropriate and accurate help
well now i need to go faster than python jit cuz now my performance looks abysmal
how is pyautogui slow? just set the appropriate interval and zero the global pause (not sure why it exists but yeah)
thanks
Because of python
Idk just heard that it is and im lazy to do it
!pastebin
So that everyone can easily read your code, you can paste it in this website:
https://paste.pythondiscord.com/
After pasting your code, save it by clicking the Paste! button in the bottom left, or by pressing CTRL + S. After doing that, you will be navigated to the new paste's page. Copy the URL and post it here so others can see it.
I use a terminal text editor called Helix, and run my code from a terminal itself using. But you don't have to use these if IDLE works for you.
(eventually you would want to move on to something more featureful like VS Code, but idk how well that works on a Chromebook)
Click save, then share the link
Beat it with your human speed or it's fast /j
What kind of speed you're looking for
hold up i am new to this thing wait
π blazingly fast π
https://paste.pythondiscord.com/UL6PH57IKYMR2FMHXFY24Q6YH4 does this work
i am using var_list so it prints out all the created titles when the loop expires.
str(input(
[Insert higuruma gif]
Itβs blocked on my school computers
Quantum level
Lmao
is it specifically pyautogui thats blocked, or pypi in general?
line 37 adds None to var_list, because print() returns None. What did you want to add to the list?
Whenever I tried to pip install it on py.exe itβs says invalid syntax
whatever printed out after after I used out1 and out2 in the loop.
Maybe instead of print() you want var = f"Here's your new game title: {out1} {out2}"
wait trying it right now
you arent supposed to write pip install in a python REPL
you run it from a normal command line
The keyboard module exists
Doesnt line 13 and 14 give a number that gives indexerror?
Iβm a beginner at python idk how to install it
Wdym
open a terminal (not python, just a terminal) and do pip install package where package is the package name
You install it just like you'd install pyautogui
Oh Ty
@cerulean ravine Thank you sir, for your help. It's a little janky but I'll work it out. [sleep hormones are kicking in]
programming just clicked today, i was making project without ai and i am doing it good and i think i am gonna go pro in future
Got the idea from a youtube short for some reason.
Idk whats worse:
str(input( or input(print(
You might be
input(print( is worse because its wrong, not just redundant
i am still thinking what purpose could print server in their tbh.
input(ehehe)
is way worse
yeah π
I need to debug my optical nervous system after this
no, because of the -1 on the next lines, but it'd be better to use randrange, good catch
Anything with input around it
@potent sun Btw you DONT need to do str(input( because input() ALWAYS returns a string
I wonder what was behaviour difference between raw input and input in python 2, did it implicitly convert by guessing?
Gotta check out old docs
yes
How much did it guess and how did it even guess at all? Did it have any loopholes
I know yes.
it did eval
Probably due to practice of int(input()) and similar is why you did that, right?
I just learnt this an hour before about my weird redundant script
I see
π
while i was busy fixing my function problems
its not that bad unless you have a redirected stdin
you're just evaluating the python code that you wrote, its as bad as a python REPL
after which i had the weird idea of using the list i started to make.
sys.input() is faster than input() right?
no
and now I can't process anything.
first, sys.input doesn't exist.
second, they would both wait for the user to type something, so Β―_(γ)_/Β―
this looks like something out of java
sys.stdin.read()
though that will wait until eof not newline
so sys.stdin.readline()
and .rstrip('\n') then
horrible
thinking in real time
Thank the holy coding gods for blessing us with Python. I gave up on Java when I saw the amount of script for just printing,
Wait sys has input()?
and print(prompt, end='', flush=True) beforehand
java is still important nonetheless
Mb it was sys.stdin
or, I suppose sys.stdout.write, if we're going that way
sys.stdout.write(str(prompt))
sys.stdout.flush()
sys.stdin.readline().rstrip("\n")
amazing code right here
@bronze dragon can I dm you pal?
I see but i consider it bad, feeling lucky to be born in python 3 era
sorry, but no, please ask questions in public
(off-topic, might get muted idk)
you can ask in the offtopic channels I guess
That God is Guido van Rossum and other devs who helped improve the language a lot.
Java makes sense when you get namespace and OO mentality/POV, it gets easier once you're familiar with such stuff
Yes.
I myself find it hard due to natural human thinking of BIG == HARD
But later when i learnt basics of programming and OOP, it made sense and not so long/hard, although it is verbose but it makes sense in its own way
lua
How long would it take for the java community to migrate? Since it says 25 which i assume is 2025
Java makes OOP easier to understand idk why
i really like OOP
i like x.f() because of autocompletion, but thats not necessarily OOP, UFCS and dispatch can do that
Also because of statically typed programming
You can achieve this in C iirc
It makes sense after a long journey
i mean you can have a struct with a function pointer
but x wont implicitly be passed to it
and making a function pointer for each struct value is pretty crazy
Bjarne is crazy tho
Thats why C++ exist
Is that a HolyC reference?
Does the vatican uses Holy C?
probably
Holy Binary
Real
typing with 0s and 1s must have been insane though.
I did play around with TempleOS recently, coercing gcc into generating binaries which can run on TempleOS. In my head I called that endeavor "Unholy C"
no Oop, no traits, no abstract concepts, just speak the language electronically
Hmm yeah.
Software Engineer beck then
no compiler
Punch cards βπ
yeah
eh it shouldnt be hard to transpile the CPython codebase to HolyC
i dont think it uses gcc/clang specific extensions
using stdout is actually faster than printing
type Class = type[object] # or simply type
type Instance = object
Which one to pick? And is it accurate to what typename is?
is it?
you made the claim, you should show us your test
i swear we went through this before lol
lemme make one
im not sure what is the point of the Instance alias
since all types inherit from object type[object] is "any type", not sure whether class is accurate since there are types which are not made with the class keyword
Claims without evidence can be dismissed without evidence xD
Is it correct tho? Like i want to differentiate between instances of a type/class vs a type/class
Guess i should differentiate between type and class too
int : Class and 42 : Instance
though int : Instance is also not wrong, really - everything is an Instance
but 42 : Class would error which is what you want i guess
How do i? Or is it generally enough
in the typesystem - you cant
What about sys.stdin.readline?
Isn't int a type than Instance? How is it substitutable with object?
types are also objects - they have a __repr__ and stuff
all values are objects
Evrything is an object ahhh
correct
well weapons to be exact
Python is Java but with functions
Huh
wouldn't a simple instance attribute be enough? I don't understand what your metaclass is for.
Everything is OO-able
the metaclass is there to intercept the classvars from my class filled with all the different types of weapons
the metaclass is gonna do smth with them in a second
i consider using a metaclass for anything concrete an overcomplication
this sound intricate. I'm not sure you need it, but i don't know your whole plan.
Somethingd arent
something daemon
somethingd
Rip
well see there doesn't seem to be a way for intercepting classvars without metaclasses
Pattern recognization π₯
idk what you mean by "intercepting classvars", or even exactly what you mean by classvar.
.endswith("d")
__init_subclass__?
Difflib had a stroke lmao
!d classvar
No documentation found for the requested symbol.
ok its time to binge watch some more romance anime
.endswith("d")
do you mean an attribute on the class instead of on the instance?
exactly
ok, and why are you intercepting them?
Because why not? XD
I want some programming anime
i need to make deepcopies of the classvars
anyway i have it done now
wait i actually don't seem to need deepcopies they seem to be made by default
interesting
Guys Iβm 14 completed some python courses and im very familiar with the basics and donβt know what to do next i ultimately wanna go into AI and machine learning and have some spare money with which i could buy some books on python but i wanna know what i should focus on now and some book recommendations ig, Have also worked with oop and basic async

oh welp that was a waste of time
i'd like to know more about what you are doing, because i don't think you need a metaclass, but also deepcopies are not done for you by default.
yeah'll explain the whole thing in a second
a pastebin of the code will help
(you should grab a help channel and explain there)
ya youre definitely shooting yourself in the foot by trying to over-engineer the design
x = Weapons.EXCALIBUR
x = 2
print(x,Weapons.EXCALIBUR)
this gives
2 Weapon(name='Excalibur', effect='A mighty sword that deals 25 damage.', damage=25)
therefore deepcopies are made by default
grand
no, there's no copy. x=2 doesn't change Weapons.EXCALIBUR
like fundamentally Weapons should be a dictionary or list or something, it being a class makes 0 sense
classes often make sense. You're being very definite when we don't have all the information
yeah but i've put x as excalibur i thought that meant it just had a reference
i'll get the help channel up now
x had a reference to excalibur. then x = 2 changed it to refer to 2.
Guys Iβm 14 completed some python courses and im very familiar with the basics and donβt know what to do next i ultimately wanna go into AI and machine learning and have some spare money with which i could buy some books on python but i wanna know what i should focus on now and some book recommendations ig, Have also worked with oop and basic async
fair enough, from what ive seen it just looks like weapons is a store for all different weapon defintions in the game
Your "therefore" is wrong here. Line 2 overwrites the reference stored in x
The name Weapon would be better for a class
here's a video that explains a lot of this: https://nedbatchelder.com/text/names1
oh wait but methods won't so i do need a deepcopy
who is the young chap in the video
classes can easily be used simply as data containers (think struct in C), just like a dictionary and you get dot attribute access
there's nothing fundamentally wrong about it, it's in that sense exactly the same as using a dictionary (a list would be a bit dubious for something that benefits from named properties though and semantically incorrect, a tuple maybe, but again, lack of named attributes)
god damnit, you said Weapons... well, still, a class (such as an enum) might make sense for this, it'd be similar to having a dictionary of enum: object pairs
Btw you are only changing x not Weapons.EXCALIBUR
yeah i would personally go
WeaponDef for storing static data about a weapon
weaponDefs: dict[str, WeaponDef] for storing the map of weapon def ids to their respesctive definition
Weapon for the actual game runtime object that does stuff
WeaponManager for the object attached to the player that manages all of the player's weapons
source: the naming convention i used for the game i worked on the past 2 years
Enum would be better
enum is fine, but it might not be super useful since i feel like it would be rare to access a specific weapon by its static id
π
weapon_defs
like if you have 200 weapons the player can pick up, the logic is probably going to be like player.primary_weapon = picked_up_weapon referencing a variable not a specific id
ya mb, context switching from typescript brain
Hello nedbat
I see that you are a helper, May I know if you have knowledge in data science field?
why even bother with this meta question instead of just asking what you want to know?
you can run JS/TS in the brain now? this is the dystopian future they warned us about
at least you can't segfault your brain with js
coming soon...
you can probably confuse it pretty badly though
lobotomize.js
don't need a library/module for that, the spec itself is enough
just be a bit patient
I have no issue waiting if I can expect a reply.
Anyone here use gemini code assist?
haven't had great experiences with it. for casual coding queries I find windows copilot > gemini > chatgpt I haven't tried "codex" yet.
no
i want to use codex but usage limit low
I didn't even know they had a limit, but I'll to give it a try later and see.
ya only issue i have with gemini is its tool access
seeing if anyone has found a way to give it web search
claude has been pretty good to me for learning recently
since when it explains, it tends to use much more up to date info than chatgpt
like chatgpt still recommends to use SERIAL in postgres even though it was deprecated 9 years ago lol
It was?
soft deprecated i suppose
What's the replacement?
21 years of data vs 9 years of data
id INTEGER GENERATED ALWAYS AS IDENTITY
well it's the modern replacement, there were a few issues with serial that it tried to address
Yeah stuff like that happens all the time. I asked ai how to get rabbitmq installed via helm and it lead me down a LONG rabbit hole (NPI) before finally after much debugging announcing that it can no longer be done after I started checking rabbitmq's documentation myself. This is a typical expereince, sometimes AI cuts through the noise and is a big win, sometimes it gets lost in legacy forests and just delays you.
i dont think it has to be a primary key
can just be used wherever
I use manual pages
yeah ive slowly gotten better at identifying when it doesn't really know whats going on so i can cut it off early instead of wasting time
?
But it says identity
Is it stealing other tables identities?
how does that relate to what i said π
idk what you mean
What good is an identity thatβs not an identity
well im pretty sure 95% of the time you would use it for a pk
but it's not required
βIdentityβ !~= βserialβ
Not even a little bit
Okay maybe a little bit
But serial columns are not inherently always identity
hello guys
hey people there is a chineese woman here that give a script to use it
then when I installed the script it have trojan horse
told here when I met you I will knock you out cold
my fave haiku this year
peak embed
Is someone in here good with cryptography?
huh?
so that people can have discussions instead
np, it's unusual in a discord server
it's unusual even within this server, this is the only channel with that restriction
Iβve seen quite a few servers which do the same, especially in general-type channels
guys, for loops in c make more sense than in python
how come?
c for loops are just while loops where the end of the loop goes at the loop header
python for loops are "foreach" loops - do something for each element of an iterable
ppl will abuse it
Maybe because of abstraction
you dont iterate thro a list, you loop a number of times under a certain condition, straightforward
exactly
yeah
Is yfinance a yahoo api or a scraper?
Ngl I prefer writting python for loops
scrapes it I believe
Imagine if C had for (int i = 0..10)
yahoo
If I use it in some code can i share the code?
get it
Like I cant use it for commercial use
I know that C++ has that
But in a github repo for example
the c solution makes more sense to me, personal preference at the end of the day
Im pretty sure you can
Ok so next time you say "i think ..."
alr
it literally says it uses an API
im not sure how
for (size_t idx = 0; idx < array.size; idx++) {
process(array[idx]);
}
makes so much more sense than
for element in array:
process(element)
There is no yahoo finance api anymore i dont think
for (auto element : array)
{
process(element)
}
Okay I just checked better and it mostly uses an API but actually does scrape some things
I think the API is internal though?
So like not meant to be used like this
Its undocumented API... So I guess a bit of scraping is involved
Yahoo shut down their finance api like 10 years ago
It's a combination of web scraping + a publically available though seemingly undocumented API. The free Yahoo API was deprecated in 2017 and shut down in 2019 or so.
why'd they not keep it alive forever, smh
Yahoo wasnt doing so well
did it get sick?
Why does Yahoo still exist? How does Yahoo still exist?
can anyone help me?
Depends, what do you need help with?
Japan still uses Yahoo quite a lot.
no absolutley no one knows python here
you are from India right
No?
https://discord.com/channels/267624335836053506/1485026760155463780 trying to create another macro it keeps breaking when i copy and paste
ok my bad
why?
Theyre still in the 90s technologically
are they safe from AI slop??
hmm, I was under the impression they were rather advanced, like Korea
cries in hayao miyazaki
(I hope not because of some subconscious idea of "all asians look the same" π
)
Im sure they have some cool gadgets of their own
It's basically a different company from Yahoo in the US, pretty much.
I see
That one virus that changed my search engine years ago?
If you suddenly received $50,000 at your doorstep, which of these would you spend it on first?
- Family
- Child
- Car
- Bills
- Clothes
- Food
- Investment
- School
- Vacation
- House
- Savings
- Donationsβ
Kinda offtopic for this channel, no?
!topic
There are three off-topic channels:
Use any of the three, it doesn't matter.
The channel names change every night at midnight UTC and are often fun meta references to jokes or conversations that happened on the server.
See our off-topic etiquette page for more guidance on how the channels should be used.
piton
no
even the most remote islands and countries are not safe from AI slop
Javathon
jython tho
P++
P#
PythShutTheFuckUp
Makes sense
Minecraft Pisty
A wild tesseract
should I use pycharm or visual studio?
whichever you prefer
are any of them better
if you know either of them use the one you know best. If you plan on doing other languages than python you might find vscode a better investment.
Try zed too
alr thanks
okay
they are both large and complex, and people will like or dislike different things about them.
more people use VSCode these days, but that might not be a deciding factor
k ty
One vscode feature (extension) I found recently lets me remotely build/run/git python on my linux box from my windows desktop, gives me a remote ssh for the terminal window too. Very convenient.
w
Are you using the official one or a third party one?
If you want tabout the best extension known to mankind use vsc
"remote - ssh by microsoft" even supports drag and drop of files from windows to the linux box.
Based
Microsoft should open source the remote extension. Iirc, most of its functionality is built into vscode
And pigs should fly
They open sourced the copilot extension, so there's a chance.
But that was probably in response to cursor
Microsoft should just Open Source all of their products and have people who actually care about their stuff fix it
"just"
justfile
its not like u must use microsoft products
i think that there aren't any better alternatives
for example, windows
or vscode
(although vscode is open source?)
but its not like i must use their products
there are forks of vscode, like Cursor that remove some of the microsoftiness of vscode.
cursor does look like vscode, didn't know it's a fork of it
i think that the better route is to try and make an os better than windows, and open source
What's your favorite justfile recipe?
that can load exe files natively, and basically support all of windows features
or not, but do things better
in other words, reimplement all of windows?
thats not what i said
Cursor ruined Microsoft extensions for code-oss and vscodium users.
i said to have all its features, or neglect some and have better features
"basically support all of windows features?"
so people could move to it without losing features
how do you support all the features without reimplementing everything?
u reimplement the features u want, thats true, but its not a windows copy
"all the features"
reactos has been trying that out for years
i then changed it to "or not, but do things better"
ok
it doesn't need to be exactly all the features
it needs to feel that u dont lose by moving
and if its open source u finally dont need microsoft
and dont rely on it
sounds great, but it;s a lot of work. better get started
didn't think about it, but yea
should i make my dream proglang or not
yea i agree... i do not like relying on microsoft to begin with
yes
i need to ban OOP but i cant
why do you need to, and why can't you?
well, you can not add it
polymorphism is good, encapsulation isn't
polymorphism isn't just an OOP concept
yep but its hard to reason about it outside of OOP
Languages like go and rust already effectively ban oop
they don't
rust doesn't
rust just doesnt have inheritance, it has all other oop features
why do you say that?
It's like comparing which horse is faster, the red or black one.
Rather than restricting yourself to a single paradigm, why not embracing what's best in each paradigm (there are more than 2 paradigms)?
compare modern TS to rust, TS gets verbose quickly
no I mean look at idiomatic React code
React is meant to be more like functional programming for its usage is it not?
the thing with modern TS is that classes are hated
TS doesn't have pretty features like dataclasses, and people just prefer to create raw "unbranded" objects, then later realize their mistake and hack on a "brand" property
Yea the typescript/JavaScript community doesn't seem to like oop generally.
hello
ban
I don't really understand what you're getting at. If there are things you don't like about OOP, then... don't include them? It is your language, you can do what you want.
Pythonic morning, chat
hi there, what's up?
Is not that name and profile violating some rules? Or not.
could you change your nickname in this server to something that isn't blank?
ok
ty
I mean ts is also very high level and solves different problems than rust
But I agree that bad typescript can get very ugly
i dont feel TS is any higher level than Rust is
presented to you by openai
I would still credit Astral for that
I wish there was a better way to write this:
p = await create_subprocess_exec(
"tree",
"--gitignore",
*(["-P", self.pattern] if self.pattern else []),
stdout=PIPE,
)
Why does it exist
??
It compiles directly to machine code
even JS does
TS is just a linter
why does what exist? Polymorphism?
do you mean in Python, or do you mean you want your language to do it better?
in Python
Generics are nice
mr Batchelder do you have a website where i can learn python
move the ternary into it's own variable called extra_args
It's so that you can take the shape of something, define this shape, and anything that matches it you can use while knowing nothing about it. You get more variation and reuse. Even functions can be polymorphic.
I'd write it as:
pattern_option = ["-P", self.pattern] if self.pattern else []
p = await create_subprocess_exec(
"tree",
"--gitignore",
*pattern_option,
stdout=PIPE,
)
It's like saying, I need something with this shape, and anything can fill it in, the stuff filling it in can be entirely separate.
Ok that makes sense
i could maybe add a feature to my library tshu that uses t-strings
extra_args = []
if self.pattern:
extra_args.extend(["-P", self.pattern])
p = await create_subprocess_exec(
"tree",
"--gitignore",
*extra_args,
stdout=PIPE,
)
specifically in OOP, it is useful that subtypes can be used wherever a type is valid, i.e., a method expecting an Ant would also work with WorkerAnt. WorkerAnt may have different behaviour to, say SoldierAnt, but this doesn't matter to a method which expects simply an Ant
await sh(t"tree --gitignore {self.pattern and ['-P', self.pattern]}")
extra_args = list()
if self.pattern != None and self.pattern != False:
extra_args = extra_args + ["-P", self.pattern]
p = await create_subprocess_exec(
"tree",
"--gitignore",
*extra_args,
stdout=PIPE,
)
+= can be used here too I guess
list() ew
My instinct keeps itching at me to make extra_args a dict but that's not how the command line works unfortunately
I wanted to make extra verbose
Or?
What if pattern is equal to 0
p = await create_subprocess_exec(
*ListFactory("tree")
.args("--gitignore")
.args("-P", self.pattern, when=self.pattern)
)
de morgan's law strikes again
Isn't x != a or x != b always true is a isn't b
Oh yea
should be and
in which case you'd want is not False as 0 == False will evaluate to true
p = await create_subprocess_exec(
*Cmd(tree, "--gitignore").args("-P", self.pattern, if_=self.pattern),
stdout=PIPE,
)
Cmd(...).if_(condition)(*arguments) is also possible
tree = Cmd(cmd) if (cmd := shutil.which("tree")) else None
def if_[*K](self, condition: object) -> Callable[[*K], Cmd]:
def wrapper(*args: object) -> Cmd:
if condition:
return self.arg(*args)
return self
return wrapper
not sure how to type this
Man, I'm spinning out on a course assignment because I'm being asked to select 20 random values from an array that are evenly spaced, presumably while using their random seed
Maybe I do'nt need to get the exact value they did and there's a tolerance, but I'm afraid I need to match it exactly
Also, this isn't even an algorithm class so I'm not sure what they want me to do
pick random values until you pass the test cases
tell claude to do it
nah
I know AI too well to rely on it for this
I don't even know if they want evenly spaced logarithmically, linearly, or index...ally
Screw it, I'll do it indexally. I doubt they're looking for an actual selection algorithm here
And soon rust devs won't be able to trust the compiler π₯
How can you match it exactly if it's random?
I mean, I can fix a random seed. But I'd have to figure out the methodology that they used, right?
What's the exact text of the assignment?
The potentially relevant bits:
Instructions:
- Fit an unpruned tree on training data and obtain
ccp_alphasviacost_complexity_pruning_pathon the TRAIN split only. - Subsample up to 20 unique alphas, evenly spaced.
Whoah sorry, forgot about markdown
Finding issues and annoyances to solve has to be a skill I swear
Anyway, I already have the array. By subsample I assume they're applying sklearn.utils.resample. But the "up to" and "evenly spaced" are throwing me for a curveball
So your unpruned tree is an array?
Not my tree, just the alphas that are calculated as part of the cpp algorithm
And how long is the array?
239
So I might just go by index in terms of evenly spaced, because they are not spaced evenly in absolute terms
I mean, you can still fix it by editing the message
i would drop out
you and your logic
So [arr[n] n for n in range(0, len(arr), len(arr) // max_samples)] should do it.
hmm, applying dropout here? interesting approach
its my favorite computer science approach after vodka
Right, but at that point, it's wierd to call that a subsample. But idk. I'm probably going to do something like that, only consider index when asked for "evenly spaced". Although I'd argue that "subsample up to 20" could just be 1. Or 2.
you jest, but i have taught people python while on gin before
Idk, I hate the problem statement
I've got a function prep_argv(argv) which returns a new argv list after tidying it. I use it both directly and through run() (a pretty thin wrapper for subprocess.run) so that i can make argument lists like this (real example):
run(
[
'rsync',
not doit and '-n',
('-e', ssh_exe),
not quiet and '-i',
verbose and '-v',
partial and '--partial',
bwlimit and ('--bwlimit', bwlimit),
doit and not quiet and sys.stderr.isatty() and '--progress',
'-ar',
delete and '--delete',
f'--exclude={fstags.tagsfile_basename}',
*rsync_opts,
'--',
f'{srcdir}/',
f'{dstdir}/',
],
doit=True, # let rsync -n do this
quiet=quiet,
)
prep_argv (called internally by run above) turns that into a flat argument list, discarding None and False arguments and inlining the tuples (which are there basicly to eg group ('-e', ssh_exe)
I have coded while blazed
THe downside is that I have no idea what my comments mean
-# (dropout is a machine learning technique where you drop out some neurons during learning to help it generalize better or some such)
#yo, this right here
It could be 1 or 2. But since the array is larger than 20 it seems that the desired output is 20 based on index.
I just dislike the ambiguity. I'll try just evenly spacing the indices out and if that doesn't work see if I can get enough points on other sections for that one to not matter.
It's a newer course which is good for getting caught up on later advances but bad for being the guinea pig
Give feedback to the instructor that the wording is unclear and has multiple possible interpretations along with at least 2 of your interpretations. Ask what the correct interpretation is.
That's probably the best approach
The feedback that the instructions aren't clear should help. It's also possible that the instructor doesn't care how you interpret the instructions.
haha
I'm actually not 100% sure I can contact the instructor. This is for a master's program but it's performance based admissions. I have to pass 3 specific classes with a certain grade to get admitted.
Lifehack: to deal with unwanted ambiguity, pick one interpretation and convince yourself that's the only reasonable one
Hi guys , hope everyone if fine !
Rn i am learning python from a book , and w3sschools .
Also i use Gemnin to create me some problem to solve and some mini project to do so i dont forget what i took and use them.
is this a right way to learn python?
(ping me)
I mean I could reverse engineer his email address from other prof emails at the university
w3schools is a very unreliable source, and llms can also be fairly unreliable
w3schools is a terrible resource with lots of incorrect information, and AI is not generally a good way to learn either
I once had an assignment to "write a program that will clear a 25x80 terminal window." My solution:
void main(char* argv, int argn) {
system("clear");
return 0;
}
Instructor was looking for:
for (i = 0; i <= 25; i++) {
print("\n");
}
He had taught us system in that class. I got an A on the assignment.
Pick an actual structured resource and work through it so you can better track your progress
!slorb
Here are the top free resources we recommend for people who are new to programming:
- Automate the Boring Stuff β an online book (also available to purchase as a physical book)
- Harvardβs CS50P course β video lectures (slides and notes provided) with exercises
- Python Programming MOOC 2026 course β text-based lessons with exercises
- Corey Schafer's YouTube playlist
For a full, curated list of educational resources we recommend, please see our resources page!
I saw a really funny language course submission. I think it was a english class based in russian. Kid had to submit a sample conversation, it went something like this:
"Hello, do you speak Russian?"
"Yes, I do"
"Great! Please tell me how to reach the terminal"
russian directions
russian response
russian farewell
the prof was not amused
I had to write Java code (on paper, of course) in a test to list the 0th to 10th powers of 2.
Guess what approach they wanted
I would hope not!
It involved 3 classes.
spoiler: repeated addition, N times for number N (so overall O(n^2))
Guess how I did it
Do you know how many times I've written malloc and free on paper?
by writing them down from memory?
I stopped counting. It was a common interview question back when I worked in C.
using the Java built-in power of 2 operator
Damn bro
1<< x
Nice!
powers of 2 aren't that hard to remember (or mentally compute)
Works in Python too π #bot-commands message
Ur too good at coding
At some point they get annoyingly large.
I can't remember
Did you figure out how to write the function I described to you?
Yo the function
oh that function
It needs to be named "adder". It needs to have one parameter named "x". It needs to return x plus two.
tbh i dont know what to use and lost
cant u suggest anything?
true, but 2^10 is still pretty small

So
Yeah. 1K
Can you write that or not?
in any case it is a bad question, and bad questions ought to be answered in equally silly ways
I took a long break my bad bro
update on my thing, I just wound up doing:
indices = np.linspace(0,238,20).astype(int)
See if you can do it right now.
What do u suggest?
Alr
mm , so what source do u suggest? the book is just the basics , how can i learn?
1 2 4 8 16 32 64 128 256 512 1024 2048 4096 8192 16384 32-something 65536
!resources
Well, you know how you best learn, but if you're really not sure where to go, here are some good ones. Automate the boring stuff is very popular
The Resources page on our website contains a list of hand-selected learning resources that we regularly recommend to both beginners and experts.
Damn
I forgot some of the codes bruh
I got an F in coding
0x1 0x2 0x4 0x8 0x10 0x20 0x40 0x80 0x100 0x200 0x400 0x800 0x1000 0x2000 0x4000 0x8000 0x10000 0x-
Can I do powers of 2 but in binary
this is cool! i will search for the best
!slorb is the new thing for beginners.
Here are the top free resources we recommend for people who are new to programming:
- Automate the Boring Stuff β an online book (also available to purchase as a physical book)
- Harvardβs CS50P course β video lectures (slides and notes provided) with exercises
- Python Programming MOOC 2026 course β text-based lessons with exercises
- Corey Schafer's YouTube playlist
For a full, curated list of educational resources we recommend, please see our resources page!
This is almost the simplest function I could possibly ask you to write, so if you still want to learn python, you should try reading about functions again
You can use binary, but you have to do powers of 3
Can I read it tomorrow?
You're giving me flashbacks to an interview where they wanted me to convert from base 3 to base 7 in my head
Might be a stupid question,
But when would you ever actually want to use a sentinel value?
I want also to ask smth , many freind also my freinds tell me that Ai will take my job and yap yap yap.
i just want to hear more people saying why AI wont take my job or my dream so i feel a releaf:)))
and no, it was not relevant to the position in any way shape or form
Sure.
idk what is it yet lol
That's just cruel.
W
Yeah I'd fail that one π«
I think I could build that from the box of transistors I have on my desk
None True False are all sentinels.
how to do it?
What's worse is that I was told it was just a screening call, then I was suddenly there for the company's vp of engineering
C uses them all the time
Also, I was off by like.... only 1 or 2 somehow, I have no idea how i got that close. Still got mocked
That's fucked up.
Null-terminators for strings are just sentinel values
I mean...
Sure.
But why not... just use a default.
Unless I'm misunderstanding the point here
I want also to ask smth , many freind also my freinds tell me that Ai will take my job and yap yap yap.
i just want to hear more people saying why AI wont take my job or my dream so i feel a releaf:)))
In what context?
Yeah. I still get some interviews like that from time to time.
Like, a function parameter has a sentinel value
Sentinel values can be used to send a stream of data without knowing the length
Are you applying for a job as a mathematician?
I don't know what AI will take or not take, nobody really does. It's not even about the technology, it's about what people think the technology can/will do
Oh that's sensible actually
Define "sentinel value"
I do tend to apply for numerical computing/scientific developer roles but I cannot fanthom how any of that was important for this role. I don't recall exactly, but I think it was AI/ML?
I also had to write SQL in my head and rattle of linux syntax
Check if a value was set or is still a default. You make the default a sentinel and then check if it's still the sentinel
user sends 'h'
user sends 'i'
user sends '!'
user quits
technically a sentinel value
as i see , it wont , but things will be fine always , human wins in the end
I think AI and its impact is very unstable now and it will be some time until we can see its true effect.
I can understand SQL pseudocode but base conversions in your head? That's nucking futs!
I see
That makes sense, TY
Explains it succinctly
Much appreciated, you two
Yeah, I'm like..... man, I haven't done this since college
and I had pen and paper
I despise whiteboarding interviews. They are such a waste of time.
Well I have done 10-16 in my head
or should I say 10-10
The market is so rough these days that I'm even willing to do takehome assignments. Although I've limited myself to only ones that can be done in an evening. No more of this week long stuff.
There was a hero online though who did take home projects but watermarked them and said he's had a couple companies completely flip out over it
I know hex well enough that I can convert in my head anything up to 0x1000
I would prefer a takehome to a whiteboarding.
I think I would, too. But also like... My algorithms are on medical devices that are out on the market. I should jsut be able to point and say "there's your proof"
Idk. I'm also of the belief that like.... idk man, 5 rounds of interviews max
I don't care if you're hiring for the CEO
yes
we gotta wait for now, but i know learning and understand the code could protect me from it
I once went through a process of 5 or 6 interviews. Left the last one being told to expect to hear about next steps in a day or two, i.e. expect the job offer. Got home to find an no thank you email in my inbox. (This was before smartphones.)
Haha that's how it is
I've been fixing the error that came from fixing the error that came from fixing the error that....
1e7 errors
Sounds right.
99 little bugs in the code.
99 little bugs.
Take one down,
Patch it around.
117 little bugs in the code.
π
There's a reason 80% of the job is debugging.
Iβm a beginner and decided to make my programming assignment harder by using nodes for a CYOA game
This sucksss it takes forever cuz im a bad writer
what are these things i gotta lock in :((
Its a form of data management
Ohh , i am still in the very beginnings
like def and for loops
Me too I just chose a really hard way to do something to learn
Thatβs where Iβm at too :p
Is it the writing part that's tripping you up? Or the organization of it?
What are u doign with data bro , there is still much lol
I suggest instead of using defs and for loops you.... oh. A graph works really well for this
If you're uh, familiar with graphs
if not then RIP
Writing parts annoying and long but the engine is really hard
is this a good source?
Is Python your first language?
Seems like it but bear in mind the tip, it's made for programmers new to python as opposed to someone new to programming
Itβs made by the Python devs so Iβd assume so
But itβs kinda hard to read syntax
i know a bit of c++ , but for Arduino , so Python is my first
Scott pilgrim pfp β€οΈ
!slorb I highly recommend looking at these.
Here are the top free resources we recommend for people who are new to programming:
- Automate the Boring Stuff β an online book (also available to purchase as a physical book)
- Harvardβs CS50P course β video lectures (slides and notes provided) with exercises
- Python Programming MOOC 2026 course β text-based lessons with exercises
- Corey Schafer's YouTube playlist
For a full, curated list of educational resources we recommend, please see our resources page!
CS50p is really good if you do the problem sets
Should i watch it?
How do I make a message formatted in code 'py something?
Yes but most importantly do the problem sets itβs hard to learn otherwise
Hi where is the channel to ask for help with coding ?
What do you mean?
Your in it
!code-block
Hah, I guessed it
sorry did not get it
There are problem sets, exercises. Watching the videos is not enough. You need to do the problem sets as well.
So to many things will confuse me tbh .
I have
1-Automate the Boring Stuff with Python
2-CS50
3-https://docs.python.org/3/tutorial/
i can not use 3, i should stick with 1 or 2 max ?
what do u think all?
yes , i gotta learn how to type and use the code
If videos help you learn more, CS50P. If you learn more by reading, Automate the Boring Stuff.
The python.org tutorial is aimed at experienced programmers.
nodes = {
βnodeNameβ: {
βtext:β: β\n txtβ
βchoicesβ: {
βchoice1β: {
βnext: βnode1β
},
βchoice2β: {
βnextβ: βnode2β
}
}
},
This is how Iβm formatting my nodes (roughly my phone makes it really hard to type it exactly vs whatβs on my laptop)
OK ty , i will see one , i love reading , so the book is full pyhton totorail?
Pretty much.
I've been a professional software engineer for 20 years.
dont you ever sleep?
It's only 21:29 here...
20 years is a long time to stay awake...
Is this dyslexia with times a problem?
My eldest turns 20 in June. That should explain why I haven't slept in a few decades.
Can someone give me feedback?
Not dyslexia. 21:29 is the correct time in my current location.
AH 20 years?
Yes.
Thanks for the help!
how is the job market after AI , AM i cooked?
Heβs been a professional software engineer longer than Ive been alive
Will it change? Yes. Will it go away? No.
Damned if I know. It depends on how big the bubble's popping is going to be. There will be a lot of fallout.
another settlement (company) needs your help (to fix their vibe coded stack)
so u think , that i will have a job and Ai wont make me homeless?
I don't even think that about me.
yea "hello DANS , our SMART AI MADE SOOME MIStAKeS , can u ple fix it ?
Eventually. The question is when,
Well, on one hand AI is still growing. On the other hand, a lot of the push of replacing engineers with AI is done by people who don't understand the limitations of AI. So who knows where it will balance out over time.
ive already started
People who know jackshit about what they are in charge of making cataclysmic decisions about
AI is still growing yes, but most of the dataset has already gone in
Yea my freinds are making an app with lovable i told them we need to work in it , they oh oooono, this AI is smarter that u poor coder , i told we will see
INVESTORS , tbh i dont think subs will make a profit for them
Honestly, even on the upper bound, I don't think GenAI can ever grow beyond a point where it's probably approximately correct
A friend of mine, a staff software engineer and PSF board member, was just laid off last week with a number of other people at their company. There's fallout.
someone is going to have to fix this shit in the future
Also i heard that they are cutting emplyers bc of no money , but they are saying we are using AI so investors dont get the money back
Honestly, you know what the most important thing is? If you rely on a person/company and they don't deliver, you can blame/sue them. If you rely on AI and it screws up? You'll be the only one shouldering the blame
I don't pay someone to repair my laptop because I can't, I pay them so I can blame them if it goes wrong
Oh, it's because I'm looking at it from underneath.
Oracle fired 30K people because they couldn't take out loans to cover their commitments to OpenAI.
-# someone in this server literally got fired yesterday...
a espicialy in money and data , these things need profisinal hands , bc 1 screw and u dead
i wonder who will manage these data centers
You think these data centers will actually exist?
I will
if they lol
when will oracle fire the 3 billion devices
u work in orcale?
when they will be dead
they probably shouldnt keep so many devices running when they have no customers
No
how then?
when the last of the 3 billion devices stop using java
Speaking of, does anyone know how to turn off the stupid google AI when you google something?
To be fair humans are prone to mistakes too
yea but humans know that it's a mistake
I just use a different search engine
My school is in massive debt cause some dumbass messed up
Use a better search engine.
Good advice. Any suggestions on other search engines?
I use Kagi. What do you use?
Firefox