#python-discussion

1 messages ยท Page 554 of 1

swift sparrow
#

sure, but I'm only around for the next 15 min or so

honest cradle
#

and im good enough to finish the rest i suppose

lime sage
#

im installing pycharm, what checkboxes should i put on?

swift sparrow
rare gazelle
#

honestly, regarding the bool conversation:
what you think about:

if bool(x):
  ...

to be valid, but:

if x:
  ...

to be invalid

lime sage
lime sage
swift sparrow
#

which ones are you unsure of?

spice hill
#

timeit also accepts a string that it execs

lime sage
honest cradle
spice hill
latent lion
#
def sort_the_inner_content(words):
    word=words.split()
    newlist=[]
    for i in word:
        j=i.split()
        x=sorted(j,reverse=True)
        newlist.append(x)
    return " ".join(word)
sort_the_inner_content("sort the inner content in descending order")
swift sparrow
rare gazelle
lime sage
swift sparrow
bronze dragon
# latent lion ```py def sort_the_inner_content(words): word=words.split() newlist=[] ...

j = i.split() just gives you back a list containing a single element (i)
since i is already a result of .splitting on words, further .splitting on it can only result in a one-element list
and because of that sorting j does not really do anything
finally, what you're returning is " ".join(word), and the word list was never modified, so you get back the input again

latent lion
bronze dragon
#

that may not do what you think

native coyote
#

krillions must lear python

#

learn

brisk gazelle
#

Well, the righthand will evaluate to that.

#

The line as a whole is an assignment statement and doesn't evaluate to anything because it's not applicable.

rare gazelle
#

how is issuperset implemented? i assume it doesn't care if the lengths are the same

quartz fulcrum
#

hi everyone,
good morning!
i am back to learning

rare gazelle
#

say the length is greater or equal, is it just:

all(map(a.__contains__, b))

?

latent lion
edgy krakenBOT
#

Objects/setobject.c line 2405

set_issuperset_impl(PySetObject *so, PyObject *other)```
rare gazelle
#

alright let me C....

brisk gazelle
latent lion
bronze dragon
#

bool("False") == True

brisk gazelle
#

Though variables don't hold the objects to which they refer.

quartz fulcrum
brisk gazelle
#

They're named signposts. Not containers of those objects. They're proxies.

bronze dragon
latent lion
#
print("Welcome to python")
rare gazelle
#

if the other is set though, it does issubset (i wonder why?)

bronze dragon
rare gazelle
#

would be nice if not NotImplemented would return NotImplemented

brisk gazelle
rare gazelle
brisk gazelle
#

I mean, I know the Python correct evaluation, I'm just making a joke of it, but...

edgy krakenBOT
#

Hey @lime sage!

Please edit your message to use a code block

```py
print('Hello, world!')
```

This will result in the following:

print('Hello, world!')```
lime sage
#

'''

bronze dragon
#

the correct Python evaluation being -- nothing, it's an error to use NotImplemented in a boolean context (since 3.15)

brisk gazelle
#

` not '

lime sage
#

how do i do a code blcok

bronze dragon
# lime sage '''

backticks, not single quotes. they're usually the key above Tab.

brisk gazelle
#

Look below esc, above tab, left of 1

#

On ~

craggy trench
#

the ```
~
`

key
lime sage
#
    def __init__(self, number, suit):
        if number > 10:
            number = 10
        self.number = number
        self.suit = suit

mycard = card(10, "daimonds")
print(mycard.number)
print(mycard.suit)``` im new to python is this good
rare gazelle
brisk gazelle
#

```py
...
...
...
```

bronze dragon
brisk gazelle
#

snake_case your mycard variable and PascalCase your card class name.

#

!pep8

edgy krakenBOT
#
PEP 8

PEP 8 is the official style guide for Python. It includes comprehensive guidelines for code formatting, variable naming, and making your code easy to read. Professional Python developers are usually required to follow the guidelines, and will often use code-linters like flake8 to verify that the code they're writing complies with the style guide.

More information:

brisk gazelle
#

Mind your spelling.

#

diamonds vs daimonds

terse mauve
spice hill
half pewter
#

ow ow ow caffeine migraine ๐Ÿ™

quartz fulcrum
#

i want to use codex and claude's specials...

#

can anyone help me use these

half pewter
#

@honest cradle not a bot, just a regular here who appreciates seeing someone who's making the effort.

half pewter
quartz fulcrum
#

i heard claude is better for coding help

dry pike
#

drinking a 473ml redbull at 8pm was not a good idea

half pewter
half pewter
dry pike
#

honestly I have no idea what you mean

vapid mural
#

Where can i learn filesystem UI/UX design? I want to add some style and better experience using it. Maybe there is nothing to think about and somewhat copy windows design

half pewter
bronze dragon
pallid garden
#

like a file explorer?

vapid mural
#

I do got a video sample that i could show but if im allowed to upload it somewhere here or i can post on yt and share a link if im allowed

bronze dragon
#

you can share links yeah

half pewter
#

spun out I guess? third eye blind wrote a whole song about it

vapid mural
#

gime me a sec, im not sure about how its called its sort of file explorer and sort of file system

quartz fulcrum
#

i don't want to stay behind in tech things...
Can someone explain how codex works...or give a n example

haughty crane
#

is dijkstra really most efficient

bronze dragon
#

well, also depends on your goal

haughty crane
haughty crane
bronze dragon
#

A* is better if you just care about the path between two specific nodes
Dijkstra will give you the shortest path between one specific node and all other nodes

vapid mural
#

Here it is

#

It does work similar to file explorer but it has more functionality that fits for my app desires

bronze dragon
#

it's a bit confusing where one is at any point

#

like am I looking at boxes or categories (and what's the difference) or questions

#

file explorers have a location bar to tell you where you are at all times

brisk gazelle
pallid garden
#

the good ones do, at least

vapid mural
#

Well as it, its not FileExplorer app its Leitner System app, im allowing to create directories to sort things out and i create directory with suffix .box to know if you can run it

bronze dragon
# pallid garden usually

funny thing, I first started the sentence with "most", then deleted it because I felt like it was too much hedging.

vapid mural
#

Its just a prototype at this stage but i want to explore my options forwards

pallid garden
#

anyway @bronze dragon is right, you should include a location bar

vapid mural
#

Noted

rare gazelle
#

one interesting thing
if not iterable: is useful also when handling iterators
if iterable: means that maybe the iterable is empty, maybe not
but if not iterable: means that the iterable is empty for sure

#
if not iterable:
  ...
else:
  ...

could be a reasonable pattern

vapid mural
#

I also for quick prorotyping use menu bar to do the work but i feel like it can get annoying to move mouse there so maybe adding some shortcuts or like right click dropbox windows have might be good

granite wyvern
half pewter
#

i wasn't aware that iterable was an attribute of anything by design

rare gazelle
granite wyvern
#

oh right

#

I like bool coercion

#

is this a desire featured of iterables you're descriing?

rare gazelle
#

iterator is always truthy, filled iterables are always truthy as well, so you can't know by if iterable if it's full or empty

#

but if not iterable is only right for empty iterables, so you can know by that the iterable is empty for sure

granite wyvern
rare gazelle
granite wyvern
#

So it's not something which can be implemeneted in general.

rare gazelle
vapid mural
#

So is there a good way to learn UI/UX without just searching what works and copying? Copying ofc with the understanding whys and whats

rare gazelle
#

you can still gain the knowledge of when it's empty for sure

half pewter
#

I'm not really part of this conversation but num iterables is when someone usually brings up len()

rare gazelle
granite wyvern
rare gazelle
#

if not iterable would only enter if it's empty for sure

#

the else would mean, maybe its empty, maybe not

tame vapor
#

how would u "copy" UI/UX

rare gazelle
#

its the equivallent to the pattern:

if isinstance(iteralbe, Collection) and not iterable:
  ...
else:
  ...

equal to

if not iterable:
  ...
else:
  ...
granite wyvern
tame vapor
#

other than just looking at what is there and making it on ur own app

vapid mural
rapid ridge
#

Anyone using napari ?

tame vapor
#

like , "this website has a navbar , they make it collapse when the screen resizes" , like thats just a fact , u just make the same thing in ur app or u dont ๐Ÿคท

gaunt jolt
#

Hii cuties

rare gazelle
vapid mural
#

shit i repeated xD

peak relic
bronze dragon
# vapid mural So is there a good way to learn UI/UX without just searching what works and copy...

the elementaryOS HIG is a good and practical read about some fundamentals of UX design (even if one doesn't always agree with their conclusions): https://docs.elementary.io/hig
you also have books and blogs. I have read, for example, Bruce Tognazzini's blogs on design a lot. this post is good to start with: https://asktog.com/atc/principles-of-interaction-design/. Bruce was one of the first UI designers at Apple way back in the day. I like this a bit more than the eOS HIG.

half pewter
# gaunt jolt Hii cuties

Welcome to the python server, you'll probably get a more agreeable response if you choose intellectual attributes to compliment though.

rapid ridge
half pewter
gaunt jolt
peak relic
half pewter
#

this channel is appropriate for any general topics though

#

I can't imagine rust has a library that's as mature as pytorch, it really is a very nice library

peak relic
#

I guess if they wanted to, they could mix Python into their Rust with PyO3.

#

And that should give them the added advantage of using pytorch... I think

scenic finch
simple willow
#

Can I use my Education PyCharm for Personal Non-Commercial Projects or is it limited to just educational work?

half pewter
#

pycharm has a free teir, I doubt anyones going to care what you do with python that's non-commercial

scenic finch
half pewter
#

i'm sure jetbrains has some nice features in their pro model but a hobbyist is not part of their target paying demographic, definately respect any comercial contracts though

simple willow
#

I was just wondering as I have a student lisence and it has all the pro apps

#

which is just sat there

slow rivet
#

JetBrains IDE licenses for students are strictly for non-commercial educational purposes

minor plover
#

Heyayyaya wsup my gayss andd straightttttt kidsss

simple willow
half pewter
minor plover
simple willow
#

also a code editor is a personal preference

young flicker
#

Cursor

#

Neovim

#

Straight up Python's IDLE

half pewter
#

If I had pycharm pro access I'd probably want to at least try it but tbh I could see it being an issue down the line when I had to switch or pay

simple willow
slow rivet
#

Either way I highly doubt they will care

young flicker
simple willow
#

would it be worth reaching out to someone at JetBrains to further query?

half pewter
#

doesn't cursor consume tokens?

simple willow
young flicker
half pewter
#

thought that was cursors whole gimmick though

simple willow
#

I have used the free tier for months

tame vapor
young flicker
nimble isle
#

does random.choices with weights work with decimal weights? E.g. random.choices([1,2],[0.5,1]) makes 2 twice as likely as 1?

tame vapor
#

!d random.choices

edgy krakenBOT
#

random.choices(population, weights=None, *, cum_weights=None, k=1)```
Return a *k* sized list of elements chosen from the *population* with replacement. If the *population* is empty, raises [`IndexError`](https://docs.python.org/3/library/exceptions.html#IndexError).

If a *weights* sequence is specified, selections are made according to the relative weights. Alternatively, if a *cum\_weights* sequence is given, the selections are made according to the cumulative weights (perhaps computed using [`itertools.accumulate()`](https://docs.python.org/3/library/itertools.html#itertools.accumulate)). For example, the relative weights `[10, 5, 30, 5]` are equivalent to the cumulative weights `[10, 15, 45, 50]`. Internally, the relative weights are converted to cumulative weights before making selections, so supplying the cumulative weights saves work.
young flicker
#

No need to contact jetbrains lol

slow rivet
tame vapor
nimble isle
simple willow
nimble isle
#

also

Weights are assumed to be non-negative and finite
Then why are we allowed negative weights?

scenic finch
simple willow
#

Personal, non-commercial projects that are not for profit and are purely for learning or experimentation are allowed. Yeah I am guessing I can

#

this just came from the AI bot

scenic finch
#

๐Ÿ‘

tame vapor
nimble isle
simple willow
#

and I can upload the code to github as long as I use the built in tool

peak relic
scenic finch
tame vapor
#

i dont think jetbrain will care at all unless ur project starts to make some money or gets popular or something

sacred charm
#

what can this mean ? Step 8
Now, you want to create a string that displays the employee's age.

Start by creating a variable employee_info and assign it the result of concatenating:

the full_name variable.
(a string consisting of the characters is preceded and followed by a space.)

#
first_name = 'John'
last_name = 'Doe'
full_name = first_name + ' ' + last_name
address = '123 Main Street'
address += ', Apartment 4B'
employee_age = 28
jagged belfry
#

free educational licenses are to be used strictly for non-commercial educational purposes.

#

So, so long as you aren't making money with it or doing it for work (and you are a student), you may use the student version

#

Once you become not-a-student you can use their community version for similar non-commerical purposes, but it doesn't come with the Pro features.

peak relic
jagged belfry
#

The license is exclusively there so that companies have to pay and open source does not

tame vapor
#

also they say u should have a space before and after ur string

peak relic
young flicker
peak relic
sacred charm
peak relic
#

Yea I figured

sacred charm
young flicker
#

Employee info generator?

sacred charm
young flicker
#

You wanted to generate fake data?

sacred charm
#

um not really ?

peak relic
simple willow
jagged belfry
#

Then I would assume you're fine

sacred charm
#
employee_info = full_name + 'is' + employee_age
#

this should not work right

#

as the employee_age is a int

peak relic
jagged belfry
sacred charm
jagged belfry
#

IANAL but to me only this line is important:

peak relic
jagged belfry
#

(B) You may not:
(vi) use the Product for any commercial purposes.

#

The rest of it is boilerplate ( you may not share with others, you may not disassemble, you may not re-sell, etc )

sacred charm
young flicker
#

Or you can just str(employee_age)

sacred charm
#
employee_info = full_name + ' is ' + str(employee_age)
print(employee_info)
#

this dont seem to work

young flicker
#

Yep like that

peak relic
young flicker
sacred charm
young flicker
#

The platform?

peak relic
# sacred charm ah ok

Just follow the instructions. It says to assign full name and the " is " and thats it

peak relic
young flicker
#

Damn

sacred charm
#
employee_info = full_name + ' is '
print(employee_info)
``` this worked
#

thankfuly

peak relic
#

๐Ÿ‘

sacred charm
#

tysm

peak relic
#

Just make sure to follow the instructions and you'll be fine

sacred charm
#

ah ok i was thinking beyond โœ…

#

they should have introduced the f strings for that ..

peak relic
#

slowly... but surely...

sacred charm
#

Concatenating many strings using + and converting numbers using str() can get messy and hard to read.

Python 3.6 introduced f-strings to solve this. By adding the letter f before the opening quote, you can put variables and expressions inside replacement fields represented by curly braces {}. For example:

#

they just did it now lol

#

at step 13

young flicker
#

Lol

#

Yes, thats why I asked haha

#

Also at scale, for things like making full name, or full address components, pandas is pretty good and will scale beyond formatted strings once you get to that point

sacred charm
swift turtle
#

But what will you do with this certificate.

young flicker
#

Ya for the certificate alone idk

sacred charm
bronze dragon
#

come on

young flicker
#

Certificates have arbitrary value to others, but if its for yourself and getting a feeling of accomplishment, then its good

swift turtle
#

Yeah I guess.

sacred charm
#

yeah it will look like aprove to smthin idk

peak relic
#

Maybe to HR ppl, they care

young flicker
#

Very few certificates they care about tbh

bronze dragon
#

certificates for basic courses are an anti-signal if anything

swift turtle
#

Lol true.

sacred charm
#

freecodecamp certificate is not good ?

young flicker
#

For a job? No.

swift turtle
#

"Introduction to Python" esque-certificates would probably render an anti-signal.

sacred charm
peak relic
#

its fine to have it

#

but it won't get you past the interview

sacred charm
swift turtle
#

It doesn't hurt your application if you have something stronger to off-put it.

#

Like everyone and their mother probably has that same certificate, you need something to differentiate yourself from the next person.

sacred charm
#

what can that possibly be ?

swift turtle
#

I'm still figuring this out myself twin. ๐Ÿ˜”

young flicker
bronze dragon
swift turtle
#

Agreed.

ocean ridge
young flicker
#

Find a job role you want, match what the job role generally asks.

sacred charm
bronze dragon
young flicker
#

Also if youre trying to go the data route - kaggle datasets will do nothing.

swift turtle
#

Certificates are like a coughing baby compared to the hydrogen bomb that is real-world experience.

ocean ridge
young flicker
#

Everyone and their moms and their moms mom have done kaggle projects

swift turtle
#

Lol.

bronze dragon
simple willow
#

Certs can be good to get a start for learning, but it is not 'Get a Cert, get a job!'

ocean ridge
young flicker
#

Get a degree, get several certs, do several projects =/= get a job, but its a step forward

ocean ridge
bronze dragon
#

do other colleges generally prohibit it? how do they enforce it? pithink

bronze dragon
ocean ridge
bronze dragon
#

yep

sacred charm
#

Define employee_code as 'DEV-2026-JD-001'. After that, create a variable department and assign it the slice of employee_code from index 0 to 3. Then print department to the terminal.

ocean ridge
sacred charm
#
employee_code = 'DEV-2026-JD-001'
department = employee_card[0:3]
print(department)
#

ii am doing it right yeah ?

#

but why it dont accept

young flicker
#

0:2 possibly?

#

If it means 3 elements

sacred charm
swift turtle
#

Eh.

bronze dragon
peak relic
ocean ridge
#

employee_code and employee card

sacred charm
ocean ridge
sacred charm
#

ah jesus

ocean ridge
#
employee_code = 'DEV-2026-JD-001'
department = employee_code[0:3]
print(department)
#

this should work ^

ocean ridge
sacred charm
#

yeah it did

bronze dragon
# ocean ridge whats the requirement

you need to pass 12th I guess? if you mean what the percentile cutoff is generally, I wouldn't know... you can see statistics about that online. the national admissions system (JoSAA) publishes what was the last rank that got into any particular university.

sacred charm
#

yeah good luck finding the terminators ๐Ÿ™

scenic finch
bronze dragon
#

23 I believe.

scenic finch
#

Are they all as good

bronze dragon
#

no, of course. the older ones have more established infrastructure, deeper alumni networks, more funding, better professors, etc.

scenic finch
#

When people talk about making IIT is the goal a specific one?

young flicker
#

@sacred charm wait how old are you? You said your mom wanted you to do it?

sacred charm
#

i am 15

bronze dragon
young flicker
#

Ah gotcha

#

Showing you numpy and pandas would be overkill for you I guess

sacred charm
young flicker
#

Numpy/pandas are data libraries

#

You'd need to understand a lot of statistics, linear algebra to some extent, ideally have an idea of databases and SQL

young flicker
#

You only need the python to learn GUI frameworks really

young flicker
#

Python is strong for scripting and data

sacred charm
#

but the C and C++ talk directly to the hardware and are considerd fast ?

young flicker
#

The majority of the libraries in Python like NumPy and Pandas run under heavily optimized C/C++/Fortran code

#

Python just calls them in a way less boilerplate, safer, and user friendly way compared to those languages

sacred charm
#

thats why it is easy to learn , while being fast ..

young flicker
#

And thats why people dont use C/C++/Fortran instead of Python for things in the data ecosystem

young flicker
#

Except for very niche circumstances, custom approaches, high volume and high performance needs, or research grade things

young flicker
sacred charm
#

i cannot get to understand this :

sacred charm
#

pow(): raises a number to the power of another or performs modular exponentiation.

scenic finch
#

Youโ€™re right

wide elm
#

i have a unfinished github i found thats a good idea if anybody wanna help finish it using ai or smth

grave tree
#

Numpy also provides a nice way to call fortran subroutines from Python code which can be handy

wide elm
#

and its python code too

bronze dragon
sacred charm
#

ah crypto stuff ...

sacred charm
wide elm
bronze dragon
#

see the base**exp % mod bit.

sacred charm
bronze dragon
#

that's what "modular exponentiation" means.

wide elm
grave tree
jagged nacelle
#

Cryptocurrency or cryptographic?

wide elm
#

most countries have crypto tax*

sacred charm
wide elm
bronze dragon
#

try it and see!

grave tree
sacred charm
#

ah well let me try then

wide elm
#

i have deadline tho

#

i gotta file my taxes latest june smth

sacred charm
# bronze dragon yep

ah thanks its just a way to do exponential calculations or it have any other options ?

wide elm
#

and thing is the group that made the github was like 5 years ago but they are crazy coders

bronze dragon
#

it lets you calculate base**exp % mod more efficiently than just doing the exponentiation then the mod

sacred charm
#

we could have been done it using 2**2 but why we did the using pow ?

wide elm
#

they work for crazy startups

sacred charm
#

whats the speciality

grave tree
sacred charm
#

% mod meaning the remainder ?

unreal vigil
#

a local project with git can still use the files from gitignore, right? just that it doesn't look at the changes there

hybrid nebula
#

yes, a lot more efficiently

bronze dragon
#

gitignore is just about what gets staged (and eventually committed/pushed)

sacred charm
#

like 2 to the power divided by remainder of mod ?

bronze dragon
#

the files themselves still exist

hybrid nebula
#

challenge: calculate 2 ** 1000000000000 % 3

grave tree
#

The project can use the files, git just doesn't track any changes to them

wide elm
#

but the github looks good tho

sacred charm
final hollow
#

I might just switch to codeberg at this point because GH has lost a lot of my trust

hybrid nebula
hybrid nebula
sacred charm
sacred charm
hybrid nebula
#

no

hybrid nebula
#

wdym?

sacred charm
#

never calculate? ?

#

a**b never calculate it ?

hybrid nebula
sacred charm
#

whatever , i got the idea ...

fiery yarrow
#

why do i keep running into weird quirks of the typing system sobMeltdown

final hollow
#

Gonna make a new set of operators

<(*-*<)
(^*-*^)
(>*-*)>
sacred charm
final hollow
#
(v'-'v)
fiery yarrow
#

i wish fix was here ๐Ÿ˜”

sacred charm
#

freecodecamp is actaully fun and simple

wide elm
#

i had a little python but forgot a lot

gleaming knoll
brittle merlin
#

I finally understand all the AI generated async code in my codebase ๐Ÿ˜ƒ๐Ÿ˜ƒ๐Ÿ˜ƒ

sacred charm
young flicker
young flicker
#

Like uh

#

Idk, pi maybe?

sacred charm
#

pi = 3.14

#

thats what i know xD

gleaming knoll
#

๐Ÿฅง = yummers

sacred charm
#

what is this ? ฮป

young flicker
sacred charm
#

a lot of thing ?

young flicker
#

Means something in math, something in stats

sacred charm
young flicker
#

And its the symbol for lambda (the Greek letter for L)

#

And lambda functions are like one time/single use function

#

Anonymous functions

sacred charm
#
final_bill = running_total / num_of_friends
print('Bill per person:', final_bill)

each_pays = round(final_bill)
print(f'Each person pays: {each_pays}')
#

and the heading : Use the round() function to round final_bill to two decimal places and assign the result to a new variable named each_pays.

Finally, use print() to display the string Each person pays: followed by a space and your each_pays variable.

With that, the bill splitter workshop is complete.

#

it dont work ...

gleaming knoll
#

i think you're supposed to round to 2 decimal places, but by default round rounds to an integer

sacred charm
#

how to do that ?

gleaming knoll
#

!d round
it has a 2nd parameter for the amount of places to round to

edgy krakenBOT
#

round(number, ndigits=None)```
Return *number* rounded to *ndigits* precision after the decimal point. If *ndigits* is omitted or is `None`, it returns the nearest integer to its input.

For the built-in types supporting `round()`, values are rounded to the closest multiple of 10 to the power minus *ndigits*; if two multiples are equally close, rounding is done toward the even choice (so, for example, both `round(0.5)` and `round(-0.5)` are `0`, and `round(1.5)` is `2`). Any integer value is valid for *ndigits* (positive, zero, or negative). The return value is an integer if *ndigits* is omitted or `None`. Otherwise, the return value has the same type as *number*.

For a general Python object `number`, `round` delegates to `number.__round__`.
young flicker
#

^

fiery yarrow
#

lambda you're kind of a typing enthusiast, right?

sacred charm
#

ah thanks i didn't paid attention on the time i was learning that

gleaming knoll
young flicker
#

You could also round the formatted string so you only round what you print and not the actual values, but its probably not what youre being asked for

gleaming knoll
#

and i am not kind

gleaming knoll
fiery yarrow
#

why are the two returns treated differently by pyright

@dataclass
class Foo:
    x: int

class FooCollection(NamedTuple):
    foo1: Foo
    foo2: Foo
    foo3: Foo
    foo4: Foo

def order_foos(foos: list[Foo]) -> FooCollection:
    match foos:
        case [Foo(x=1) as f1, *f, Foo(x=4)]:
            # Expected 4 positional arguments
            return FooCollection(f1, *f, None)
            # no squiggles
            # return FooCollection(*[f1, *f, None])
young flicker
#

Mhm just use the round function

sacred charm
#

that will be not accurate

gleaming knoll
light ore
sacred charm
#

dont click random links

#

Socrates ~

young flicker
sacred charm
gleaming knoll
#

for tuples the size is known in the type so that shouldnt happen

young flicker
#

Round(whatever, 2) - rounds to two decimal places

fiery yarrow
#

hmm switching to exploded tuple still has the same complaint as the no-list version

#

on-hover says that the match wildcard f is list[Foo]. i wonder if pyright thinks that FooCollection is getting only 3 values (or maybe even 2 for an empty list?), or some unknown giant number firT

sacred charm
#

what can this possibly mean ? : In Python, every value has an inherent boolean value, or a built-in sense of whether it should be treated as True or False in a logical context. Many values are considered truthy, that is, they evaluate to True in a logical context. Others are falsy, meaning they evaluate to False.

gleaming knoll
velvet trout
#

When we can't?

bronze dragon
gleaming knoll
bronze dragon
sacred charm
velvet trout
#

That's sad

fiery yarrow
#

numpy arrays i think don't like being booled

bronze dragon
velvet trout
quartz fulcrum
velvet trout
#

Empty strings are false

Even str() -> makes an empty string

gleaming knoll
sacred charm
#

ah ok so evry occupied string is truth ?

velvet trout
#

Yeah, its the truth of the universe

sacred charm
#

and this ```py
print(bool('')) # False

velvet trout
#

The ultimate reality

sacred charm
#

is false right

velvet trout
#

Yes

bronze dragon
quartz fulcrum
#

yes

sacred charm
#

not augmented assignments ...

#

i will never remember that ...

bronze dragon
sacred charm
#

it confuses me just ,,

quartz fulcrum
#

what else is false

bronze dragon
sacred charm
#

in non or empty idk

sacred charm
#

i think

velvet trout
#

empty -> False
is not empty -> True

sacred charm
#
print(bool(False)) # False
print(bool(0))  # False
print(bool('')) # False
tame vapor
sacred charm
tame vapor
sacred charm
#

nah i mean i know it since i was born

#

๐Ÿ˜€

gleaming knoll
young flicker
#

Binary is all 0s and 1s

velvet trout
sacred charm
#
is_citizen = True
age = 25

print(is_citizen and age) # 25
velvet trout
sacred charm
#

this confuses me ?

gleaming knoll
# gleaming knoll ok so uh it seems like typecheckers assume that a `*args` of types of variable s...
def take_4(_0: int, _1: int, _2: int, _3) -> int:
    return _0

def unpack_list(xs: list[int]) -> None:
    take_4(*xs) # assumes that it will match, works

def unpack_fixed_tuple(xs: tuple[int, int, int, int]) -> None:
    take_4(*xs) # for tuples it can check exactly

def unpack_variadic_tuple(xs: tuple[int, ...]) -> None:
    take_4(*xs) # like with a list

def unpack_list_inbetween(xs: list[int]) -> None:
    if len(xs) == 2:
        take_4(0, *xs, 3) # too many? what

def unpack_fixed_tuple_inbetween(xs: tuple[int, int]) -> None:
    take_4(0, *xs, 3)

def unpack_variadic_tuple_inbetween(xs: tuple[int, ...]) -> None:
    take_4(0, *xs, 3) # doesnt work
    if len(xs) == 2: # this actually narrows the tuple type so it works
        take_4(0, *xs, 3)
velvet trout
#

I don't eat children in dish

sacred charm
gleaming knoll
velvet trout
fiery yarrow
gleaming knoll
sacred charm
#

911 , whats you emergency ? there are childs in a guys basment

velvet trout
#

*args: int or explicitly is Unpack[int]

How about **kwargs or wait is Unpack for **kwargs?

velvet trout
#

Nuke this guy

sacred charm
#
age = 19
``` is this truthy ?
sacred charm
gleaming knoll
gleaming knoll
fiery yarrow
#

i wonder if that's noticed and intended behavior

sacred charm
#

49 out of 526 steps completed ...

#

that pisses me off

fiery yarrow
gleaming knoll
#

i love simple meal ready to eats

velvet trout
velvet trout
sacred charm
velvet trout
#

-1 -> True, 0 -> False, 1 -> True

sacred charm
velvet trout
#

Isn't that simple

sacred charm
#

i should work on my project now ..

sacred charm
velvet trout
sacred charm
#

anyone have um sya 1920x1080 screen ?

velvet trout
sacred charm
#

i am working on a youtube automator .. which requires the comment section screen coords

#

mine have 1280x1024 screeb

#

so i want the 1920x1080 screen coords

native coyote
#

guys, I dont get bottom up dynamic programming ๐Ÿ™

sacred charm
#

bcz its the res most ppl have

sacred charm
#

which spams

#

it is for creators who want to automate replying their comments section

gleaming knoll
# native coyote guys, I dont get bottom up dynamic programming ๐Ÿ™

do you get top-down dynamic programming? you start with the "big problem", and express its solution as doing something to the solution of a smaller problem, and that chains until you get to the smallest problem
bottom-up changes the order in which you start subproblems to start at the smallest problem, and have the solution to the next problem depend only on the solutions to already solved, smaller problems. then you chain that "next solution" until you get to the one you want

bronze dragon
#

I think your viewers will notice, lol

sacred charm
gleaming knoll
native coyote
native coyote
gleaming knoll
dry yacht
native coyote
wise yarrow
gleaming knoll
#

yeah, in both cases you're expressing 1 solution as depending on others

rare gazelle
#

set's lt, gt, is actually not very correct, typing wise

#

its an interesting concept with NonImplemented, maybe it's type correct

rare gazelle
#

on eq when NonImplemented is returned no error is raised when doing ==

#

on lt for example, an error is raised on NonImplemented when doing <

gleaming knoll
dry yacht
rare gazelle
#

technically, lt accepts any object, just like eq

#

yet it's typehinted as accepting only AbstractSet

gleaming knoll
rare gazelle
#

i'm talking about set's lt

gleaming knoll
#

no, im saying that there is no reason for __lt__ to accept an arbitrary object

#

__eq__ accepts an arbitrary object because its part of object
object.__lt__ doesnt exist, so some_cls.__lt__ is free to typehint it as accepting whatever

dry yacht
rare gazelle
#

    def __le__(self, value: AbstractSet[object], /) -> bool: ...
    def __lt__(self, value: AbstractSet[object], /) -> bool: ...
    def __ge__(self, value: AbstractSet[object], /) -> bool: ...
    def __gt__(self, value: AbstractSet[object], /) -> bool: ...
    def __eq__(self, value: object, /) -> bool: ...
gleaming knoll
#

thats what i said, yes

dry yacht
rare gazelle
#

i dont understand what u're saying

#

what i'm saying is that lt is accepting every object as well

gleaming knoll
#

then what you're saying is wrong

rare gazelle
#

< raises an error

#

but lt isn't raising an error

#

it might return NotImplemented though

#

but eq might return NotImplemented as well

#

the only difference is that on eq NonImplemented there is no error raise, on lt there is

gleaming knoll
#

NotImplemented is not reflected in the typesystem at all

rare gazelle
#

(when doing == and <)

rare gazelle
distant garnet
#

does anyone know kivy?

brisk gazelle
#

Not for some time.

gleaming knoll
#

what are you actually saying?

dry yacht
rare gazelle
dry yacht
rare gazelle
#

as a flat function, it raises no error, it could be written exactly like eq

#

yet eq accepts all objects, lt accepts only abstract set

rare gazelle
gleaming knoll
#

there is not much reason for "1" == 1 to typecheck, its just Liskov Substitution
object.__lt__ does not exist, so each class is free to define the argument type to __lt__ as specifically as it wants. typeshed defines it to be the one that will actually work at runtime, to prevent more errors statically

dry yacht
rare gazelle
#

well, you might think of it like this

#

but < is different than __lt__

#

it handles NotImplemented, and reflaction

#

reflection*

brisk gazelle
#

@distant garnet Is there a question forthcoming? ๐Ÿ™‚

rare gazelle
#

on NotImplemented it raises an error (in set, for exmple)

rare gazelle
distant garnet
gleaming knoll
rare gazelle
#

since it technically does

gleaming knoll
rare gazelle
brisk gazelle
edgy krakenBOT
#
Go-to beginner resources

Here are the top free resources we recommend for people who are new to programming:

For a full, curated list of educational resources we recommend, please see our resources page!

brisk gazelle
#

OOPS, as opposed to Kivy, whuch I haven't touched for a long while.

gleaming knoll
rare gazelle
#

it returns NotImplemented

gleaming knoll
rare gazelle
#

yes, but lt isn't wrapping < or reflecting on it

#

its the other way around

#

relying* not reflecting

#

if you think of lt as a function for itself, why it needs to care about <

gleaming knoll
#

you're proposing to allow code that will error in 99.9999999% cases just because some single person might implement Cls.__gt__(set)

gleaming knoll
rare gazelle
#

but since it doesn't, and it never errors on any object

velvet trout
#

lazy import x

is x present in dunder dir of that module?

rare gazelle
gleaming knoll
rare gazelle
#

maybe its a special case with NotImplemented

#

its kind of weird

gleaming knoll
rare gazelle
#

yea but maybe when you return NotImplemented you think about what would happen then

rare gazelle
#

and base your type hints on that

gleaming knoll
velvet trout
#

I guess i will copy this behaviour too in my PEP 562 implementation for pre 3.15 versions

gleaming knoll
#

i'd prefer people to not write insane dunders

velvet trout
rare gazelle
#

maybe it'd be better if NotImplemented wouldn't exist to begin with

dry yacht
# gleaming knoll i'd prefer people to not write insane dunders

Keeping it easy and readable ๐Ÿ’ :

class Composition:
    def __init__(self, f):
        self.f = f

    def __rshift__(self, g):
        def wrapper(*args):
            return g(self.f(*args))

        return Composition(wrapper)

    def __call__(self, *args):
        return self.f(*args)


@Composition
def compose(*args):
    return args[0] if len(args) == 1 else args
rare gazelle
gleaming knoll
#

maybe yeah
lhs could explicitly call the respective dunder of the rhs, if it wants to allow it to implement the operation

rare gazelle
#

i've made a pipe class

#

its pretty long

#

say you want to connect pipes together, or disconnect, etc

velvet trout
#

Other than .po and gettext and json/yaml/toml, what else do y'all use for text translations? And do you keep key by english words or by a prefix + N where N is an integer starting from 0

rare gazelle
#

when you think about all the combinations its a big head ache

#

what if you wnat to add a function to the start, what if to the end, and all that bbullshit

#

i've also made pipes immutable, and hashable

thorn mist
#

i was trynna make a parabola jump but i fumbled ```py import pygame
pygame.init()
screen = pygame.display.set_mode((1280,720))
clock = pygame.time.Clock()
running = True
dt=0

player_pos = pygame.Vector2(640,360)
while running:
for event in pygame.event.get():
if event.type == pygame.QUIT:
running = False
fade = pygame.Surface((1280, 720))
fade.set_alpha(100)
fade.fill("purple")
screen.blit(fade, (0, 0))
pygame.draw.circle(screen,"red",player_pos,40)

keys = pygame.key.get_pressed()

if keys[pygame.K_SPACE]:
    if player_pos.y < 720:
        for i in range(1,100):
            x = i * 0.1
            y = x * x
            player_pos.y -= 300 * dt * y * 10
if keys[pygame.K_s]:
    player_pos.y += 300 * dt
if keys[pygame.K_a]:
    player_pos.x -= 300 * dt
if keys[pygame.K_d]:
    player_pos.x += 300 * dt
pygame.display.flip()
print(player_pos.x,player_pos.y)
if player_pos.x < 0:
    player_pos.x = 0
if player_pos.y < 0:
    player_pos.y = 0
if player_pos.x > 1280:
    player_pos.x = 1280
if player_pos.y > 720:
    player_pos.y = 720

dt = clock.tick(60)/1000

pygame.quit()```

edgy krakenBOT
#

Hey @thorn mist!

Please edit your message to use a code block

Make sure you put your code on a new line following py. There must not be any spaces after py.

Here is an example of how it should look:
```py
print('Hello, world!')
```

This will result in the following:

print('Hello, world!')```
dry yacht
rare gazelle
#

its my own thing, i dont wrap anything

#

i was inspired by Mamoun, from this server, he also had an implemention for it (but mine is completely different)

bronze dragon
rare gazelle
#

(he called it pipe)

gleaming knoll
rare gazelle
#

i haven't published my implementation, but there's a thread of it at its early stages, that i opened in here

dry yacht
# rare gazelle (he called it pipe)

Can you explain what a "pipe" in your context is (or how it differs from the

unidirectional data channel that can be used for interprocess communication
)

rare gazelle
#

composition basically

#

Mamoun called it pipe

#

out of respect, i used that name as well

dry yacht
rare gazelle
#

that thread is no where near the final implementation, but it represents the idea

rare gazelle
#

it gets pretty messy

#

getting it to work well with typehints

#

and all the possible combinations

dry yacht
rare gazelle
#

he called it pipe, so i called it pipe

#

i guess its the answer to this python question that sometimes pop, of something recently i'm proud of, or maybe, was really fun to work on

autumn forge
#

it would be cool if you could partially apply each piped function

#

like P = pipe; P(a, 1, 2) | P(b, 2) | P(c, 3), where a, b, and c all take 2 positional arguments

rare gazelle
#

not sure what u're saying

autumn forge
#

ah my example makes no sense, edited it

gleaming knoll
#

is that

c(b(a(1, 2), 2), 3)
# 
_0 = a(1, 2)
_1 = b(_0, 2)
_2 = c(_1, 3)

?

autumn forge
#

yes

dry yacht
#

aaaah

willow elbow
#

helloworld("print")

autumn forge
#

maybe you could do this with a decorator instead...py @piped def a(x, y): ... @piped def b(w, z): ... a(1, 2) | b(2) | ...

#

that would be nasty

gleaming knoll
#

but to get the actual value you'd need to (a(1, 2) | b(2)).value then
which kind of sucks doesnt it

autumn forge
#

hm, true

#

yeah that does kinda defeat the point

gleaming knoll
granite wyvern
quartz fulcrum
#

@granite wyvern can you help me in the thread..

granite wyvern
#

yes just reading it now

rare gazelle
#

in my version pipes can be connected and disconnected, combined in whatever way

#

but if you want to use a function with given argument you can pass a partial

rare gazelle
#

because partial can't do partial(x, ..., 1,2,3,4)

#

def partial_mod(function, *args, **kwargs):
    @wraps(function)
    def function_wrapper(*additional_args, **additional_kwargs):
        function_args = []
        function_kwargs = kwargs | additional_kwargs
        
        additional_args_iterator = iter(additional_args)

        for arg in args:
            if arg is not Ellipsis:
                function_args.append(arg)
            else:
                function_args.append(next(additional_args_iterator))

        function_args.extend(additional_args_iterator)

        return function(*function_args, **function_kwargs)

    return function_wrapper
#

you can use this for it

bronze dragon
rare gazelle
autumn forge
#

yeah there's a new Placeholder object you can use there

rare gazelle
#

every function i write eventually goes to the garbage i guess

bronze dragon
#

see the bit about Placeholder

rare gazelle
#

ew

#

well, you can use a different name i guess

#

Placeholder as _

#
from functools import partial, Placeholder as _
remove = partial(str.replace, _, _, '')
message = 'Hello, dear dear world!'
remove(message, ' dear')
brisk gazelle
bronze dragon
rare gazelle
#

its basically the same

bronze dragon
#

yeah yeah

autumn forge
rare gazelle
#

x as _ or _ = x

rare gazelle
#

although i like the _ solution, i might use that as well

#

_ = ... is also neat not gonna lie

velvet trout
#

os.path.basename() faster than Path().name? ducky_concerned how much?

edgy krakenBOT
#

Source code: Lib/timeit.py

This module provides a simple way to time small bits of Python code. It has both a Command-Line Interface as well as a callable one. It avoids a number of common traps for measuring execution times. See also Tim Petersโ€™ introduction to the โ€œAlgorithmsโ€ chapter in the second edition of Python Cookbook, published by Oโ€™Reilly.

velvet trout
rare gazelle
#

i dont like combbining os paths with Path

velvet trout
#

i ain't combining, am picking either

rare gazelle
#

i'm saying that you should pick what you already use, if you use Path stuff then use Path

velvet trout
#

class Command(Parameter):
    def __init__(
        self,
        name: str | None = None,
        *,
        aliases: str | Sequence[str] | None = None,
        parse_mode: ParseMode | None = None,
        subcommand_required: bool = False,
    ) -> None:
        self.name = name or Path(sys.argv[0]).name

Path() will probably be used for root-level command which is usually once

bronze dragon
# velvet trout ipython?

IPython has special magic for it (%timeit for a single line, or %%timeit for a whole cell)
but the timeit module exists independently of IPython

velvet trout
#

Ooohhh

rare gazelle
#

(Path is normally considered slower than os)

velvet trout
rare gazelle
#

yea i think thats the correct route to go with

velvet trout
#

Obviously i can shh ruff

gleaming knoll
#

(you wont find performance issues)

velvet trout
#

Owo

rare gazelle
#

i dont use pathlib normally, but its just me i guess

#

its normally fine

velvet trout
#

I mean,... Os isn't even a built-in, you gotta import, so yeah i wouldn't find issue importing pathlib

rare gazelle
#

yea

#

i think that if you dont face performance issues (and as lambda said, u won't, normally at least) picking pathlib is better for all cases

gleaming knoll
#

there is no need for this "normally"

velvet trout
#

I don't like having such a verbose name with keyword or containing in it, although its the most concise and clear enough name i have got, do you guys can suggest me better name over specifier_or_option ?

def remove_option(self, specifier_or_option: str | Option, /) -> Option:
        if isinstance(specifier_or_option, str):
            try:
                option = self._specifier_to_option[specifier_or_option]
            except KeyError:
                exc_message = f"Option with specifier {specifier_or_option!r} not found"
                raise ValueError(exc_message) from None
        else:
            option = specifier_or_option

        try:
            self._options.remove(option)
        except ValueError:
            exc_message = f"Option not found: {option}"
            raise ValueError(exc_message) from None

        for specifier in option.specifiers:
            del self._specifier_to_option[specifier]

        return option
rare gazelle
#

spec_or_opt

velvet trout
gleaming knoll
# gleaming knoll there is no need for this "normally"

there is no application that you would run that does anything meaningful, such that when profiled, you'd find Pathlib().name taking such a significant amount of time such that even if os.path.basename was faster, it would be worth switching to it

rare gazelle
#

altohugh spec might refer to spec..

velvet trout
#

I also have marked it as pos-only

bronze dragon
velvet trout
bronze dragon
#

just say option then

rare gazelle
velvet trout
#

Is this my chance to use NewType ?

bronze dragon
#

option: str | Option, that is

rare gazelle
#

maybe make 2 functions?

#

remove_specifier remove_option

bronze dragon
#

fundamentally the "specifier" also just represents an option
so there's no user-visible need to distinguish it from an Option object

velvet trout
#

pithink hmmm, but option: Option is also used in lots of places. Won't that knowledge collide with the user?

rare gazelle
#

why not just calling it option yea...

bronze dragon
rare gazelle
velvet trout
#

i am afraid they would think its about concrete Option than a str lol... Is it okay

rare gazelle
#

either all supporting str and not, or just Option in all

bronze dragon
#

you should aim for a consistent interface unless there is a strong reason to only take Option in some places and take str | Option in some

velvet trout
bronze dragon
velvet trout
#

What from typing would be appropriate for making a typename Specifier instead of str

#

type Specifier = str ?

NewType(str)?

bronze dragon
velvet trout
rare gazelle
#

a class that wraps or subclasses str

velvet trout
bronze dragon
#

like I hover over it, I see Specifier | Option, that doesn't immediately tell me that yeah Specifier is actually a str

velvet trout
#

pithink you're right

rare gazelle
#

yea if its just str i'd use str

bronze dragon
#

unless I already know that issubclass(Specifier, str)

velvet trout
#

specifier is always a str everywhere

rare gazelle
#

then maybe 2 different functions

#

remove option and remove specifier

velvet trout
#

I feel like i am making a bad designed code lol

velvet trout
unborn frigate
#

mates is tehre a chat here where I can ask for an opinion? I dont want specifically help with something but to understand a concept for jupyter notebooks

rare gazelle
bronze dragon
#

or, just take Option, and have a user-visible way to get_option_by_specifier

rare gazelle
unborn frigate
# cerulean ravine ask here

thanks mate, aight so Im new to python comin from C++, C# languages that I used for game dev.
I had this class that Im using Jupyter notebooks, but I treated it like a normal IDE. When i try to break my code in smaller pieces, nothing works not even if i try to boot like 4 lines of code. So I am confused

rare gazelle
#
def _remove(whatever):
  ...

def remove_a(x):
  ...
  return _remove(x)

def remove_b(y):
  ...
  return _remove(y)
bronze dragon
pallid garden
#

you cant split up one function into 2 cells, for example

gleaming knoll
bronze dragon
#

each cell has to be independently syntactically valid

unborn frigate
# bronze dragon can you clarify what you mean by "nothing works"? do you get an error, or someth...

yeah i get a huge error, so like

If i tried to run

#file will be provided please correct the right path to use
# used pandas documendation 
file_path = r"FAT - SF6 Frame Data.xlsx"

xls = pd.ExcelFile(file_path)
# check the sheet names and keep the ones with Normall in 
move_sheets = [name for name in xls.sheet_names if "Normal" in name] ``` just these lines I still get error if i press ctrl + enter
cerulean ravine
bronze dragon
unborn frigate
pallid garden
#

ImportError: Missing optional dependency 'openpyxl'. Use pip or conda to install openpyxl.

#

do you know what a dependency is?

unborn frigate
#

ye

gleaming knoll
unborn frigate
#

I assumed that because it worked for my VS codium for another class

#

it woukld be all tehre

hollow rampart
#

Hm

unborn frigate
#

(im on cachyOS if it matters)

pallid garden
unborn frigate
#

no

pallid garden
#

every program is different

unborn frigate
#

ah right I did this thing before in windows

pallid garden
unborn frigate
#

now it makes sense why

pallid garden
#

you will get the same error on windows

unborn frigate
#

ye i mean i must have installed it there

pallid garden
#

why cant you install it on the machine you are currently using

unborn frigate
bronze dragon
#

always read the error

#

even if it's huge

pallid garden
#

we are but veterans who are used to slaying scary monsters /jk

unborn frigate
#

just usually don't get errors so I was so confused even from 4 dialogue lines haha

bronze dragon
#

one of the most important skills is to be able to extract information from huge errors/texts even if you don't fully understand them.
learn to skim.

unborn frigate
#

but you aright

pallid garden
bronze dragon
#

I get like a morbid curiosity. like I wonder what I screwed up to get that big of an error.

pallid garden
unborn frigate
#

we got this ! thank you mates i split it on just my functions and I can see it working now that Im trying to load it cell by cell

grim hatch
#

Good morning

#

What's on the Agenda today

unborn frigate
rare gazelle
#

๐Ÿ˜

velvet trout
#

Where where else is if TYPE_CHECKING: used outside indenting typing-only import stmts?

#

do type checkers read or mutate this constant?

gleaming knoll
velvet trout
rare gazelle
velvet trout
gleaming knoll
#

they do

velvet trout
#

how so and when

rare gazelle
#

TYPE_CHECKING is False at runtime, but True for typecheckers, a trick

velvet trout
#

i mean they just assume, but do they ever import it? Do anything with it other than blind faith that its True? lmao

gleaming knoll
#

no, static type checkers dont run python code at all.

rare gazelle
#

very weird

velvet trout
rare gazelle
#

so you can do:

if not TYPE_CHECKING:

anywhere, and it'd be ignored for all type checkers?

#

๐Ÿคฏ

velvet trout
#

it makes me wonder that ... do they set it to True? or the python itself?

rare gazelle
#

๐Ÿคฏ๐Ÿคฏ๐Ÿคฏ

velvet trout
#

or typecheckers

velvet trout
rare gazelle
gleaming knoll
rare gazelle
#

warn for that

#

Code is not analyzed because condition is statically evaluated as falsePylance

#

yea

#

if not TYPE_CHECKING:
    print("hello")
minor plover
#

HEYAYAYAYAYYAYAYAYYAYAYY MAH BOIIIS

#

AND GAYSSSS

#

WSSSSUP

rare gazelle
#

they analyze it, statically

#

for a static type checker, TYPE_CHECKING is considered True at all times

#

but at runtime, TYPE_CHECKING is False

rare gazelle
#

i know your ign is spammer and it might be hard for you

#

try to resist the temptation

minor plover
rare gazelle
#

๐Ÿ˜

velvet trout
gleaming knoll
velvet trout
rare gazelle
#

type checkers dont run your code

velvet trout
#

/Assumption

rare gazelle
#

TYPE_CHECKING is a constant, located in the typing module

gleaming knoll
#

you can imagine a typechecker as a function Graph[ModuleName, AST] -> Sequence[Error | Warning | Info]

velvet trout
gleaming knoll
rare gazelle
#

a static type checker isn't running any python code

#

it analyzes your file

velvet trout
#

What's the difference between "oh" & "i see" i use them interchangeable to say "oohhh is that so ..."

gleaming knoll
velvet trout
#

I thought they set it for themselves lol

gleaming knoll
#

pithink so you did think they run the code?

velvet trout
#

Won't typing.TYPE_CHECKING makes the indented code inside it unreachable always? Or typecheckers/linters special case it?

gleaming knoll
#

the whole point is that its special cased

gleaming knoll
#

they do qualified_names_to_types["typing.TYPE_CHECKING"] = WhateverStructureTheyUseForRepresentingAType.Literal(True)
so when analyzing a program which has if TYPE_CHECKING: in its source code, the analyzer assumes that the branch is taken, even though at runtime its not

velvet trout
#

Thanks guys

#

Now back to code

autumn forge
rare gazelle
velvet trout
#

How am i supposed to know that... How do you guys know that

pallid garden
velvet trout
#

i = too
g = much
n = water

ducky_concerned

rare gazelle
#

from games

velvet trout
# rare gazelle from games
Specifier = NewType("Specifier", str)

type OptionLike = Specifier | Option

then i can just do:
def def remove_option(self, option: OptionLike, /) -> Option: ...

What do you say?

#

I already have cliargparse/hints.py for OptionLike to be putten into

bronze dragon
rare gazelle
#

or in Option's init accept a specifier

#

or a class method from_specifier

rare gazelle
bronze dragon
#

PathLike also

velvet trout
#

Or maybe i am being biased lol...ducky_concerned i gotta think more

bronze dragon
#

splitting what?

rare gazelle
#

yea PathLike

velvet trout
velvet trout
bronze dragon
rare gazelle
rare gazelle
#

i see, 1 option or specifier, not an iterable

rare gazelle
#

i remembered it as remove_options my bad

gleaming knoll
bronze dragon
velvet trout
rare gazelle
#

eitherway, what bharadwaj suggested is that it'd bbe only Option

bronze dragon
#

it's more orthogonal. it's plausible to me that users would like a way to go from specifier to option generally even outside the context of remove_option.

gleaming knoll
rare gazelle
#

and there'd be a way to create an Option from a specifier

velvet trout