#python-discussion
1 messages · Page 483 of 1
What was the bottleneck of this code?
the first argument to map has to be a function that will be called with 1 argument, the elements of the iterable
but move_file takes 2 arguments, right? so instead we make a partial application of it, with the destination being the path variable, and only leaving 1 argument to be filled - the file
Btw, you can get lots of program information (like current line number) with !inspect
!d inspect
The inspect module provides several useful functions to help get information about live objects such as modules, classes, methods, functions, tracebacks, frame objects, and code objects. For example, it can help you examine the contents of a class, retrieve the source code of a method, extract and format the argument list for a function, or get all the information you need to display a detailed traceback.
There are four main kinds of services provided by this module: type checking, getting source code, inspecting classes and functions, and examining the interpreter stack.
thx
!d inspect.stack in particular
inspect.stack(context=1)```
Return a list of [`FrameInfo`](https://docs.python.org/3/library/inspect.html#inspect.FrameInfo) objects for the caller’s stack. The first entry in the returned list represents the caller; the last entry represents the outermost call on the stack.
Changed in version 3.5: A list of [named tuples](https://docs.python.org/3/glossary.html#term-named-tuple) `FrameInfo(frame, filename, lineno, function, code_context, index)` is returned.
Changed in version 3.11: A list of [`FrameInfo`](https://docs.python.org/3/library/inspect.html#inspect.FrameInfo) objects is returned.
sys._getframe is basically the same thing but more raw
In response to: How do you find this stuff? Years of looking at the docs for no good reason.
I've never seen "very" spelled "no".
I innovate.
Innovation is key.
did the explanation make it any more clear
And good docs.
good docs is innovation is key is not bread
because good docs taste better than key
or.. bread?
I don't eat my docs.
missing out
I try not to eat bread too.
Never tried out a key before
this is what real autism looks like
I recommend A Minor.
Also, I write a lot of code and ask other people to revise my code which will almost certainly point you to places in the docs you've never seen before.
(Amongst many other benefits)
Plus, I program in other languages than Python and pull brain damage from them.
my favorite one is other people can learn from it too
Why would you do something silly like that?
Because I'm a silly billy.
Hello 👋, I just joined this server, and am learning python as parts of the languages I need to be a game developer
Welcome!
Thanks
haha, no I know what Lambda does, I don't know how it does though
I don't really make games myself, but I make libraries that make game dev easier (see the project showcase for mine and many other projects)
thats what i was trying to explain yes
so i guess it didnt work
It's an anonymous function. It works like any other function.
like syntax i mean
(Small caveat: It doesn't have a name like a function does iirc)
lambda <params>:<return value>
That's pretty much the syntax.
Hence "anonymous"
Yup!
where does the argument that gets passed into the params go?
as in def functions, arguments bind to the parameter variables
(lambda x: x+1)(2) == 3, the 2 is passed as x
def is_under_thousand(number):
if number == 1:
return True
else:
return is_under_thousand(number - 1)```
my_func = lambda x: print(x)
my_func(5)
That will print 5
this function will not make you happy, for a few reasons
lambda <params>:<return value> roughly translates to:
def no_name(<params>):
return <return value>
I know i know
- it crashes instead of saying false
what are the reasons?
This is equivalent to
def my_func(x):
print(x)
- Its slow
- It can never say false.
- negative numbers (or 0) also dont return
well yeah this
no. even if you had infinite stack space, it would never return false.
there is no "return False"
and eventually crash because its out of memory?
forget the crash.
The < operator would be by far a more appropriate solution.
I wasnt actually proposing its a good function
So like this?
def move_all(path:str):
with ThreadPoolExecutor(max_workers=50) as executor:
executor.map(lambda file:move_file(file,path=path), get_files())
Does this make sense?
executor.map(lambda file: move_file(file, path), get_files())
# same as:
def move_file_to_path(file):
return move_file(file, path)
executor.map(move_file_to_path, get_files())
Yeah.
Is somebody trying to reinvent some form of Peano arithmetic? Hmmm...
idk why you added keyword arguments but yeah?
does it work without path=path?
oh yeah duh 🙄
IT would work with move_file(file, path)
What if i input 0
:DDD
Guys, can i share something?
RecursionError
.
-# Nvm, i feel it wouldn't be related to the current topic
def foreach(iterable, function):
for value in iterable:
function(value)
def two_args(x, y):
if x==9 and y==10:
s = 21
else:
s = x + y
print(f"{x} + {y} = {s}")
def example(xs, fixed_y):
def one_arg(x): two_args(x, fixed_y) # uses fixed_y from parent scope!! yaay closures very coool
foreach(xs, function=one_arg)
example([9], 10)
does that make it any more clear
There is only one way to find that out
i can't tell if my "no return False" point landed or not
huh
If it is a lot of code, you might want to consider doing a help thread. If it works, you might consider putting it in the project showcase channel.
Just share it
I wasnt asking if its a good function I made it cause its dumb (and thats part of why its dumb)
Tbh it is just sharing something rather than needing help, better to put it into off topic, i guess
(And, sorry for interrupting)
ok, we were listing issues. i understand.
If you really want to you could do
try:
under_thousand = is_under_thousand(number)
except RecursionError:
under_thousand = False
Halting machine problem?
well, except RecursionError actually works
Nah, it's all good. You can share here. I do it all the time lol. Just trying to help point you in the right direction.
What if I input 99.9999998
but i hope no one uses it
still wouldn't get the right answer for 1_000_000
why not?
Imagine number was type hinted as int
yes! Thank you so much
because it will raise RecursionError when it gets to about 998000
I can feel my brain growing every time I solve a problem 🧠
well yeah, so the except catches it and says its False
@lunar cobalt
try:
under_thousand = is_under_thousand(number)
except RecursionError:
under_thousand = is_under_thousand(number)
i just installed fedora and PyCharm
well that doesnt accomplish much does it
you are right
def recursive_lt(x: int, y: int):
"""For non-negative x and y."""
if x == 0 and y == 0: # They are equal.
return False
elif x == 0: # x < y
return True
elif y == 0: # x > y
return False
return recursive_lt(x-1, y-1)
How can you adapt to negative numbers too?
any function that relies on when exactly RecursionError gets raised will have different behavior depending on how many call frames are already on the stack when it gets called
How do I disable Copilot on VSC
how do you change the limit for RecursionError?
sys.setrecursionlimit
thx
make a wrapper that will
if both are positive do the normal thing
if x negative and y isnt - true, since all negatives are smaller than any non-negatives
if x positive and y negative - false, same logic just switch places
if both are negative, do the lt in the other order since -2 < -1 <-> 1 < 2
checking whether they are negative or positive would be done with some new structural tag in a peano encoding
I know you know lol.
(But yeah, it's so fun to think of this stuff. Very Peano-y)
Although, using von Neumann ordinals we get the isomorphism between membership and less than
well for naturals, not Z
I miss math
like we had
data Nat
= Zero
| Succ Nat
-- And now we have
data Int
= Pos Nat
| Neg Nat -- though sometimes this is -(n+1) to not have 2 representations for 0, so it would be NegOfSucc or something
I might have asked you this a while back, but did you play the natural number game?
only like the first couple proofs
but i do use lean4 for fun
Ah good. It's fun.
I miss that stuff. I need to get back into it, but I'm dedicating the time I have energy to do stuff to my resume lol.
the last thing i wrote in lean is
def bigO (f g: Nat -> Nat): Prop :=
∃c: Nat, c ≠ 0 ->
∃x0: Nat,
∀x: Nat, x > x0 ->
f x <= c * g x
theorem bigO.constant_multiplier
{f g: Nat -> Nat} {m: Nat} (p: bigO f g):
bigO (fun x => m * f x) g := by
obtain ⟨c, q⟩ := p
exists (c * m)
intro cmnz
have cnz := (Nat.mul_ne_zero_iff.mp cmnz).left
obtain ⟨x0, le⟩ := q cnz
exists x0
intro x xgtx0
dsimp
have fleg := le x xgtx0
conv => {
rhs
conv => lhs; rw [Nat.mul_comm]
rw [Nat.mul_assoc]
}
exact Nat.mul_le_mul_left m fleg
absolute naming
is pycharm good on 4 gigabites of ram
That's some neat python you got going there.
should be fine
gigabites
heehee
There are people who would say that the amount of RAM is irrelevant. Should be OK if you don't have too many windows open.
being bitten a billion times cannot be good for you
got it 👍
with pycharm?
Yeah. PyCharm should be fine with 4GB RAM.
even the heaviest IDE won't use that much RAM. I'd be very surprised if you could get pycharm to use more than 1 GB
using lean4 without mathlib is certainly an experience
PyCharm can get heavy depending on the plugins you're running and how many windows you have open.
the system requirements are 8gb with 3gb available for ide processes
If you're worried about resources just use vim or nvim imo.
that's going to be higher than what it needs but it doesnt seem like... a fun time
@upper frost people will say "just use", but it's not always simple to switch to what they suggest
sublime would be "just use" and without much bloat
shhhhh
!pypi justuse
I'm curious
package made by someone who was active here couple years back
One question for the pro devs here, since im new into python i can do the basic things and make small systems but when it comes to something big i cant remember everything and i have to check Old code or Ask Ai or check Doc, is that normal or i should focus even more into learning these things untill i know everything ?
Nobody remembers everything. We all look at docs and reference other implementations.
This feels like Lua
that's completely normal, i'd suggest mainly on focusing on reading documentation because its a skill you need to have
its only similar in the sense that the import is a function
but its actually very different in other aspects
I remember I had to do some import hacks for my website because I wanted to make it easy for newcomers to add problems to my website.
use("pprint").pprint()
i think the goal was to model golang-style import?
hello
and then i never touched import again.
in terms of functionality
okaay thank you!
i will try reading more doc and learn it, thank you too!
Do you mean like ctypes or like literal #include statements?
The second
vro wants to deal with linkers
exec the read of the file
I read this like a movie title: Exec: The Read of the File.
would watch
^ thumbs up (but I can't)
i finished watching arifureta yesterday and now im going to watch shield hero
absolute isekai ||slop|| but i like it
Is readthedocs still the way to go for adding docs? Or is there some new player on the block?
I use RTD.
i hear there's some drama around mkdocs but that's besidesthepoint
so does cython and they recently updated the theme
https://cython.readthedocs.io/en/latest/ looks good now
from what i heard, really bad maintaners
just the maintainer in general
maintainer [singular]
There is some drama there but I don't know what it is. Doesn't affect RTD though - you can use any static site generator to create the docs.
there probably are multiple but it is around the one
Alright. I just need to get some decent modern looking docs for my projects quickly. Not too concerned about controversy atm.
(Normally would be tho)
i mean rtd is just a place that hosts your docs :p
but yeah rtd is fine last i used them
I just realized we're using mkdocs for the docs for the SSG I maintain and I'm kinda wondering why...
the guys behind material for mkdocs went and made https://zensical.org
a fellow ssg guy? 👀
!pypy render-engine
SSG?
Yes. Yes I did.
yoo
!pypi render-engine
i love static site generators
oh.
Static Site Generator
i rolled the one my website is running on
I use RE for my website.
Why on github.io?
because it is free.
i've got mine running on cloudflare pages
I use https://teahouse.cafe for hosting. Run by 2 amazing Pythonistas and great for static sites.
I rolled my own SSG with a WP-like web frontend. It's running on a hosting provider that has done me good for some years but I'm not too crazy about their newer plans. I might migrate when my contract with them comes up.
I have a site that uses render.com (not static) but I don't really want to pay more money haha.
especially since I'm not sure anyone would actually read my blog.
im doing a rather interesting major refactor right now
is there functionally much of a difference? i guess cloudflare pages does run it on edge servers
finally moving away from sqlite for caching
nah not really, but you do get fancy stuff like cloudflare's DDOS protection, metrics, etc
and some other security things cloudflare does?
Why wouldn't we read your blog?
my domain is also managed by cloudflare so it's nicer to just have everything in one place
you can use cloudflare metrics on github pages (in fact i do that)
My questionable programming decisions 😛
Do you care about the metrics?
nah not really
All the more reason we would read it.
wow my site has had 0 page views in the last month
I need to post something to my blog. But I don't know what I want to write about.
and im trying to decide on a nice way to establish dependencies between inputs
Just think of the spiciest most unhinged (programming) opinion you have and write that.
Most of what I blog about is doing creative things (like writing my books)
there's a project out there that uses a query system to handle caching and incremental rebuilds, which seems interesting
Why C is the most memory safe language ever created?
Yeah. Title it: "My OS is Safe so C is Safe"
Rust is slow and unsafe
i wouldn't agree with that statement
And, Windows is an excellent operating system
Neither would I. I was asked for "spicy and unhinged"
it is safe in the collective memory of programmers
"I Can Outrun the Borrow Checker (and so can you!)"
oh i only read your message not the rest of the context
linux is written in it and its safe
qed
qedisproved
Python is written in C so C is safe?
does being C make it safe, or is it being safe that makes it C?
It has a great Navy protecting it.
rust is written using llvm which is written in C and C++ therefore C and C++ is safe
I thought it was all corroded.
yea corrosion not safe
Remind me later: Maybe I should write my own IR in Rust instead.
osha disapproved
I actually need to learn more about LLVM (and related IR) I still don't fully understand why we don't compile to C more often.
I mean, I guess function calling conventions are part of the reason...
but I feel like there is more to the story.
Hi it's good topic I love that
Investigate and submit a talk to your local tech conference.
Unironically a good blog post (after some investigation)
large language (virtual) model /j
Definitely. And then a good talk.
I compile my code to ChatGPT bytecode
I'm trying to remember the alternative to LLVM that was smaller in size...
A discussion here on NaN led me to writing this blog post and from there to writing a talk proposal for PyOhio. This is the way.
Oh, a spicy takes; 'ARY': always repeat yourself
Please no. Not after this week!!! I had to touch 240 files because we didn't follow DRY!!!
why we use IRs in the first place? Or just LLVM
That's what I want to know lol. I asked why not use C above somewhere.
wait im dumb
i misread: Yeah why we use IR as opposed to C for instance?
sorry
(Btw, i'm looking at SO answers and they're a bit handwavy imo)
Does anyone here have a good free Django bootcamp?
I mean, "duplication is far cheaper than the wrong abstraction"
is bool('False') False?
no, you could just check that in a repl
non-empty strings are truthy
was hoping they made it special
what a repl?
!repl oops
A REPL is an interactive shell where you can execute individual lines of code one at a time, like so:
>>> x = 5
>>> x + 2
7
>>> for i in range(3):
... print(i)
...
0
1
2
>>>
To enter the REPL, run python (py on Windows) in the command line without any arguments. The >>> or ... at the start of some lines are prompts to enter code, and indicate that you are in the Python REPL. Any other lines show the output of the code.
Trying to execute commands for the command-line (such as pip install xyz) in the REPL will throw an error. To run these commands, exit the REPL first by running exit() and then run the original command.
neat thing for small experiments
just keep one open and throw expressions in it when you think of something
why
that would be like, horrible. such a weird thing to special-case and will result in inconsistencies
Oh
Explain why the first element of an array or factor is [0]. Can someone help me with this please?
I've always known first element of an array is [0] but now im asked why, i literally dont know
as in, why not 1?
long time no see lambda
are you being asked this about Python specifically?
yes, i know it has to do with memory of some sort
my initial take would be because for one, your language might want to be transformed to a format that's explicitly designed to be easy to analyze and work with, so you can implement all of your optimizations and transformations and whatnot without having to deal with an entire other language, like C, and deal with what C allows/doesn't allow.
in general
kind-of but atp its irrelevant
its just a choice
in some algorithms working with [1; n] is nicer than [0; n), in some not
have a +1 here and a -1 there
Goodnight chat
it's not even true in general. Some languages use 0, some use 1
if you're being asked it about C or C++, there's an actual reason
yes, its c++
for any other language, it's basically just arbitrary
Might want to check out: https://www.cs.utexas.edu/~EWD/transcriptions/EWD08xx/EWD831.html for why starting at 0 is a good idea.
i've googled it but im having hard time understanding
ayeee thyrgle long time no see
ayyyyyyy
I've been busy doing some stuff haha. Taking a break now. Will get busy. The cycle continues lol.
but yes, in particular, c++ why array starts at 0. I'm studying for finals
for C or C++, it's because x[0] on an array is equivalent to *(x + 0). This also lets you write 5[x] in C and C++ instead of x[5], for one of the all time weirdnesses of the language, because *(x + 5) and *(5 + x) are equivalent
You too!
the first element of the array is at the start of the array which is 0 bytes offset from it
can u build a simple port scanner?
also it's worth noting that the C compilers are all going to go to their own IRs anyways (and if it's clang, it'll just be llvm in the end as well). If you want more control over what those specific optimizations and transformations and whatnot are, you probably don't want to just compile down to C
"can you for loop over ports and check if connect succeeds"
can you explain to me like im 5 lol
can u make a simple port scanner?
without ai
i been busy with uni too and work. Discrete math is kicking my butt
I can see the argument. But I guess I don't have concrete examples of why "more control is needed"
yeah, why? i just explained how
lol how do u edit so fast
you explained but can you show me
He uses a split keyboard
(i dont)
that was
indexing into an array in C++ is defined in terms of pointer arithmetic, and the 0th element of the array is the one 0 elements past the start of the array - the one exactly at the start of the array
fast.
Welcome to a weeder class.
GOODNIGHT AMIGOS!
sleep well
THANKS YOU 2
just loop over the ports, try to socket.connect, if no exception - port open
me neither to be honest, but it's worth looking into an example of an actual complex compiler like rustc that definitely does its own stuff. if you look at rust's MIR, the stuff it does for ownership is well documented
okay thanks goodnight
im pushing through though
Alright. Thanks! That sounds like what I'm looking for! I will.
ghc core
i've read this like 50 times. im stuck over " 0th element of the array is the one 0 elements past the start of the array"
an array is basically a chunk of memory and you know where the start of the chunk is
the first element is right at the start of the chunk, its offset by 0 bytes (not offset at all, basically). thats it.
right
If you draw out what it looks like in memory the pointer is located at the first "cell" of the array. You increment it to go to the next "cell". But you don't increment it at all to simply be at the first element so it has an index of 0.
muy bien, got it
pointer arithmetic lets you find elements of an array relative to the start of that array. If you've got an array of 5 ints int x[5] then:
| 4 | 5 | 6 | 7 | 8 |
^ ^ ^
| | |
x x+1 x+2
The first element of the array is *(x+0), which is defined to be x[0]
The best I can explain is about 0 being the first number in a byte
btw is this chat strictly dedicated to python or we can discuss other languages as well
they come up but there are more appropriate servers for discussions about other languages
i cant wait for semester to be over so i can go back to python programming
i dont understand that sentence either to be fair
"the first number in a byte" doesn't really make any sense. A byte is not subdivisible in C, the smallest unit of memory you can point to is a byte
one 0 elements
there's an implicit "that is"
English has a lot of those
the 0th element of the array is the one (that is) 0 elements past the start of the array
im still confused so you're good broski
oh
i get the intuition behind it but cant quite articulate it
it's a way of saying "how many steps are we taking past the beginning?"
A byte goes from 0 to 2⁸ - 1,so 0 is the first element
Or number
Hello
if we start at the beginning, we take no steps, so the first index is zero
thats kind of what i got
in the simplest way
How can i turn er diagram to table please
are you sure it doesn't go from -128 to 127?
Just the basic one 😭 🙏
char can be signed or unsigned in C, it's implementation defined
i think that is an implementation detail
"the basic one" could be either 0 to 255 or -128 to 127
a byte is defined as 8 bits, i think so
what you do with those 8 bits is implementation detail
mathematically, if there is an array at byte address A consisting of elements that are each of size S, then element N is at byte address A + (N*S)
nope, not in C. C and C++ define it as at least 8 bits
a byte can be more than 8 bits?
and strictly speaking, an octet is 8 bits. a byte can be any number
No
in C and C++, yes
interesting, i didn't know that
Huh
when C started, machine were much more diverse. Now, bytes are always 8 bits
I think there are still some extant machines where the minimum addressable amount of memory is 16 bits or 32 bits. They're rare and weird, but I've heard they still exist
do we know of current implementations that have more than 8 bits per byte?
i see
thats very interesting
So a "byte" could be defined as a N group of bits?
from what thuri said, at least 8
Its strange to see byte that isnt 8 bits
Some DSPs, apparently. "The example which seems the most relevant of current architecture with non-8-bit-bytes is TI’s TMS320C28x, whose compiler manual states..." per https://www.open-std.org/jtc1/sc22/wg21/docs/papers/2025/p3477r3.html
in C and C++, yes. It's not the most common use of the word "byte", but it is what those languages currently use it to mean.
in most contexts, "byte" does indeed mean "octet", but it means something different in C and C++
they use it to mean the smallest uniquely addressable unit of memory
a unit of memory yes, thats why it doesn't have a defined value
char uses 1 byte, if signed it can store a value between -128 to 127
if unsigned 0-255
at least -128 to 127, and at least 0 to 255
possibly more, on weird platforms (like the TMS320C28x)
i see yea
64-bit byte what a cursed thing to see
it's mostly a historical curiosity that you won't need to deal with if you're writing code for desktop CPUs. The non-8-bit-byte thing only applies to weird special purpose hardware
should've used the term octet
although i think most people don't know about this term
i must not have it even after downloading pyenv and all of that umm, that exact version of 3.12.13 also isnt there hmhmhmmmm idk what to do
i didn't know byte can be not an octet
Some really esoteric platforms don't have unsigned numbers
like Java
C's octet type is called int8_t or uint8_t, but there's no guarantee that an implementation will provide that type
Isn't it allowed to be bigger?
uint9_t when
no, that'd be int_least8_t
Java has Integer.compareUnsigned, Integer.divideUnsigned, Integer.remainderUnsigned, and Integer.toUnsignedLong. Take it or leave it 🐒
Oh, BTW
LLVM has that
Absolute cinema
theorem AbsoluteTruth:
Given:
Then:
true
Proof:
true
leave js
huh?
JS != Java
what language is that
no it wouldnt let me get the version idk why ;/
yea thought i'd word play on it
im also on windows
not a good word play though
i used the port too
one im making
port?
Will you assume the law of the excluded middle?
did you already send the error message previously?
Which is?
If something isn't true, it's necessarily false
and its negation is then true
no, it doesnt. If you claim that something is true, it being disproven or false makes the claim "wrong", not false but "not right". if you claim something is false but its true or unproven the same happens
If I prove a theorem under the assumption P holds, and I prove it again under the assumption !P holds, have I proven that theorem?
have you done this?
I'm going to be perfectly honest, by the time you are looking for a job, quant firms would have likely moved on to later versions of python
theorem QgivenP:
Given:
P
Then:
Q
Proof:
...
theorem QgivenNotP:
Given:
P is false
Then:
Q
Proof:
...```
You could do this
And then call whichever you need
3.6
byte
addressable unit of data storage large enough to hold any member of the basic character set of the execution environment
if i'm reading a version of the c standard correctly, the definition of "basic character set" in 5.2.1 describes the minimum characters required, not maximum, so you might be able to define the basic character set as all of unicode, thus allowing - and requiring - a 32-bit byte
yes, you can
the size limit mostly comes from the "addressable" part, though, not from the "basic character set" part
the big reason why some platforms have bytes that are more than 8 bits is because those platforms don't allow you to address an arbitrary group of 8 bits
What’s python
I should make a logisim computer with 11 bit bytes
A programming language known for being easy to learn
When I use powershell in my flask app this pops up on opening powershell why is this happening?
(Set-ExecutionPolicy -Scope Process -ExecutionPolicy RemoteSigned) ; (& c:\Users\myself\OneDrive\Desktop\mypp\app_env\Scripts\Activate.ps1)
Please ping on reply
also why the heck does the iso not make C an open standard 😡
$$$
windows' security feature, it's normal
I was just worried by this part (Set-ExecutionPolicy -Scope Process -ExecutionPolicy RemoteSigned) ; ty
How did you get that?
I don't know
as opposed to the Windows vulnerability feature suite
it wasn't always like that
it sets execution policy to allow running programs that are signed
huh?
called Microsoft Copilot
well it was always like this on windows for me
"imma make my own c compiler!"
"alright, what is C exactly"
"why do i have to pay USD$290 to find out what C is
"
"alright i ain't gonna make a compiler"
i bet this kinda process happens fairly often
There are open final drafts
anyone who is able to write their own C compiler would likely have... other methods
Vscode extension, I also have that
Running scripts is turned off in Windows by default
That allows local scripts only in that one specific terminal, to give it permission to run the activate permission for Python, then everything goes back to normal when you close the terminal
are there open changelogs between the publication and the final draft though
What extension?
I mean it would not (Set-ExecutionPolicy -Scope Process -ExecutionPolicy RemoteSigned) ; have this part but I opened the app after a while and it does it now.
Idk ;--;
this runs automatically?
yes when I open powershell
Im afk I can try to look which extensions I have later
do you have an extension named code runner by chance
It sets Windows to allow local scripts that are not signed
But remote scripts are still on the default requiring signatures
that sounds like a CVE waiting to happen
That’s my guess
I’m really confused what extension thinks it’s okay to set the users execution policy for them
just checking
Nope I don't have runner
How did this happen
windows port of pyenv, idk its fine im just going to use the most recent python
im unfamiliar with this stuff so might as well
can always downgrade in the future
You should always the use the latest and only look at something else if you have problems
does this occur only when you open powershell within VSC, or also when you open it externally
the quant firms are going to upgrade
just vscode
true, but i think most are on that exact version rn
as opposed to what else?
are you looking for a job there right now?

uv seems to hate kat for some reason, but it seems fine for everybody else afaik
Nothing else even comes close right now
idk pyenv or whatever
Have you asked what kat did to it?
pyenv/pip/pipx
interning soon, trying to get practice environments setup alongside my own settings and such so I can get more familiar with everything ill need
the stack
ran uv init somewhere on D:
Its just in vscode powershell should I be concerned?
they will have their own onboarding process
Pyenv installs Python
What about everything else that uv does?
just use pip, venv and /usr/bin/python3.xx
dont worry about that
joe suggested pdm for kat
pyenv can basically replace venv
pip & pipx
pdm
PDM is the main competitor
Hatch is becoming okay
you're right
thanks for your help
Poetry still in the toilet only for devs that hate their jobs so they can say “waiting on the lock file” while it takes 30m to generate
but why
but how
You’re gross
:(
Mom! This guy is scary!!
net negative
Nevermind I solved it
What was it?
What did you see!?
I accidentally typed 2 things at once I delete the up and down arrow text memory and it went away
huh
Nope it came back
Yeah its a extension or something
Let me list every extension or something I am worried
C/C++ related
C/C++
C/C++ DevTools
C/C++ Extension Pack
C/C++ Themes
CMake Tools
General / Web
Live Server
Python related
Pylance
Python
Python Debugger
Python Environments
It seems ai written because I took pictures and you can't upload them so I just asked the ai to type them
code --list-extensions also works from a shell
apparently this requires an external shell.
somebody on so lied 😡
Whats an external shell?
is vsc on PATH automatically?
powershell, bash, command prompt, etc, but excluding the integrated one that's inside VSC
i made a master piece
@fiery yarrow
Also when I click on powershell highlight it I get
powershell
Process ID (PID): 11508
Command line: …\powershell.exe -noexit -command 'try { . "c:\Users\user\AppData\Local\Programs\Microsoft VS Code\560a9dba96\resources\app\out\vs\workbench\contrib\terminal\common\scripts\shellIntegration.ps1" } catch {}'
Shell integration: Rich
Does this contain any senstive data?
import random
x=random.randint(1, 6)
if x == 3:
print("you got three")
else:
print("you did not get 3 better luck next time")
Hey @half cradle!
```py
print('Hello, world!')
```
This will result in the following:
print('Hello, world!')```
i put my blood sweat and tears into this
the envar window tells me the user path includes C:\Users\[me]\AppData\Local\Programs\Microsoft VS Code\bin, presumably placed by the installer
ah OK
also why is nearly every single program afraid of using % variables for paths
So everything is okay? I am still confused why it is happening. It happens whenever I open a folder in vscode
just same env I would have to try a different env
@sage mural it seems to be python enviroments extension
when I disabled the auto run script removed the policy thing
YEAH
ah, python environments. an extension forced upon users, hated by many, and so eager to break stuff.
lasted on my computer maybe 20 minutes
@charred tusk
Microslop is doing the venv activation thing
> (Set-ExecutionPolicy -Scope Process -ExecutionPolicy RemoteSigned) ; (& ...\.venv\Scripts\Activate.ps1)
https://marketplace.visualstudio.com/items?itemName=ms-python.vscode-python-envs
Okay I worried
sorry about that Ty everyone I just never seen it before until a few days ago
If u never used this extension just disabled it like I did >:3
I use venv
tbf
they added this policy to powershell themselves
I'm feeling like an idiot this morning.
The docs for input() say it writes its prompt to stdout.
My testing shows it writing to stderr.
Running interactively, it writes to stdout.
I'm debugging a module which writes "live" status lines, and they go to stderr. So I've got 2 ttys, and I'm sending stderr to the second one so I can do things in the first without affecting the display.
So to exclude my module, I'm running this:
#!/usr/bin/env python3
input("input 0: ")
and to exclude my shell aliases and other gunk I'm running this:
/usr/bin/python3 indemo.py 2>/dev/ttys031
The "input 0: " prompt shows up on the other terminal, which is stderr. Gah!
But interactively:
$ /usr/bin/python3 2>/dev/ttys031
>>> import sys
>>> print("other tty", file=sys.stderr)
>>> input("input 0:" )
input 0:xx
'xx'
>>>
which shows the puython header on the other terminal (surprise!) and also the print to sys.stderr on the other tty:
Python 3.9.6 (default, Aug 8 2025, 19:06:38)
[Clang 17.0.0 (clang-1700.3.19.1)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
other tty
but is pretty clearly doing the input() prompt to the main terminal, aka sys.stdout. As expected.
WTF?
this might help you: https://discuss.python.org/t/input-prompt-doesnt-always-go-to-stdout/106581
Can we fix input()? I was surprised and baffled when I went to debug and turned on verbose logging.DEBUG output so I could trace the flow post mortem. The application seemed to hang because an input prompt ended up in the log instead of the terminal. On Linux and Mac I found the behavior to be: stdout redirected? stder redirected? readlin...
whoa boy, does that ever seem like a bug
I think that the prompt should be written to terminal (this is already so on Windows). If only one of stdout or stderr are terminal streams, it should be chosen for output
That's... interesting. I don't think I agree, but it's interesting...
It's a huge bug. There's always been tension between where the prompt (in programmes in general) should go and where it gets sent. Personally I'd often sent to stderr because my programme's output might be going to a pipe or file or whatever - don't want a "plug" bug.
But the docs should be explicit about what it does, or clear that the behavour may vary, and frankly I'm very much for giving it streams for the input and output, like print's file=. To give precise control when precise control is wanted.
Oh, I don't like that much - I don't really like programmes having too much wired in "policy", or at least policy complexity.
I'll roll my own, just print/input(""), for now. But ugh.
is there a general channel??
or a promo channel?
I have a friend who is making a game, but wants to promo his server so that he has more people for launch day
the only kind of promotion permitted here is of open source Python projects, in #1468524576479641744
wrong server, I thought this was Pygame
best modules for nice n simple terminal ui / interface
I use print… you can do ui in the terminal?
!pypi textual
PyInquirer
textual or batgrl https://github.com/salt-die/batgrl
What’re you, Sherlock Holmes?
:3
!pypi PyInquirer
no i mean like these raw classi style ones like one i made , wanna see it ?
textual looks so good
I wonder how many environments actually bother to sign their scripts.
scratch/software/excel/quote-csv.ps1 line 1
Import-Csv .\file.csv | Export-Csv .\file2.csv -NoTypeInformation -Encoding UTF8```
Free and clear
No pesky signatures required
You can just use it
No paperwork required
It is good.
There's always paperwork.

.topic
Unpacking nested dictionaries.
magic functions that go over nested things and produce some kind of value from it
What kind of magic functions are you talking about?
TBH I primarily use recursion for AoC.
You’re still in school?
guys it is not time to make hack the iran
I use recursion all the (I use recursion all the (I use recursion all the time) time) time.
this doesn't sound like a good topic
Have a beautiful day
it also doesn't really make sense
For $WORK I do commercial printing, so I work with gigantic machines that needed a dedicated file for each color.
$BIGGESTCLIENT’s system has them upload a zip of all the individual per-color TIFF files, and a preview JPG.
When we click download it zips them together to download a single zip, creating the nested zip.
That's what TAR is for.
ew
forget not the feathers
Unzip them and tgz them.
Windows couldn’t do tar until this year
flew too close to the sun
Even on Windows.
Yeah but Pillow keeps fucking up the images
That's why Thuri said to remember the feathers.
beeswax
well no wonder it failed
But you can unzip them all and then make a tarball for transport/storage.
Try explaining that to users
i was referring to the tarring and feathering, rather, a more macabre reference
I mean, tarfile is fun when you play with it in-memory
I know. But it played well into Icarus.
why didnt daedalus use superheated carbon-carbon composite, is he stupid
RCC is hella brittle ya know
i cannot hear you over this solar wind
go to the spaceclothing store and spacebuy some windbreaker spacepants i guess
buy a parka
the same one they used on the parka space probe
We've kinda jumped the shark.
investigating the fabric of spacetime
fabric.... make some close....
.topic
Suggest more topics here!
Tooling.
Game dev
making terrible cli apps repeatedly because I don't know what to build
machine learning right now but I want to branch out into more actual python software instead of hacking away at ML/AI
came for the ML, stayed for the python?
Exactly! I came from a fortran/matlab/embedded C world and got wrapped into Python for the ML stuff for an applied math masters and just loved it
that's a very different world wow
I like that python is so easy to get started with, like matlab, but also this is free and way more versatile
And Python has a great community. Does matlab have a nice community?
I haven't met very many people from the matlab community outside of work settings but they seem nice
dont care as much about the language though
just a tool to get them from point A to point B, seems like python people care more overall philosophically and problem solving-wise
matlab's dedicated array elementwise syntax is kinda neat and sometimes i wish other languages supported it more
i actually used matlab over python for my qm classes
To quote Brett Cannon, "I came for the language. I stayed for the community."
it's just a lot easier when you only care about the results
How dare thee!
Seems like a good reason though, easier to do matrix computations and vectorize things
Not every language is suited to every task.
type hints for qm must be like
foo: Particle[¯\_(ツ)_/¯, ¯\_(ツ)_/¯]
hahaha
i want to learn qiskit
same, that sounds like fun. On my list once I finish my masters
I imagine the Maybe type comes in here somewhere a lot
Talk to ACE
doesn't look like a minecraft block to me
That's a nice saying. I've (we've) been burned by weak community many times.
🍿 watching the Ruby drama continue to unfold.
what's happening there? (I haven't followed the Ruby community in quite some time)
is ruby the place with dhh
The decided to go off the rails following the Shopify takeover. Let me find the post...
https://rubycentral.org/news/a-new-chapter-for-ruby-central/
Yes
Yes.
off the rails feels like a great pun
"We have parted ways with our Executive Director, our PR agency, our CFO, and concluded several contractor engagements." insane opener
i did not read that last word right
neither did I, and I was really confused for a second
DREAM stands for Driving Ruby's Evolution to AI Maturity.
Is also bad

As I said, "Ruby off the Rails"
No more Ruby
There is a reason for this message hidden within this message
dhh is the common name of a major ruby dev and creator of ruby on rails, who made a blog post about "muh immigrants are ruining the uk" that other rubyers weren't really fond of
Ruby getting railed
It's a nice little distraction.
oof
David Hamburger Helper
David Has Horses
Dog has no place in this material. They are Dog-forsaken at this point.
Imagine a language entire image being entitled to a framework made by a guy and he starts to talk shit
Dog here
Dog forsook them long ago
He looked at RMS and Linus and said, "Hold my beer."
Much the same.
use dataframes for that
Well, more to transform it to something more suitable for some other task.
Most recently my print_obj debugging function which tries to print nice nested listings of nested things. It calls printt (which prints simple tables) and uses tabulate_obj to construct the table, and tabulate_obj is recursive:
https://github.com/cameron-simpson/css/blob/a596f5859e248420fa8a8e7c0e8a5046285c3f6c/lib/python/cs/debug.py#L886
lib/python/cs/debug.py line 886
@ALL```
was just about to ask if there's something cheaper than pl/pd for tabulating data
My printt is for flattish text grids. Though it has a recent nested mode for indicating nesting.
.topic
I made myself an easier way to make UML class diagrams with Graphviz
using python to generate the dot file
Well, I got a longer term project where I’m making a game with some more complicated stuff, but I got a small project where I’m making a small td game
Just got bored amid my bigger one
giving bs4 and regex some actual attention, trying to hack a .gov website for their public access flat files
A setup for automatically laying out environment textures for 3d models!
(not breaking any rules, ftp is just blocked on my network)
And i forgot to say, calls pformat for nonstrings in cells.
How much of code of Discord is written in Python?
this article had the most information on this that I could find: https://elixir-lang.org/blog/2020/10/08/real-time-communication-at-scale-with-elixir-at-discord/
(I know it says elixir--it mentions how they use python in the article)
hello, I was wondering if u guys have any pdf books about python or sites that I could get resources from?
For beginners?
!learn
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!
Some of Al Sweigart's more advanced books are also free.
From peoples experience here, how long did it take you to become somewhat fluent in python? This means being able to solve rigorous problems with minimal to no help
define rigorous
I feel like the ability to solve X type of problems isn't really indicative of python fluency
the python rabbit hole is exceptionally deep, but I think you can get to a point where you consistently know what you're looking at in three months
Still learning. Everyone's jouney is different.
Well not per say rigorous but such that you know what you are looking at, ex you look at a random piece of code and be able to understand what’s happening rather than have no clue
what's python (/jk)
I see
Well that depends on the code, there's some really confusing python code out there
it took me somewhere around 6 years, I'd say. Python was one of my first languages, I never really learned it very well, and I went back to it much later after learning many other languages
I remember having a lot of trouble wrapping my head around references and deep vs shallow copies the first time around...
To be actually comfortable turning ideas into code, it was at least a year, but that doesn't necessarily mean I was writing great code
I see
I see
I look back at code I wrote years ago that's pretty bad, but also got the job done so I guess it was good enough at the time
Code that works is what is needed.
I get to see code I've written 2-6 years ago now running in prod. Makes me wince, but I can't argue that it works.
i find the VS code so confusing to use
Do you still struggle with the syntax?
i have no idea why python does deep and shallow copies until i learnt about references from other languages
hello beautiful people!
Not as much anymore I watched and practiced using a bunch of yt tutorials to begin, and now I’m doing cs50p
Started learning about descriptors.... just last night. I've been pythoning for many years.
So you can write conditions, loops, functions, classes, etc, without reference?
I can write all of those without reference but like the bare basics of each
I still struggle with a lot of dunder methods etc
if you're reading other code and not understanding, it should be an issue of "I don't know why they wrote that" and not "I don't even understand what that line is doing"
You're not obliged to use it. (Or are you?) I find it confusing.
I see
Im hoping cs50 clears up any confusion i have I’ve heard good things
well i used to use IDLE but i have been trying to use the Visual Studio Code these days
it sounds like you're at the point where you just need to be building your own projects, not trying to use more tutorials
if you know all the syntax, then just start coding
I still have some confused on oop but I’m just gonna grind through cs50 first
I’m on week 3 I been doing a week per day
you should be doing a week per week
you're doing the problem sets too, I hope?
it's not a race
Yes
I just got a lot of free time
your goal now should be to write as much code as possible. Solve problem sets, write toy code, build projects, etc
yeah, same. It was really hard for me to understand. tbf, I think Ned's names talk really helps people learn it now! I learned before that existed, haha
how do i end a program when a certain condition is met in VS code i tried 'breakpoint' but it doesnt work
Where are some places I could practice problem solving
Are there places where I can get project ideas
I recommend codewars and advent of code for problem solving
Go and solve dozens of problem sets, you will improve much quicker than watching more videos
breakpoint() stalls a program and drops you into the debugger to see what's going on.
sys.exit() will abort the whole programme.
Usually we try not to do that - we just can the work to be "finished". Exit the loop or whatever.
!kind
The Kindling projects page contains a list of projects and ideas programmers can tackle to build their skills and knowledge.
depends on how you've structured the program, but look into sys.exit
breakpoint is really for debugging, you shouldn't use it for exiting or such
it doesnt work
never just say "it doesn't work" when asking for help. describe what you expected and what happened instead.
but when i add 'break' it still doent work
But ideally, pick something small which could do with being solved for you.
Ty
Is there are good LLMs or ML algorithms for trading and all that or is that too advanced for LLMs right now? I just got into ML and feel it could be a good tool for trading, but I'm also ignorant in the space right now
It's not magic. Turn the question on its head: why does the programme keep running? Change that.
its a number guessing program and i wanted that the program should end when i have guessed the number
guessed = False
while not guessed:
.........
if guess == answer:
print("well done!")
guessed = True
So when the guess is correct, set a flag to say so. Make the while loop honour the flag.
@swift sparrow another question is sometimes I find it difficult to understand python documentation, how this you get past this barrier
the deck is stacked against retail investors. Institutional investors will eat your lunch if you try clever trading algorithms. Any strategy other than buying a diverse set of instruments and holding is basically just gambling
Do you have an example of something you're looking at now that you don't understand?
I’ll just pull up an example wait
reading the docs as a beginner requires you to be able to ignore things that aren't relevant to the problem at hand
simply raise SystemExit exception. it should propagate throughout.
either manually raise
raise SystemExit
```or simply use the function `exit()`
```py
exit()
though conventionally, you'd want to have a more specific error/reason for terminating the program early.
or alternatively, wrapping the code in a function block, then skip/quit only that part of the logic.
don't try to understand everything just yet. focus on extracting useful information.
Yeah, a lot of it requires you to have the full programmer vocabulary
i am using 'for' when i did the code in IDLE it worked as i hoped but in VS its not doing the sam eoutput
so if there's words you don't understand, it might be worth following that rabbit hole to learn the terminology
They really ought to behave in essentially the same way. We'd need to see the specific example.
Well python code should work the same no matter where/how you run it. Maybe open a help thread in #1035199133436354600 and share some screenshots
IDLE doesn't have the greatest ergonomics for nested blocks -- probably something to do with that
How long would you say this took you?
That’s probably a huge obstacle for a lot of ppl starting out im guessing
what even is "full programmer vocab" though...
yall need to containerize your apps
its more smoothie if you do docker compose watch
I still see words I don't understand 😅
To a degree. But you can pick things up incrementally.
hot reloading all ur stuff together
lol yeah exactly
just use a terminal and docker compose, even if it's just tests for a script in a container*
oh nvm i fixed it myself
this really helped me thanks
this varies a lot, depending on which resources you use, how much you talk to other programmers, etc
I see
repr(object, /)¶
Return a string containing a printable representation of an object. For many types, this function makes an attempt to return a string that would yield an object with the same value when passed to eval(); otherwise, the representation is a string enclosed in angle brackets that contains the name of the type of the object together with additional information often including the name and address of the object. A class can control what this function returns for its instances by defining a repr() method. If sys.displayhook() is not accessible, this function will raise RuntimeError.
This class has a custom representation that can be evaluated:
such as something like this
I have no idea what’s going on
i formed sentences and i found that i used break earlier so it made the program not continue then i added break after the condition is met and so when the condition isnt met the python reads from above again
Well, break it down. What don't you understand specifically?
Do you know what a string is? Do you know what an object is? Do you know what printable means?
Yes
let's try and extract useful info for this example. to begin with, was there a specific reason you went to repr's doc to begin with?
whats an object
any piece of data in python is "an object"
123 is an object. "abc" is an object. True is an object
oh ok thanks
I was just pulling up an example that looks foreign to me since fashoomp was asking what something confusing looks like
"object" is just a fancy word for "thing"
Yes, but we need to pinpoint what you do and don't understand. That's how you should approach programming problems too
if you've learned what data types are, then objects are just the things that have those types. "hello" is an object whose data type is str, 123 is an object whose data type is int, etc
Is the best way to learn by just testing different functions out in an ide without knowing what exactly they do
OK. did you read all of it? surely you got at least something from it, can you try to say what you think repr does?
but also types are objects 😅
yes, but we probably don't need to get into that now 🙂
Not always, documentation exists to tell you what something does
Return something in a string?
how can i edit my VS code layout so that the place where i put codes comes on left and the output screen comes on right
there's a bit more to it than that
yep. can you, by reading the docs, refine that "something" into more concrete terms?
can you tell us what part of the repr documentation you don't understand specifically? Any words you don't understand?
I remember struggling with repr but it was more of a "I don't understand why we would use this"
It's a good way to get a feel for a particular function.
just trying things in a REPL is underrated. but you should learn to read docs, so this is not a substitute.
Eval but I guess that’s something I have to learn
eval simply converts a string into actual code
At the end it’s saying that I can modify what repr returns by defining this method? Which I’m guessing is some kind of dunder method
so if I had a string "1 + 1", python could evaluate it and return 2
yes, __repr__ is the dunder method
A class can control what this function returns for its instances by defining a __repr__() method
Return a string containing a printable representation of an object.
do you understand this sentence?
I know what those individual words mean I’m just having a hard time understanding what that sentence means
I understanding everything other than printable representation
"printable" just means what it literally says -- "can be printed"
A dict (for example) is a data structure. But to look at it we want some text which describes it. That's a "printable representation".
"representation" is more abstract, and hence perhaps tricker. the string that is returned represents the object in some way. as in, it gives you information about the object and the data in it.
class Car:
pass
car_object = Car()
print(car_object)
do you know what the output of this program will be? What happens when we print custom class objects?
can i change the output of how i want it like i earlier made a game and the output seems very congested
You can do whatever you want 🙂
It just prints out main car and bunch of characters
I might be wrong
but how do i do so that it prints from a new line or after some spaces the output rn is :
pokemon game
charizard
pikachu
scizor
press enter to continue
missed
enemy HP: 100
dmg dealt 6
player HP: 94
press enter to continue
dmg dealt 14
enemy HP: 86
dmg dealt 50
player HP: 44
press enter to continue
missed
enemy HP: 86
dmg dealt 17
player HP: 27
press enter to continue
dmg dealt 28
enemy HP: 58
dmg dealt 44
player HP: -17
you lost
That's correct, but it's also not very useful information
!e
class Car:
pass
car_object = Car()
print(car_object)
:white_check_mark: Your 3.14 eval job has completed with return code 0.
<__main__.Car object at 0x7fd575f7c6e0>
for understanding repr, it's probably best to just look at examples
like the one I'm about to show 🙂
if we want to control how our custom object is printed, we have two dunders we can use
__str__ and __repr__
I see
!e
class Car:
def __str__(self):
return "A shiny new car!"
car_object = Car()
print(car_object)
:white_check_mark: Your 3.14 eval job has completed with return code 0.
A shiny new car!
simply by defining __str__, we have overridden how our object is displayed when printed
I see
but, this isn't always the case
__str__ is only used if our object is printed directly
but, if our object was contained inside something else, like a list for example, it reverts back to the ol' memory print
!e
class Car:
def __str__(self):
return "A shiny new car!"
print([Car(), Car(), Car()])
:white_check_mark: Your 3.14 eval job has completed with return code 0.
[<__main__.Car object at 0x7fa02a1786e0>, <__main__.Car object at 0x7fa02a170550>, <__main__.Car object at 0x7fa02a170690>]
we can actually see this happening with the string class too
!e
print('123')
print(['123'])
:white_check_mark: Your 3.14 eval job has completed with return code 0.
001 | 123
002 | ['123']
ever noticed how strings don't display their '' when printed, but they do when they are inside a list?
Yea
that's because we are seeing the repr of the string here
I see
!e
text = 'abc'
print(text)
print(repr(text))
:white_check_mark: Your 3.14 eval job has completed with return code 0.
001 | abc
002 | 'abc'
a common way to think about the difference in __str__ and __repr__ is that __str__ is for the user, and __repr__ is for the programmer
Oh I see
let's look at an example of a slightly more detailed class
!e
class Card:
def __init__(self, rank, suit):
self.rank = rank
self.suit = suit
def __str__(self):
return f'{self.rank} of {self.suit}'
card = Card('Ace', 'Spades')
print(card)
:white_check_mark: Your 3.14 eval job has completed with return code 0.
Ace of Spades
when printed, this card just shows a simple print about our card's rank and suit
Yep
but if that was printed in a list, it would be super confused
[Ace of Spades]
if this was my output, well what am I even looking at?
I want to know that I have a list of "card objects"
so this comes back to the eval note in the docs
in __repr__, we typically want to return a string that could eval back into our object
Card('Ace', 'Spades')
in that case, this is how we created our object
so the returned string would look something like
"Card('Ace', 'Spades')"
but, we want it to be able to display whatever its actual rank/suit is
!e
class Card:
def __init__(self, rank, suit):
self.rank = rank
self.suit = suit
def __str__(self):
return f'{self.rank} of {self.suit}'
def __repr__(self):
return f'Card({self.rank!r}, {self.suit!r})'
card = Card('Ace', 'Spades')
print(card)
print([card, card, card])
:white_check_mark: Your 3.14 eval job has completed with return code 0.
001 | Ace of Spades
002 | [Card('Ace', 'Spades'), Card('Ace', 'Spades'), Card('Ace', 'Spades')]
so now have a look at the difference between how our object looks when printed directly vs. how it looks when contained in a list
Much more useful to us as the programmer to see what we have
I see
Thank you for coming to my TED repr talk
Np lol tysm for helping
np! Ultimately it's really up to you how you want to visualize your instances
but those are the rough guidelines to keep in mind
if you only have __repr__ and no __str__, then __repr__ will be used in place when printing the object
(I do think rusts naming for the same concept gives a much clearer distinction here as well, they call it Display and Debug)
Because both str and repr return a string that's a representation of the object :/
-# age is just a number, unless you define it as a string
ts not tuff vro
but what if you define it as a char, then it would be BOTH a number and a character
you cant define ages with two digits in a single character 
⑲
are there unicodes with all double digit numbers ?
isn't ascii code covering that?
btw age is a word and not a number
number is a word
34 you have two charaters , 3 and 4
Just use ". See https://www.asciitable.com/
💀 , you have to store the numberes as characters , not have a character with that value
only up to 50
mmm
but what if my great-great-great-great-great-great-great-grandma is 256 years old
I can define ages as a byte. I don't need multiple characters. How you display it is different from how you store it
You meant she is 0 years
we are talking about different encodings though and if u try to store an age as ASCII characters , for double digit ages you would need 2 bytes , one for each digt
Why would I need 2 bytes when I can store the age in a single byte?
because thats how you store ascii text
actually she is NUL years old
so your premise is you store the age as a string and nothing else
I'm End of Transmission Block years old
thats what the convo was , yes , not raw memory
sure you can fit upto age 256 in a single byte , assuming a byte is 8 bits
but thats not what we were discussing 🤷
what would it mean to have negative age 
you mean 255?
unborn nephew is 255 yea-
dammit recursive
technically correct is the best kind of correct
though now, I want to define age as a system of equations
Hi everyone, I'm new here.
I just joined, because i got curious about learning python.
hello
I have no programming knowledge. Where do I start?
!learn
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!
Cool! Thanks!
ooo I just got an acceptance letter from the University of Wisconsin-Madison! Idk how cracked the school really is, nor if I wanna go there but I'm happy cause the campus is awesome 🏌🏼♀️
Hello 👋🏻👋🏻
I have made this exciting project using python
CV vision Car Game 🎯
How did you do it?
wdym by how ? by his brain ofc bro
maybe a vibe coder
People have already built it, I guess.

I’m importing os and my terminal won’t display color
Do you mean your terminal can't display colour, or you expect colour and it's not showing up?
I expect color
The os module doesn't provide any colour features.
So, what're you doing which should be coloured.
I would told os.system(“”) is a ‘fix’ for terminals that don’t display color
Yes
The empty string?
Yeah
os.system passes a command to your shell to be executed.
Passing "" should do precisely nothing.
😭
u want colorful terminal text??
There are escape sequences which render text in colour honoured by most modern terminals. See:
https://en.wikipedia.org/wiki/ANSI_escape_code#Colors
ANSI escape sequences are a standard for in-band signaling to control cursor location, color, font styling, and other options on video text terminals and terminal emulators. Certain sequences of bytes, most starting with an ASCII escape character and a bracket character, are embedded into text. The terminal interprets these sequences as command...
wait
i have an old prohect doing that lemme open and give u easily
There are python packages for rendering text in colour.
here's some example code of mine i use for colour: https://github.com/cameron-simpson/css/blob/main/lib/python/cs/ansi_colour.py
There are packages like rich etc on PyPI fordoing more versatile things.
Package..?
!pypi rich
Things you can pip install
Oh
py -m pip install rich
What’s the different between pip3 and -m
@rapid mulch Colorama is easier
from colorama import Fore, Back, Style, init
init(autoreset=True)
print(Fore.RED + "Red txt")
print(Fore.GREEN + "GREEN txt")
print(Fore.WHITE + Back.RED + "white txt in red bg")
!pypi colorama
I’ll look into both of these later
Rlly bad mindset if I wanna learn something new rn
pip3 runs pip using whatever python it was associate with.
py -m pip runs pip with the python associated with py, which should be your python
from colorama import Fore, Back, init
init(autoreset=True)
print(Fore.BLACK + Back.CYAN + "testing")
look how simple it is
We recommend the -m pip incantation.
just import fore, back and init for this. autorest means ur resting terminal color to default after changing color and printing. after this u print with Foreground color and bg color with ur text. isnt that simple
Style isnt needed my bad. ihad it in my project imports ad forgot to delete it
What o was planning to do was have a color dict with “red”: “\033[91m” so I can use it in methods
you can do that too but colorama is simpler
Works well. You can see an example of exactly such a dict in the ansi_colour code I pointed to above.
