#python-discussion
1 messages · Page 93 of 1
Most frequent starting point (besides learning the language) is: seek community. Here I am....
Put what you study into practice asap
Do a lot of projects
Super simple ones to begin with, and gradually increase the complexity
Ask for help here if you get stuck or lost
class ASSET_PATH:
@staticmethod
def get_absolute_resource_path(relative_path):
try:
base_path = sys._MEIPASS2
except Exception:
base_path = os.path.abspath(".")
return os.path.join(base_path, relative_path)
class IMG:
class LOGO:
GUI = get_absolute_resource_path(...) # get_absolute_resource_path is not defined
please help
IDK why it thinks it is not defined
I defined it on top
Why are you declaring classes inside other classes?
Because the function is only used within this class and never anywhere else.
Grouping stuff that belongs together is less noisy.
I'm not sure what you're trying to represent here, but an inner class has no direct access to an outer class.
ASSET_PATH.get_absolute_resource_path will only be defined once the class definition is complete. I'd just take it out of the class and make it a standalone function.
Even if it was, you couldn't call it like that, could you?
You have levels of nesting classes. That's not normal. Logo logically should be a child of Img, not class inside a class. And getting paths for separate resources shouldn't be in separate classes at all, unless those classes also represent those things.
class ASSET_PATH:
class IMG:
class LOGO:
@staticmethod
def get_absolute_resource_path(relative_path):
try:
base_path = sys._MEIPASS2
except Exception:
base_path = os.path.abspath(".")
return os.path.join(base_path, relative_path)
GUI = get_absolute_resource_path(...) # get_absolute_resource_path is not defined
This would work
yep, fixed it 🙂
But I want this function to be accessible in the whole class.
Not just subclass.
which function? If that's what you want, make it a top-level function
sigh
let's step back: why have classes nested three deep?
I think nesting classes like this is a very strange choice, yeah.
we are trying to help. let's keep talking instead of mocking each other.
that is a lot of nesting
Ty, I am super new to all this... 3 weeks new. By "do a lot of projects", you mean make many simple programs, correct? I have been doing exercises and tutorials on sites like genepy and freecodecamp and exercism but just kind of feeling lost as a self teacher. Am I on the right path? Using Python Crash Course (3rd Edition) as a learning resource.
Doing exercises is good, sure, but I also mean actually building applications.
You'll have to start simple, but you can work your way up.
nothing against you, its just more often than not I ask a specific question and get a workaround that has nothing to do with my question, also a workaround that is obvious to everyone
have you worked in other languages? This kind of nesting is very very unusual in Python and will be difficult to get to work the way you want.
import os
import sys
class ASSET_PATH:
class IMG:
class LOGO:
@staticmethod
def get_absolute_resource_path(relative_path):
try:
base_path = sys._MEIPASS2
except Exception:
base_path = os.path.abspath(".")
return os.path.join(base_path, relative_path)
GUI = get_absolute_resource_path(
"."
)
logo = ASSET_PATH.IMG.LOGO()
print(logo.GUI)
``` This seems to work for me at least.
My initial question was about:
class ASSET_PATH:
@staticmethod
def get_absolute_resource_path(relative_path):
try:
base_path = sys._MEIPASS2
except Exception:
base_path = os.path.abspath(".")
return os.path.join(base_path, relative_path)
class IMG:
class LOGO:
GUI = get_absolute_resource_path(...) # get_absolute_resource_path is not defined
what about now I mean descriptions only?
working on other next(like input etc)
https://grzesiekmq.github.io/algo-playground/
I wrote this to prove that it is possible.
is the question "why is it undefined" or "how do I fix it"?
does now descriptions more clear, unambigous, logical?
You still have this: "A sequence of mana crystals regenerates each turn. Calculate the total mana collected after 5 turns." I don't know what that means.
Yeah, alright, so for one thing you need to access get_absolute_resource_path through ASSET_PATH because inner classes can't access outer classes implicitly, and secondly like @unborn lagoon said, you can't call get_absolute_resource_path while ASSET_PATH is being initialized.
I am trying to fix it in a way >>>>>>> that preserves the structure <<<<<<<.
So defining get_absolute_resource_path in the root of ASSET_PATH and using it in subclasses such as IMG.LOGO.
So this would work:
import os
import sys
class ASSET_PATH:
@staticmethod
def get_absolute_resource_path(relative_path):
try:
base_path = sys._MEIPASS2
except Exception:
base_path = os.path.abspath(".")
return os.path.join(base_path, relative_path)
class IMG:
class LOGO:
GUI = ASSET_PATH.get_absolute_resource_path(
...
)
Because ASSET_PATH finishes initializing before you call the static method.
guys are there any reputable jwt/jwe libraries that support both encryption + signing ?
I don't know how to make that work. The name get_absolute_resource_path isn't in scope where you are trying to use it. It can't be accessed by the class name, because the class isn't created yet.
so you need to change the structure somehow.
oh ok
@exotic tundra can you say more about why you want IMG nested inside ASSET_PATH? I would think the class AssetPath would be just about path names, not involving Img. I could see Img making use of an AssetPath class.
!pypi pyjwt
there's this for JWTs
If it can't be done I guess I have to define the function before defining the class, I dislike that because I can't group it together even though the function is never used outside the class.
Thanks anyway
only supports signing
!pypi authlib
in my opinion, it's fine to define functions outside a class even if they are only used inside the class. Especially in this case: the reason the function is only used inside the class is a coincidence, it's not about the tight coupling of the class and the function. Your code could evolve in the future to use that function from other classes.
where did you read that?
Imagine you had a program that only used len() in one place inside a class. That doesn't mean len() should be defined in the class.
Thank you.
so i was seeing a video on people's opinions about copilot today
and apparently some people also think LSPs are bad?
for learning
why do they think that?
i think the idea is that it means you dont have to go perusing docs as often
auto-completion is convenient, but can also mean that you don't bother to read docs.
I'm not sure where on this page you read that it doesn't support verifying signed JWTs?
mhm yeah
exactly. So you don't find the nuances between methods, you can just grab the one that sounds right.
i meant it does not support encrypting not that it doesnt support verifying
Difference between Copilot and autocomplete is that you can't ask autocomplete to find foo, you find foo.
And LSPs would find things that you'd find when running the code anyways (you'd find them before though).
I don't understand what you're saying
jwt.encode is signing, jwt.decode is verifying
if you meant JWE, that's not supported by PyJWT, no
for that, see the authlib library I linked above
it is interesting cuz i clearly am just not using my LSP properly then since i gotta open docs every other time i import smth im not fully familiar with
whats the idea behind why it means you dont read docs as often?
the docstrings from the LSP?
theyre not all that helpful
I think by LSP you mean autocomplete, btw. LSPs do a bit more than autocomplete.
i need both, the joserfc library from authlib looks fine
nono i mean the whole thing (at least as far as i understand it)
doc strings too are kinda convenient
but i still need to go see docs
It depends a lot on the package you're using. Some have good docstrings, some have not so good docstrings.
i freaking forget some of the library functionality a bunch of times and have to look up what method im even searching for
hmm sure i guess
ive just never heard the idea that LSPs are bad for learning before so i find it interesting
i grew up on no autocomplete cpp-
it was hell.
then no autocomplete c# cuz i couldnt get intellisenes to work on my VS (for unity)
not good times
hey can anyone help me with something
ty
I'm not sure what the issue with not reading docs would be.
dont ask to askkkkk 😔
less suffering in the world. /j
If I find a function through LSP that looks like it does what I want, and I use it, I'm not just gonna leave it there and forget about it, I'm gonna actually run my code and see if it does what I want as well.
some docs can be really nice i like reading them
things like numpy and pandas are great
i mean of course they are
i only know stuff like logspace limspace and whatever else
i got no idea what dimensions were
the docs probably have some precautions and edge cases that are not obvious when you run the code in your environment on that particular test case
(unless you mean that you read the LSP-provided docstring instead of the external docs)
It's a fairly purist perspective from what I gather. I have held it previously on the basis that it's a "crutch", but I don't believe that anymore: it's not beneficial to limit yourself like that.
I see. Okay.
I mean, I'll read whatever is easily available. And ok, sure, maybe it's hypothetically possible that I introduce a bug that way. But that's just one of the thousands of bugs that I've introduced in my day, and it's typically not the end of the world, and development time is also a valuable metric to optimize.
do we have any copilot users in here?
Yes
Sometimes LSPs autocomplete random things you definitely should not use. For example, pyright still autocompletes typing.Iterator, typing.Callable and such, which are deprecated, and the only way to figure that out is to read the typing module documentation from time to time
how do you find it
It's easy, it's on the right
autocompletion is also how some people probably discover the _thread module that has methods that look like what you want
oh yeah apparently you should use collections.abc i think
yep
But nah, I use it a lot.
not if you hide it.
So I obviously like it.
oh no not the _thread module.
ive never used it and i kinda sometimes wanna 'just try' but im very heavily avoiding it lol
what's it like?
I mean, there are multiple ways to use it.
There's the autocomplete, ask and agent mode.
I'm hesitant about recommending it, because I think it can be harmful if you're not able to properly evaluate the output.
And while it works well for me, maybe it won't for a more inexperienced user.
how do i install python on a linux machine?
But the autocomplete in particular saves me a lot of time, because it often guesses what I want to write and spares me from having to type it out manually.
Probably through the package manager.
a recent version should already be installed
apt-get install python.
is apt on fedora?
actually just apt install i think idk what the fuck apt-get is
though pyenv is usually recommended to manage multipel Python versions
Maybe don't throw out random recommendations when you don't even know what dist they are using.
apt is a user-friendly interface to apt-get
it was mostly a joke okay. hence the bold.
(sorry meant to reply)
but yeah through the package manager.
im tryna remember my package manager lol
or i think python's site does have downloads
dnf
yeah thats it
But did you check if it's already installed?
No, I mean
i mean it could be but its prolly not Pithon
Python
and you should go get pithon because yes
hmm let me check
they don't need to use the latest version
do a which python
Apparently there's people literally forgetting syntax in languages they know well but isn't their primary
that happened before autocomplete was a thing too
which sounds really concerning lol
turns out it does come pre-installed
yeah it's not inherently concerning it just concerns me a fair bit
i mean i just posted like yesterday here about how i put a colon into a c program because ive written exclusively python for so long
but its different than if i do write the language relatively often but just let autocomplete do the thing
mhm yeah it prolly does
I mean, I forget things in every language I use all the time
I just look it up again
if you wanna play around with stuff, you could get the latest one.
i think knowing what things there are and how to use them is more important than remembering the exact name / casing of functions
I think the difference here is between looking it up and not even realising you dont know the syntax until you dont have copilot on and youre lost now
which apparently is a thing
again, never used it, so idk
Sounds like a vague and very hypothetical issue
But it's probably a good idea not to use AI too much when you're a beginner
Not for risk of forgetting but for not learning in the first place
I mean. Yeah maybe idk. I'm just basing this off the videos I was watching these past few days lol.
But I really don't have too much faith in those who do use AI when relatively new to coding
the argument that you have to remember syntax and do extreme measures like turn off LSP to do that is a little bit silly
you just get used to it the more you write
I mostly haven't interacted with enough entire newbies who use GPT and stuff but I kinda know a few and it's interesting
I have a friend telling me she didn't get past day freaking 1 (part 1.) of AoC because some nebulous bug about the end points which she couldn't debug and she asked GPT and it couldn't help too much either and she went and just deleted her code so she can't show it to me either-?
i think debugging is a skill, and gpt makes it really easy to not train that skill
It's interesting. Kinda weird.
This friend I think just had a bad day though.
ive been guilty of it too, where im over something so i just ask it to find the bug for me
Yeah, I think that's a concrete issue, if you become dependent on asking it for help and becoming completely stuck when it can't.
As opposed to learning how to systematically isolate the causes of bugs.
There's like a right and wrong time to make use of AI and a beginner won't know which is which.
But also she definitely isn't very used to coding I think?
Last year her code had some if boolean_value == True so hmm
is there a more efficient way to serialise/deserialise python classs? im currently using dataclasses and converting to a dict then json
pickle methinks
I don't think non-beginners check for equality with booleans lol.
pydantic?
!rule 6
don't advertise your LinkedIn posts
Are there any 'mathematical' invariants for IEEE 754-compliant float arithmetic?
fixed-width integers are just modular arithmetic, and bigints follow normal integer arithmetic
robustness strategies based on theology are pretty popular with floats
well, it is defined precisely, it's not like it's analog or anything
be aware, pickle is unsafe for untrusted data
pickle or pkl?
especially among those that work with GPUs and questionable SIMD instruction sets
i did something like this ||(i'm not even sure if it was good for my case but i get rid of to_dict& from_dict methods on every class)||
https://github.com/istyna/py-pletyvo/blob/main/pletyvo/internal/serializer.py
also python stdlib provide a way to handle this type of cases instead of external library that i used
https://docs.python.org/3/library/functools.html#functools.singledispatch
wdym by invariant?
what's the difference?
Is it me or is 'variant' the word of the year?
Everyone seems to be using it for everything.
(Or maybe I've been in a cave)
I see. some people use .pkl as the file extension for pickle files.
I know pkl as portable keyboard layout - a program made using autohotkey that allows easily mapping keyboard layouts... I think the layouts for it also used .pkl as a convention
all the usages i can think of are essentially just using the definition of the word
though there are quite a few
specifically "invariant" being used to for a quantity that doesn't change after you do something
i can only think of one context off the top of my head where i've heard the term variant
oh this is new
tfw metalanguage for config files
I do appreciate pkl for finally just making a hopefully sufficiently complex config language

Well, there's also modules and packages and other dependencies called Pickle.. So I was really trying to clarify if they meant a package or Apple's Pkl..
there are other modules in the Python world called Pickle other than pickle in the stdlib?
Hi guys, im a bit of a silly goose.
In terms computer science is 0 and 1 a Boolean or an integer.
My teacher and basically everyone known to mankind says it’s a Boolean however my friend is saying it’s an integer?
I’m a bit new to this and would like to know 🙁
There are also some in other languages, but yes.. https://pypi.org/search/?q=pickle
is there a particular reason they can't be both?
its mostly semantics. strictly speaking, booleans describe true and false values, so the most succint description is "boolean" but 0 and 1 are still integers.
yeah, they can be both
Yeah it’s an exam, what date type is 0 and 1
id go with boolean in this case
are you currently taking this exam?
@twin tree
I would not call 0 and 1 booleans. They can be used as a poor-man's boolean (and were in early Pythons). they are ints that can be used like booleans. Booleans are True and False.
But is a 0 not equivalent to a False?
You can also do
int main() {
int a = 1;
if(a) {
printf("It's true");
} else {
printf("It's false");
}
return 0;
}
This should print out "It's true" afaik
if the question is a Python question then i'd say 0 and 1 are integers, but if you mean CS in general im gonna say booleans.
Complicating this is that in Python, booleans are a subclass of ints, and True == 1 and False == 0.
but they really are just both
In terms of basic CS, 0 is a False and 1 is True?
But isn't 0 and 1 not considered integers unless it's directly specified that the 0 and 1 is bool values?
it's ragebait
0 and 1 are integers
bleh: ruff reformats fr"" to rf""
personally i wouldn't call 0 and 1 booleans in a general context, but in certain contexts i might use the symbols 0 and 1 to denote false and true
Yes, but both of those numbers are integers themselves - as ned states. It's just that "True" evaluates to 1, and "False" evaluates to 0... C is annoying..
The quotes might be around the wrong word
0 and 1 are considers as false and true, off and on, low and high by default.
How else are you going to uninstall the french language pack /s
imo languages having truthiness/falsiness doesn't mean that the integers 0 and 1 are booleans automatically
No.
But a lot of situations treat them that way.
0 and 1 are symbols, and without assignment nor clarification of programming language you can't say what they'll be interpreted as I guess?
something like that, yes
I'm prepared to accept them as numeric values (unless you're just talking about the glyphs), but that's it.
They are not Booleans of themselves.
not every language even needs to have a separate bool concept
aye
they need separate trools instead
maybe they're strings or chars
(e.g.: unityped languages like B and Brainfuck)
Thus the use of the word glyph.
C prior to C99 basically
yeah, I think it's valid to treat them just as their base glyphs when not given any context
especially if you wanna be not fun at parties
I don't need your leet extra skills to be no fun at parties.
bool is an int in Python purely due to historical evolution. Python used to not have bool, instead the integers 0 and 1 were used to represent false and true. Later bool was added, and the only way to add it in a mostly backwards-compatible way was subclassing int
True == 1 # True (why?)
True is 1 # False (i'm very confused)```
See fix error above.
is is about identity (address in memory, in CPython)
Consider type(1) and type(True).
== has an arbitrary definition
Different types, so cannot b the same object.
bool and int are not the same class. bool is a subclass of int
== in Python is sometimes overloaded to compare values of different classes, e.g. 5.0 == 5
i keep forgetting about this
in the last expression's case, what does python do? convert 5 to a float and check?
Just wait until you do this;
int main() {
int a = 1;
int b = 0;
if ((a ^ b) && (b % a == 0) && (a << b)) {
printf("It's true\n");
} else {
printf("It's false\n");
}
return 0;
}
And then it just says "It's true"
this makes is None good, because conceptually None is also falsey
Yes
promote int to float and compare.
.bm thanks
Presumably if the int won't convert to float (eg too big) the comparison fails.
is there a == between an int and a float that succeeds but shouldn't?
To be clear, that's not some special baked-in rule, that's just what float and int define in their __eq__ method. You could customize that for your own class
I think it just gives False
just trying to test that now ....
!e
print(0.0 == 300**42069)
:white_check_mark: Your 3.14 eval job has completed with return code 0.
False
yeah, thankfully it doesn't crash or anything like that
Which makes sense, cause it can't be equal to a float if you can't cast it to a float
!e
float(300**42069)
:x: Your 3.14 eval job has completed with return code 1.
001 | Traceback (most recent call last):
002 | File [35m"/home/main.py"[0m, line [35m1[0m, in [35m<module>[0m
003 | [31mfloat[0m[1;31m(300**42069)[0m
004 | [31m~~~~~[0m[1;31m^^^^^^^^^^^^[0m
005 | [1;35mOverflowError[0m: [35mint too large to convert to float[0m
does less than work?
As I hoped. False for the comparison, overflow for the conversion.
test it stickie
!e
print(0.0 < 300**42069)
print(0.0 > -300**42069)
:white_check_mark: Your 3.14 eval job has completed with return code 0.
001 | True
002 | True
!e
print(0.0 < 300**42069)
Forgot to print that
:white_check_mark: Your 3.14 eval job has completed with return code 0.
True
!e Here's some potentially surprising behavior:
print(18014398509481984.0 == 18014398509481984)
print(18014398509481985.0 == 18014398509481984)
print(18014398509481985.0 == 18014398509481985)
``` I would at least hope that Python produced a syntax warning on `18014398509481985.0`
whats 3.14j`?
:white_check_mark: Your 3.14 eval job has completed with return code 0.
001 | True
002 | True
003 | False
3.14 with JIT
o
Round off.
roughly ln(-1)
lol thanks
nice yeah that's what I was wondering
good PR for linters maybe 
silver lining of using the correct ln at least.
mfing math fellas using log for ln 
don't ln my log_e() smh
i would only use log if i needed to refer to the multivalued logarithm and a specific branch of the logartihm at the same time
(I can't remember what the actual is.. sorry if that's wrong)
me when the principle logarithm
My favorite thing about log is that you can make ln(x) == log(x) / log(e) iirc
what base is log(x)?
doesn't matter
any base works as long as it's a valid base
ah I see
*and as long as it's the same base
slightly widerly phrased, log_a(x) == log_b(x) / log_b(a)
why does that make it weird?
Not weird, but more expanded // clearly defined
widerly. as in more generally and not just with euler's constant
change of base is why people just write like O(n log n) without a base
because it doesn't matter

The general assumption is what the graph looks like. The base just changes the rate of change for said graph iirc
Whenever I hear something like that I lately just assume it's a real English word that's just not common, but this one actually isn't in Merriam-Webster.
lonelily is, though
I wandered lonelily, as a cloud.
A lone lily lonelily sat on top a lonely hill
@ daylily
there's nothing pingable there, shen
Felt
thanks
I really contributed to the conversation 
I mean, I was just talking to myself
It's been extra lonely here lately, trying to stay out of my head
Y'know, that could be good.. Or sleep. Sleep is good.
Already had 13h of it
I missed dinner last night
No idea
Started my laundry at 16:30, then flopped in bed to do some Discord on my phone, and the next thing I knew I was waking up at 05:30
so real
Passed right out
I wasn’t even tired (or so I thought)
I was hungry too
Dinner looked good, I’m upset I missed it
But I Uber Eats’ed burgers at 6am so that was fun
written like a poet
<@&831776746206265384>
!cpban 1449875724449222818
Could not convert "user" into UnambiguousMember or UnambiguousUser.
User "1449875724449222818" not found.
!compban 354712976055336961
I'm so bad at this.
:incoming_envelope: :ok_hand: applied ban to @warped quiver until <t:1766093340:f> (4 days).
That's not the right answer. If you're stuck, make sure you're using the full input data.
wrong reply?
Nah, just an attempt at an AoC joke.
don't offer to pay. just show the code and explain what the problem is.
(this is a warning--you are not allowed to offer to pay.)
Since you typically submit numbers, and the above is what you often get if you submit the wrong one.
guess now everyone knows I didn't do AoC
canu help me in dm?
alr mbad
No. Don't be cagey--what issue are you having?
Nah, it's ok, it was pretty farfetched.
We generally discourage help through DMs. By asking your question in public, everyone can contribute to the answer or benefit from it. You can use #1035199133436354600 to get a dedicated help thread.
in the section on signing transactions, i dont know exactly where my bot is failing
executed order: {'up': {'ok': False, 'error': "PolyApiException[status_code=400, error_message={'error': 'invalid signature'}]"}, 'down': {'ok': False, 'error': "PolyApiException[status_code=400, error_message={'error': 'invalid signature'}]"}}
Hey @supple pelican!
```py
print('Hello, world!')
```
This will result in the following:
print('Hello, world!')```
from eth_account import Account
from py_clob_client.client import ClobClient
from py_clob_client.clob_types import OrderArgs, OrderType
from py_clob_client.order_builder.constants import BUY
PRIVATE_KEY = "0xTU_PRIVATE_KEY_REAL"
ADDRESS = "0xTU_ADDRESS_REAL"
assert Account.from_key(PRIVATE_KEY).address.lower() == ADDRESS.lower()
client = ClobClient(
host="https://clob.polymarket.com",
key=PRIVATE_KEY,
funder=ADDRESS,
chain_id=137,
signature_type=2,
)
creds = client.create_or_derive_api_creds()
client.set_api_creds(creds)
args = OrderArgs(
token_id=TOKEN_ID,
price=0.5,
size=5,
side=BUY,
)
signed = client.create_order(args)
resp = client.post_order(signed, OrderType.GTC)
print(resp)
I assume you edited this and you're using your real private key in your code?
wym
I just want you to know that I got the joke and I found it pretty funny
thats not the problem
How do you know?
even if I put the key there, its also in the .env file and it keeps throwing the same error
Thanks, I appreciate you saying that. Right after sending it I was like "I'm just gonna sound like a crazy person, aren't I?"
So do you actually have PRIVATE_KEY set to "0xTU_PRIVATE_KEY_REAL"?
yes if u can come dm i pass u all the code
You should not show me your real private key
Or anyone else for that matter
nah chill im not stupd jsjj
Again, we don't do help in DMs on this server
You can create your own help thread in #1035199133436354600
oh my dayyyyyyys
ineed to fix that bro
why
Because using a help thread works just as well, and allows more people to help
as well as benefit from the answers
Why does it need to be in DMs?
cuz the code can be public bro
Just put the secrets in a file and load them in the code. Then tyou can share the code.
its not a free code or anything
Nobody's gonna steal your CLOB client sample code
hell no
IDEK what a CLOB is
the bot uses a strategy that cannot be made public
Then don't show that part of the code, just make a minimal example that reproduces the error
You got an invalid signature, that just means you can't make an API call
You don't need to paste your whole trading strategy to fix that
alr i appreaceate it u
DMs are where you try to get some sucker to invest in your strategy. Or at least that's what happens with others. That's one reason we avoid DMs. Also it means one person is committing to helping one on one you which most people don't want to do.
u trippin
at first I said I would pay whoever helped me, i dont want anyones money, idont need it, stop talking bullshit
Maybe not you, but hang out here for a day or two and see how many people we have trying to get people to DM them about opportunities.
@supple pelican https://github.com/Polymarket/py-clob-client <- Did you read the readme here? Especially the part about how you have to configure the client differently depending on the wallet type
damn
alr
I don't know what kind of wallet you have but make sure you follow the right steps for your wallet type
nah thats not the problem
Try to get it to work with one of the basic examples from the readme and then once it works you can plug it into your real code
You're getting a bad signature rror. That suggests a basic failure of the API use in some way. Sort just that.
I don't mean that your wallet isn't good, I mean that the code to configure the CLOB client has to be correct depending on the wallet type. See the readme.
If your strategy is a secret, stuff it into its own file, provide a dumy strategy (eg "buy never" or buy once or something trite).
If you can make a basic API call work, that'll probably fix your issue with your real code.
how to check if there is sound in speakers using python?
on windows there's pycaw
Hey @proper nexus!
```py
print('Hello, world!')
```
This will result in the following:
print('Hello, world!')```
completed my first two problems in leetcode :)
congrats :3
is there any way to do single-precision float arithmetic in Python?
not just converting 64-32 bit, but actually doing math
numpy
idk what a libm is
maybe math.h?
it's not python extension .h
it's c++
i wonder why i cant write in rust lobby, did they deactivate the channel?
it's C
No Access 
The official one is no longer a thing. Community is though (which is what owo is linking).
[(🦀)Rust Programming Language Commu… > # offtopic] for me
gmpy2 lets you make arbitrary precision floats too
ah, just gnu mp/fr/c wrappers
You are given a list of mana crystals, each with a certain value. Every turn, all crystals regenerate their full value. Simulate 5 turns and calculate the total mana collected by summing the values of all crystals in each turn.
Mana Cascade better?
I think yes
uh, so just 5 * sum(crystals)?
this is the actual code btw
A sequence of mana crystals regenerates each turn. Calculate the total mana collected after 5 turns.
yes here is not clear what to do
but by hiding what to do its harder to do but impossible or not?
yes got it actual code right
so here its not clear if its 5 * sum?
Why is that unclear?
I assume you have a function f: N -> N that maps the number of the turn to how much mana you regenerate in that turn, so it's just:
total_mana_regenerated_from_round_2_to_5_inclusive = 0
for turn in range(2, 6):
total_mana_regenerated_from_round_2_to_5_inclusive += f(turn)
Obviously the 2-5 range is just an example and could be dynamically set instead
it's never clear when the mana is harvested
if it says 'regenerate 5 times' it might mean it's harvested 6 times (in the beginning or after each regen)
Oh hi Doctor
Pyphon is neet :D
It's that time of year again. I'm looking for the next years chess game. Each year I pick a new opening/gambit and play it for a solid year. Time for the next! Just got done with a year of the Cochrane gambit. What's next?
This one is clear. You're asked how much mana is collected (by the crystals) over 5 turns. That would be 5 instances of crystals recharging
It could be more complicated if they are only drained a certain amount, but if that is not specified, then answering "0" is not really a sane answer and so you should just assume they're fully utilized
any python oop projects ideas?
all python projects can be oop projects
!kind got bunch of projects in general, you can just apply the oop there
The Kindling projects page contains a list of projects and ideas programmers can tackle to build their skills and knowledge.
"Does anyone know of a list of programming projects I could do?"
"!kind of."```

<@&831776746206265384>
!cpban 439401731785490432
:incoming_envelope: :ok_hand: applied ban to @supple mango until <t:1766101018:f> (4 days).
cp ban. jeez what did bro do
The typical 4 images Mr Beast smth scam
Clear/purge
ohh i see
welcome!
Thanks
Is it just me that finds multiline strings annoying to deal with? Are you not supposed to use them for actual outputs to the user?
The fact that leading spaces on each line are actually included makes it hard to format in code
i always use "\n"
wrap them in textwrap.dedent()
or inspect.cleandoc()
i usualy always end up using dedent with multiline strings
I think I will just
output = (
f"## {"You Did It" if self.completed else "You Got This"}!\n"
f"**Goal:** {self.text}\n"
f"**Repeat:** {self.repeat.display()}\n"
f"**Reward:** {self.reward} Crumbs"
)
did you try textwrap.dedent?
output = textwrap.dedent(f"""\
## {"You Did It" if self.completed else "You Got This"}!
**Goal:** {self.text}
**Repeat:** {self.repeat.display()}
**Reward:** {self.reward} Crumbs
""")
is the \ supposed to be there?
No, thanks for the suggestion, but I dont want to have to call a function on it
why not?
yes, or there will be a first blank line
it becomes more unclear what is going on
i thought dedent stripped out newlines at the start and end?
dedent is very common in this scenario. i'd argue what you're doing would catch someone by surprise more than dedent
it would for me, at least
I have never seen dedent before
TIL!
interesting
now you know what it does.
never even knew that there was a std package called textwrap
we are all learning every day
it is allowed by Google's style guide (I know because I checked recently), but I am not a fan
it is still personal preference, yes
how would you make the string?
I like multiline strings, but without dedent. it can look wonky but you get what you see in the string
I do the dedent (or cleandoc, or my stripped_dedent, which seems to do... what cleandoc does) at output time. Leaves the strings directly there in the code.
huh. i dont know why i didnt think of that before
that does seem cleaner than wrapping the whole multiline string in a function call
you have to remember to do it, though, or maybe wrap it in a helper function. maybe annoying if you need it multiple times
I use a helper quite often: https://github.com/cameron-simpson/css/blob/ce035ce150664824909bfe390555481acc98c611/lib/python/cs/lex.py#L435
lib/python/cs/lex.py line 435
def stripped_dedent(```
You go out of the way to put args on a different line
But then you put them all on the same line
shame there's no builtin helper function.
could even have dedent in the name.
alas
Hmm
Maybe we could suggest it
... because they exceed the formatter line length.
I could put them all on separate lines with atrailing comma.
cleandoc is a lot like my stripped_dedent (no post_indent etc). And you can have stripped_dedent by adding cs.lex to your packages.
You may get the answer: not everything needs to be in the stdlib. You've got dedent and cleandoc, other stuff gets into the bikeshedding space pretty quickly.
hello
yuoyo
i think their comment was a joke, since textwrap.dedent already exists
My yapf style is basicly PEP8 with a few tweaks: https://github.com/cameron-simpson/css/blob/main/.style.yapf
Mebbe so. I'm pretty literal minded.
oh?
O?
Oh hey look a PR from me
Why do you hate Black/Ruff?
Too opinionated and not tunable.
Ok for a "just have the entire team agree", crap if you actually care about things.
Fair
I'm the opposite
I don't really care so I love having strict tools to keep things consistent for me
Aye. I still haven't gotten to attending to it. Thanks tho.
I don't even remember doing it so... 👍 I guess lol
Yo what should I code?
shen do you want a dmca notice from nedbat or something
how is TWD going
Ah yes
Because Ned surely has higher authority than Price Stern Sloan
Not as good as I remembered
I got distracted though
Now I'm here instead
I'm not getting my gaming PC until like mid April which is when I'm done with the school year
Are you gonna get TWD?
maybe he does.
but incontrovertible is it that the fella who constantly suggests mad libs as project ideas is the nedbat
prolly, tho I sail the seas
in gonna get rpcs3 and play some of my favorites
I love sailing
My dad didn't when the roomate got us sent a DCMA notice
I'm happy for the meme to spread!
yes, in the original sense of the word: an idea that spreads
fair
I need to update mine
I never finished loading the phrases directly from the story file
also @charred tusk you should play Detroit become human, even the tuffest will get heartbroken by the story
it's just so peak
I did
And I did
oh
tuff I guess
first time I played it I actually cried for a bit
that's how peak it is
I think you read me backwards
I did get heartbroken
Am not tuff
Cried for like 12 hours straight last week
ik I implicitly told myself
straight??????
Pretty much
||Had to say goodbye to the dog||
Was on and off all night long
I was tearing up when I was doing this "iterative gameplay" where I do every single possible combination of choices and I went thru a several where I had to kill connor
not the dawg 
Yep
Gonna have to change my PFP now
Oh
Yeah
Sorry, I know being "polite" is always opaque
||yeah, euthanasia||
Hello :D
Howdy 
What did I just…
Is it possible to find actual jobs as software developers, particularly doing automation with python?
Or should I just switch to something else / give up?
See #career-advice
:o
Okie ty
Hi Robin
yo
damn...
IDK what I wanna do with my name
I was memeing 🐕🦺 for a while
I actually wanted to be "wolfie" but I ended up as "doggo"
Maybe I commit to the bit and go full wolf now
Or maybe I quit being the weirdo with the emoji name
how are you holding up
sorry to hear, but that's just life, can't do nothing about it except accept it
Got like five different users at work who's software (all different ones) has decided to crash repeatedly, and they're all spamming me with messages about how they are the one that needs help first
I need Fish's GIF about going completely mental
tell them to shut up and put them in a queue
that's what I do in exams when the teacher leaves the room since everyone just goes completely hyper and shit
that's tough man
:(
I think you need them all in the same group chat and tell them to "decide who gets help first"
Oh my DOG that would be glorious
Meanwhile you're just working on one of their issues watching the chat argue
But nah, I already know exactly who the priorities are
Fair enough
Need to ask your manager if you can anonymized group chats so they can argue who takes priority
Bruh what should I do tonight
Make one of these https://en.wikipedia.org/wiki/Mad_Libs
Bruh
Yes?
" yes?" 💀
What if i don’t want to do those
I want suggestions tho
!projects There's lots of project ideas in the world
The Kindling projects page contains a list of projects and ideas programmers can tackle to build their skills and knowledge.
Ima do a app to take down discord
how do i get permission to speak in vc?
!voice
Can’t talk in voice chat? Check out #voice-verification to get access. The criteria for verifying are specified there.
What?
ty
when it says to be active does this mean i have to talk for a hour 30 minutes straight?
seems like a lot off time
not sure
it keeps vc high quality
stops people from newly joining and saying random shit
Who cares about discord
Cloudflare's entire selling point is anti-bot/anti-DDOS stuff
Discord uses Cloudflare
So to blow up Discord you gotta blow of Cloudflare first
With all its problems
You did five seconds ago
Nope I wanna take them DOWN
let's stop joking about this
I’m not
ok, then you are getting close to a ban.
How?
!rule 5
5. Do not provide or request help on projects that may violate terms of service, or that may be deemed inappropriate, malicious, or illegal.
Hi again Ned
Ned have you ever tried to make your own language?
How is saying I want to take down discord violating the TOS
doesn't it seem malicious and illegal to you?
it seems inappropriate malicious and illegal
not design a language, but implement one, yes, in small ways
How is it illegal if guild and multiple other apps tried the same
I love the idea and I want to have one with my name on it just to say I did it
But every time I pick up Crafting Interpreters I end up with a headache and taking a break to walk the dog by the third paragraph
just stop
It’s not maliscious it’s purpose is to better than it
is your reasoning that if someone has tried it, it must not be illegal?
you should then ask a specific question about building a chat app
I’m not hacking discord or doing anything bad just making a app
Reminds me of a friend who believed that blogging and social media were a fad, and wouldn't last
What do they say now?
email will never catch on
Wait, people use email?
lead with that next time
Robin being embarrassed about waking up Mr. Bobby caught in 4k
I believe they have a blog. No, mostly LinkedIn posts
So please don’t assume
ewwww
They were so close to being based
Sorry, your wording was ambiguous.
was joke
I have a new raspberry pi project. How to train my dog to stop barking.
Hooking it up to a spray bottle?
I guess so. If -it- does it, I don't feel so bad
So is there a good free host?
for?
presuming they're talking about their discord competitor, a web app
vercel is good for small, single developer projects
AWS for more serious stuff
in between those two there are a lot of options, basically any that provide you with a VPS will do
what kind of project do you want to host?
The app when I’m done
Until the dogs start working together, in order to get more treats.
Hey, if they teach each other to stop barking, then you've still won
writing an RCE in binary barks sounds a bit too difficult for dogs to accomplish
I thought Vercel ran stuff "serverless"
Can I have a backend with websockets in Vercel?
The chat app
vercel is server (serverful?) with scale to zero
i think
that program gives a treat to a dog when another dog barks, for distraction purposes. if the programs are present in multiple areas, with multiple dogs, and they somehow discover this, billobobbo is concerned about conspiracies to trigger multiple distraction treats via mutual barking, possibly at a higher rate than is already present
this would most likely not be considered as winning
I wouldn't worry about a hosting service yet. You have to build the app first.
Thanks for the tip. Checking out Vercel now!
vercel is expensive if you need to scale up, so it makes sense to write your app with the consideration of vendor lock-in
Vercel makes a pretty damn good product
But they have some pretty damn shitty business practices
They don't let you cancel your paid plan and go back to the free tier, you have to contact their support and they will delete your entire account.
They stopped supporting private repos on the free tier overnight, and didn't say anything until people complained, at which point they cited changelog entries from like six months ago, and promised they sent out an email that nobody actually got.
take advantage of their free tier but dont get yourself locked in
I'm intending to derail because I saw a Vercel mention, I so badly want Anantaaaaaa 
what's ananta?
Anime GTA
It's not full weeb but it looks so fun..
It doesn't, that's why I said I was intending to derail because I saw Vercel was mentioned
Anyways
Python!
I'm writing Swift 😭
Is it fun?
Sorta? It likes to do cursed things, but if you can't guarantee expected typing, it'll just fail to compile
Python related thing I'm struggling with since I'm not good at generators:
I'm implementing a regex backtracking engine, and currently trying to use cameron's suggestion of implementing it with generators, but I'm unsure how to do the Repeat/Concat while still keeping it using lazy iteration.
My current matches functions all have the signature def matches(self, input: str, index: int) -> Generator[int]:
Focusing on Concat, I think I conceptually understand how it should function. Concat looks like this:
@dataclass
class Concat(Spanned):
regexes: Sequence[RegexItem]
So the process of matching it would look like
For each regex in self.regexes, the starting index is the most recent result of the last regex's generator. If the current regex runs out of indexes, try again using the next index from the previous one. If the last index is reached, yield from it.
But I'm struggling hard to translate this into code
wsp
it'd be kind of scarier if it let you break the rules of its type system 👀
Good morning
So...a lazy C compiler?
pretty much 😩
Like usual fully writing it out helped
but still wow this is a confusing way to program https://paste.pythondiscord.com/CPXA . Now for the probably even more confusing Repeat
Update since I see you typing: Even with using Concat as a base for Repeat it still doesn't seem to be working correctly
(Also I made the concat code better but still equivalent https://paste.pythondiscord.com/UCGA , and it's still a bit confusing to me)
(Also here's the full current code if you'd like to look at it https://paste.pythondiscord.com/JURA)
Well you could do it recursively, where you recurse over regexes. What you want is a matcher for your single RegexItem which yields the matches in longest-first (or shortest-first) order, subject to matching the tail items.
Sketch:
class RegexItem:
....
def match(self, text, offset, tail_items) -> Generator[int]:
for end_offset in self.possible_match_end_offsets(text, offset):
if not tail_items:
yield end_offset # success, this is viable
next_item, *new_tail = tail_items
for next_offset in next_item.match(text, end_offset, new_tail):
yield end_offset # tail matches, this is viable
You need to write possible_match_end_offsets for this item, whose sole job is to match the item itself to text at offset and yield end_offsets which indicate the end of each possible item match.
Ok, so my offset is your index.
Your backtracker seems nice - stack instead of recursion.
..
I work at the intersection of AI and Blockchain, building systems that are intelligent, secure, and easy for users to interact with. I also handle the full UI/UX and front-end development for mobile and web projects using React Native, React, and multi-stack environments.
I’m open to collaborating with clients or agencies who need support on AI-powered trading tools, decentralized platforms, or modern mobile solutions.
My areas of experience include:
- AI / ML: Automated trading logic, predictive models, P2P optimization, AI system integration, Dify-based workflows, ML pipelines
- Blockchain: Smart contract development, Ethereum/Solana ecosystems, dApps, token design
- Frontend / Full-Stack: React Native, React.js, multi-stack workflows
- Design: Practical and clean UI/UX aimed at smooth user experiences
- Additional Tech: Python, Node.js, TypeScript, API work, cloud services
If anyone needs someone who can blend AI functionality with blockchain systems and deliver polished, reliable solutions, feel free to reach out privately anytime.
fyi we dont really allow this sort of thing on this server
!rule ad paid hire
6. Do not post unapproved advertising.
9. Do not offer or ask for paid work of any kind.
!rule 6 9
nice
after i finish w3school, is there any other content i should look into, to learn
for python the tut
Literally anything other than w3schools.
Be finished with it now.

!resources
The Resources page on our website contains a list of hand-selected learning resources that we regularly recommend to both beginners and experts.
Go make projects
Just learning concepts won't be enough
!kindling
The Kindling projects page contains a list of projects and ideas programmers can tackle to build their skills and knowledge.
I use chat gpt to give me beginner projects lol
Thxs
Its fine to use ai to give you project ideas but try avoid using it to help you make the project
Nah it just gives me ideas
Cool
when converting a variable to another type i use the same name for both types because its more concise but pylance complains
how can i suppress this complaint or this practice is not recommended ?
Can you share your code that pylance is complaining about?
if you've type annotated a variable to specific type before and then again reassign the variable to another type, your type checker will complain
but share your code also
a file path(str) and an opened file object both share the same name
should i just append path to said str variables name and call it a day?
Can you share the code that pylance is complaining about?
file = "path/to/file"
file = open(file, "r")
i think its better to be explicit with the naming
But depends on the person
That seems odd to do. Why not just combine it into one line if you're immediately re-assigning it?
why not this
file_path = "path/to/file"
file = open(file_path, "r")
i dont know, variable names can get lenghty with this approach
are you re-using the path anywhere else?
Its ok to have descriptive names
ok i think this example is better
def open_file(file: str):
file = open(file, "r")
there comes a point where you abbreviate and add a comment instead - this is not that point
so was the above not actually the code pylance is complaining about?
it was just a hypothetical example
Oh. So no
a. I'd still use file_path and then file
b. might I suggest pathlib.Path.open ?
!d pathlib.Path.open
Path.open(mode='r', buffering=-1, encoding=None, errors=None, newline=None)```
Open the file pointed to by the path, like the built-in [`open()`](https://docs.python.org/3/library/functions.html#open) function does...
language servers show the comment when you hover over variable name right?
they show docstrings, idk if they show comments
there's also read/write methods you get with the Path class
evening y'all
I don't think you can document an individual variable but you could if it were a function parameter
You can do this:
x : int
in your code.
Or do you mean:
x : int
# for holding x values
hey
pretty unusual, but you can
that's interesting it recognizes that
so you put the doc comment after the variable?
that's generally how doc-strings in python work
curious, jsdoc is before the variable
after the class/function definition, that translates over here
I guess that's true, they typically go inside
most doc comments are before
is that vscode?
neovim
ah ok
should work in vsc just the same
i wonder how wide the ide support is for documenting variables
that is upto the lsp you're using
They may have. I lack context.
i don't even think it's supported in java
the editor probably shouldn't and doesn't make a distinction between variables and functions/classnames etc.
Ideally, though I think it would have to practically speaking
it needs a different route to identify all those things
but they should all be handled as identifiers
that's your lsp/formatter/syntax highlighters job, which are plug and play for most modern editors
there are extensions you can get on vsc on a per language basis
do you use source-highlight ?
on neovim, I just stick to treesitter
I use it as a utility to just read source code and as a library on a couple applications, but it sadly misidentifies things all the time
I think it's probably token based
vsc on the rare ocassion I use it is just mostly ootb
treesitter I've read about
is it mostly used in the vim ecosystem
.pypi treesitter
aw
i know there is an adapter package
!pip tree-sitter
ah! there it is
what is the name you import it with
oh there's a dono banner on pypi now
tree_sitter and tree_sitter_<language> for language specific extensions (that you install separately)
ah cool
hm, I wonder why those are separate packages and not like package groups
is a package group a thing?
oh interesting
yeah I've seen those square brackets once before I think?
I wonder what that's all about
@inland karma probably knows
specifying which parts and/or extra parts you want to get
yea those are called extras
haha I just read that
e.g in tree sitter I'd expect something like this
tree-sitter - core package
tree-sitter[full] - core package + all available extras
tree-sitter[python] - core package + python extras
and so on
!pep 508
oh so it even has virtual extra packages lol
with full
that would be what I'd install
so it's for "optional dependencies"
good morning
yes
knows what
about extras
yes extra optiional dependencies
so tree sitter is just an odd one out
it would be bad to have tree-sitter and tree-sitter-python under two names
since they didn't appear to organize their add-ons into official extra
I don't think I understand?
the alternative is to make two seperate packages
tree-sitter-python would be to parse python code wouldn't it
(that's what they're currently doing)
oh.. i see... yes i see
extra optiional dependencies are the solution to this problem for a package
hm, is this issue worthy?
it is our own fault as well, we dont share how awsome it is to use
a rewrite of the package architecture..... it is at least dddiscussion worthy
that's a big topic

i feel like python is in a constant cat and mouse game with its own packaging ecosystem
yes, by design.. pun intended
The Python logo is based on Mayan representations of snakes!
Suggest more facts here!
hm, doesn't look like someone has brought it up before
the particular issue with extras?
@broken flower
guys django or flask
actually, looks like their whole project structure is fragmented like that
btw, anyone heard about PythoC? i just came over the name today a few minutes ago
PsychoC
Django
https://github.com/tree-sitter/ each language extension is living in it's own repo and has separate releases
alr
they solve differnt problems in the same field...
i like and use django more, but i like that django has everything included
so why but
i dont like to make all the choices myself
if you want full flexibility, you have to write everythiing yourself
and that is fine if you want that, go with flask and write everything yourself
Its an opinionated framework
meaning it enforces you to build it in a certain way
which one is easier
they're both easy.
comparatively
nothing here is easy, but flask is simpler
ok
it takes a long time to learn django, you can learn everything about flask in a day
and if you want something as simple like Flask but still like Django, you could look at NanoDjango
and sometimes your backend just needs an api.. and then you have fastAPI as well
How do i code a phonetic alphabet maker that turns letters in a word into phonetic alphabets
like A is Alpha? B for Bravo?
Yep
Maybe just hardcode the values into a dictionary
wait... did you mean radio call signs or the sound of the letter?
well.. a mapping would work for both those
Just printing a string
radio call signs are A for Alpha, B for Bravo, etc. Sounds of the letter would be like Ay, Bee, See...
Like turning a word into its phonetic form
lets be explicit, are you talking about the NATO Phonetic ALphabet?
so if the word is CAT, are you expecting, Charlie, Alpha, Tango or Cee, Ay, Tee?
make a mapping between letter and word
Can someone please make an example code
do you know what a dict is?
Of what
bro i completed the python lang. now i don't known what should i learn.. Like an libraries, A.I & ML, Data science, Data Analyse? can u people help me ?
An example code of my phonetic alphabet code
make something
I don't know how to do it
do you know what a dict is?
once you have a dictionary you can then call the value from its key.
nato = {"A":"Alpha"}
print(nato["A"]) # This outputs Alpha
ok.. so use a dict
I guess It's your choice . Btw thats data analyst . I am learning
Sounds like you wanna do AI/ML stuff. You can go to https://kaggle.com/learn to get started and branch off from there
random q - anyone used Socrates AI for python project planning?
saw it on socratesai.dev, supposedly helps with architecture before coding. generates file structures, catches dependency/security gaps, etc.
wondering if it actually understands python specific stuff like package structure, virtual envs, extras (speaking of extras lol), or if it's just generic
might be useful for bigger django/fastapi projects? idk
is dict stand for dictionary?
yes
Yes
never heard of it
its not an simple question to answer, do you know how LLMs work?
sounds like a terrible idea
well if you ever get the chance to try it out, it would be good to see if there is any sort of validation before I use it regularly
Before coding?
And how to detect if an input answer is not an integer, i am making a guess a number game
So it says "That's Not A Number" if anything other than a number is typed
yah it provides some sort of implementation plan context
by then, you might as well do your own file structure
Do u have any free resource on data analyst?
>>> x = "a"
>>> x.isdigit()
False
well I am trying to match it up, I only tried with a small project, it seems to create the coding archetictural decisions for me
two ways, check if the string only contains digits. or try to convert it to a number, like integer or float, and catch the error if it fails
Ok thanks
@sand jewel Do u have any free resource on data analyst?
youtube
Check the pinned message in #data-science-and-ml
i would not go anywhere near youtube
Why it's also a python discussion?
huh?
the whole server is about python
Then why we don't talk about python data science here
you can
The pinned messages in #data-science-and-ml is more topically focused than in this channel
but we have dedicated channels for a reason
Cuz you don’t know a lot
Why I go to #data-science-and-ml for a little answer
dont be mean
its not a little answer tho
Not mean lol
because the answer is in the pinned comment
you where, now please be kind and friendly instead. you already said you would be when you joined
do you know what a pinned comment is on discord?
but its not problem to talk about data science, AI and ML here too.
I am new so I don't know I can only message
let me show you
You already said you would be when you joined?? Fuh is you on about
But okay I won’t be mean
when you joined the server you agreed to the rules and code of conduct
five days ago you said you had read and understood our #rules
!rule 1
1. Follow the Python Discord Code of Conduct.
and you said you had read and understood this rule @mint loom
Being kind and courteous to others
Using welcoming and inclusive language
...
among many more things @mint loom
hope i made it more clear now!
perrfect! thank you
@peak relic why delte the video?
I didn't #ot1-perplexing-regexing message
Ohh
ahh... nice! 😄
i dont really use the mobile client, so i keep forgetting you can do many things there as well
does anyone know if its possible to have fastapi accept a byte object as part of a json request object ideally by decoding a base64 string into a bytes object?
Yea I noticed he's on mobile so he might have missed it
you can send bytes as a request
so the answer is yes you can
base64 to bytes string is a sensible solution as well
i dont want the request body to be just the bytes i need to keep the json structure
JSON is not designed to store bytes as values. That's why we use BASE64
yeah, just send a base64 payload
Presuambly fastapi has a field post processing step you could hook into
nvm turns out i was using AAAA as my b64 test string which happens to be 0x0
null byte moment! 😄
i was using pydantic Base64Bytes and its working now
Annotated bytes as an example
The web design on their docs is annoying me
you want to go to the reference? Are you sure you don't want to look at the tutorial?
I don't think clicking "Reference" should direct me to the tutorial
Changing versions resets you to the homepage, which is obnoxious
The types reference page has six million lines of text and a dozen entries.. and the TOC doesn't scroll
thanks @jagged belfrynow it will annoy me as well... 😄 😄
