all string syntaxes (beginner) anthony explains

  Рет қаралды 4,593

anthonywritescode

anthonywritescode

Күн бұрын

Пікірлер: 29
@DavidDellsperger
@DavidDellsperger Жыл бұрын
Anthony provides 19 minutes, 22 seconds on great information regarding strings, at 19:23, "It's french and it's funny"...that's all I've taken away from this video, thanks Anthony! French == Funny
@qexat
@qexat Жыл бұрын
hon hon hon la f-chaîne de caractères
@Papalotis97
@Papalotis97 Жыл бұрын
i might be wrong but the \ at the end of the line is not specific to multiline strings, it's just a line continuation, that is why it also works for single quote strings
@dericmiguel1
@dericmiguel1 Жыл бұрын
you can also use parens, ( "foo" "bar" )
@anthonywritescode
@anthonywritescode Жыл бұрын
it's slightly different for strings -- see the part on raw strings
@ChongFrisbee
@ChongFrisbee Жыл бұрын
This has been the most advanced beginner video I've seen. And I mean this literally, not sarcastically. Still beginner level, but realy informative in a non trivial way 10/10 'thumbsupemoji'
@rougebarbu
@rougebarbu Жыл бұрын
formfeed (FF in the ascii table) is for printers. They go to the top of next page. with linefeed (LF), even on a printer, you just go down one line
@mad_vegan
@mad_vegan Жыл бұрын
14:42 It's because the parser always looks at the character after the backslash and preserves it in the raw string. So it sees the \' at the end and includes both the backslash and the single quote. But then it thinks the string wasn't terminated and gives an error. Why it's implemented like this idk, it might be for performance.
@Cookie-mv2hg
@Cookie-mv2hg Жыл бұрын
Please do make a video about the "meta language" you mentioned with f-string! This is super helpful!!
@senseikoudai6186
@senseikoudai6186 Жыл бұрын
I would love to hear more about the meta language of the f-strings. Maybe it you could actually make a video about it.
@samoylov1973
@samoylov1973 Жыл бұрын
Anthony, if you were to write Caesar cipher (where each letter is substituted with the one that is some places "behind it") how would you go about such a task. Say, "Hello, World!" with shift pattern of 3 letters. "a" becomes "d", "b" becomes "e" and so on. Could it be done with that print("a d") substitution. I understand that instead of "d" there should be some code in { } and f-string at the start. Thanks!
@anthonywritescode
@anthonywritescode Жыл бұрын
`a d` doesn't really do a replace -- it just wipes the line rendering in the terminal for casar cipher I might use `str.translate` -- would be one of the few times I actually use it
@dorb1337
@dorb1337 Жыл бұрын
love the debugging option from 3.8 but I haven't found it useful in my projects yet😂😂
@PowerLlama
@PowerLlama Жыл бұрын
I've got a weird code problem I can't find an answer for… i have some functions i've written in python, but i can't call them directly from the package. instead i have to store them as strings, and then give those strings for the next program to run them independently. is there a way of converting a function to a string? right now i'm doing using the functions in testing and then when i'm done wrapping them in ''' multi line string arguments (and the '''/ is a great tip thanks for that). but of course that introduces typos and code duplication. weird problem (i think), would love to know your thoughts!
@anthonywritescode
@anthonywritescode Жыл бұрын
that seems... very strange... are you sure you can't just use modules? otherwise you could use `inspect.getsource` + `exec` or something of the sort -- but sounds pretty hacky
@PowerLlama
@PowerLlama Жыл бұрын
@@anthonywritescode oh yeah, super hacky. basically in this app we use Nuke by The Foundry, a vfx app, you can create nodes in the dag with a python button, and in that button you can execute arbitrary python scripts. print('hello world') or whatever. and as long as the scripts are using built-ins and nuke methods, you can copy paste them around and expect them to work in other scripts. in a normal studio environment, i'd import thing thing.main(), but the way we're working we're passing around nuke scripts to people who don't have access to our central repository super hacky, i don't like doing it, but it's what we've settled on. seemed like a shot in the dark question but if anyone might have an answer it'd be you
@blizzard_inc
@blizzard_inc Жыл бұрын
did you forget to mention u-strings? Or was it a conscious decision?
@anthonywritescode
@anthonywritescode Жыл бұрын
they don't do anything so I intentionally left them out
@cerealport2726
@cerealport2726 Жыл бұрын
i use raw strings to manage file and folder paths in Windows without a lot of extra effort. maybe it's a bad approach, but it seems to work...
@anthonywritescode
@anthonywritescode Жыл бұрын
you know you can use forward slashes even on windows right?
@cerealport2726
@cerealport2726 Жыл бұрын
@@anthonywritescode Maybe it's just the Python 3.9 environment thats embedded in the data platform i use at work, but I get annoying messages that pop up when normal file paths are used, hence, the use of an "r"...
@SQADIqw
@SQADIqw Жыл бұрын
Cool ! Also funny thing, that some db libraries optimized for c style formatting, and if you use f strings they produce inefficient sql, because it was no f-strings during that times😅
@anthonywritescode
@anthonywritescode Жыл бұрын
uh no that's not the reason -- using f-strings in sql is a security issue due to sql injection
@mrswats
@mrswats Жыл бұрын
Classig off-by-one errors 9:14
@mrswats
@mrswats Жыл бұрын
Also, baguette strings
@DavidDellsperger
@DavidDellsperger Жыл бұрын
How to...duh, duh, duhhhhhhhh...write python
@user-us8th9zn1g
@user-us8th9zn1g Жыл бұрын
f strings ❤
how do virtualenvs actually work (advanced) anthony explains #522
16:55
anthonywritescode
Рет қаралды 7 М.
REAL 3D brush can draw grass Life Hack #shorts #lifehacks
00:42
MrMaximus
Рет қаралды 11 МЛН
Всё пошло не по плану 😮
00:36
Miracle
Рет қаралды 2,8 МЛН
Being Competent With Coding Is More Fun
11:13
TheVimeagen
Рет қаралды 97 М.
My 10 “Clean” Code Principles (Start These Now)
15:12
Conner Ardman
Рет қаралды 251 М.
Vim Tips I Wish I Knew Earlier
23:00
Sebastian Daschner
Рет қаралды 71 М.
merge queues (intermediate) anthony explains #524
13:48
anthonywritescode
Рет қаралды 8 М.
tree-sitter explained
15:00
TJ DeVries
Рет қаралды 88 М.
REAL 3D brush can draw grass Life Hack #shorts #lifehacks
00:42
MrMaximus
Рет қаралды 11 МЛН