« first day (3371 days earlier)      last day (1593 days later) » 
00:00 - 22:0022:00 - 23:00

12:06 AM
Off the bed. The skeptic in me still feels like that was a scoping question to see how people deal with that situation; I struggle to believe a core dev couldn't do that. I wonder if we'll have a shiny new PEP :) rbrb
 
12:17 AM
dict(map(partial(str.split, sep=':'), ('name:80', 'desc:100')))
can't easily squeeze an asspression in there
dict(map(methodcaller('split', ':'), ('name:80', 'desc:100')))
much better
 
wim
you forgot the int conversion
 
Ah, thanks
Then comp it is
 
wim
this is so dumb, I'm not sure if it's a troll question or what
 
Fortunately someone managed to butcher with an asspression
@wim no
I mean, not troll. I lost 5 minutes on the same thing a few months ago. (But instead of asking on SO I debugged it and facepalmed)
 
wim
hmm, but I think this user has significantly more Python experience than you
no offense
 
12:32 AM
None taken. He's a core dev.
 
 
5 hours later…
wim
5:58 AM
@toonarmycaptain Your wording is causing some confusion here.
 
wim
6:43 AM
s/wording/commit
 
 
2 hours later…
9:04 AM
> Within a repository, the root URL (/) MUST be a valid HTML5 page with a single anchor element per project in the repository.
This PEP got accepted???!!!??!
 
9:18 AM
what is that? the pyPI spec?
yeah, it is. is that a bad design? I don't know anything about web pages
 
user10984358
9:53 AM
Is there a "fancy/techy" sounding term for "My code stores all subprocess calls in a hash so when the next time the same subprocess is called it does not execute instead returns the hashed value, this behavior can be overridden with a flag", I was thinking of calling it In-Memory Caching any other terms?
 
10:07 AM
@Kevin I hear you... even when you play against players (and I managed to get Tier 1 Platinum - would have got Mythic Tier 4. if I hadn't have had stuff turn up that meant I couldn't get to play a few hands) - it gets boring seeing the same aggro decks...
 
@TheNamesAlc just "caching" should be fine, it's usually in-memory. if you want something wordier you can search for the policy that you implemented.
 
user10984358
10:21 AM
will look into that thanks!
 
11:20 AM
Does all the basic operations of a debugger in major IDEs function the same way?

E.g. "(resume program)/(continue)" will continue executing up to (but not including) the next statement at which a breakpoint is placed.

Does all major IDEs implement this basic functionality the same way, or does some implement it as, for instance, up to but **not** including?

Basic debugger operations include: "resume"/"continue", "step"/"step to next line", "step into" ...
I have only worked with JetBrains' IDE and a little bit with VScode
 
All are pretty consistent in their interpretation of "run to cursor" or "run to next breakpoint"
 
Thanks, that was exactly what I wanted to hear.
 
In case you ever find yourself in a console-only environment (no desktop, no windows, no GUI, just command prompt), it would also be good to learn basics of pdb. There is also a curses-based console visual debugger called pudb - I find it kind of quirky but some of the guys at work have gotten very proficient with it.
 
I don't think I ever is going to find myself in such a situation
 
famous last words :)
 
11:40 AM
@PaulMcG I love pudb
when I use gdb I always --tui, so pdb just won't cut it for me
 
My favorite pdb command is 'j', so I can jump backward and rerun a problem part of the code
 
JetBrains' IDE doesn't have one such "jump back" debugger command
that sucks
 
@PaulMcG I can't find that in the pdb docs on my laptop
I didn't know it could do that
 
12:03 PM
@SebastianNielsen None of the UI debuggers I've tried have it
@AndrasDeak It's not completely unbounded, you can only j to lines in the current frame. If you are in an exception handler, you can't j back to before the raise, for instance.
 
Isn't it weird, I have multiply times looked for such an operation ... I wonder what the reason for not including one is
 
rbrb, I'll pick back up when I get to the office
 
12:22 PM
@PaulMcG I see!
@SebastianNielsen storing execution state for each step is expensive
 
It would be nice if they made it possible for the user to choose WHEN to store the giving state of the execution, so that you later have the option to restore and replay the point of interest over and over..
 
user10984358
list(map(id,map(deepcopy,repeat(list(range(4)),5)))) why is this giving the same id for all the instance? isnt it supposed to be difference since it is deepcopy
 
@SebastianNielsen I guess
@TheNamesAlc are you sure that copying the repeat iterator does what you think it does?
 
user10984358
it is going to pass a reference of the same list object which is deep copied?
 
ah, wait, I misread
I tend to find it easier to debug code like that when written as list comprehensions
 
user10984358
12:36 PM
ok one sec
 
plus you're referring to the id of lists that no longer have references, that might be a problem (optimized away by the interpreter)
id is always misleading; when it isn't you can also use is
 
user10984358
i guess that answers why
 
Cabbage. Glorfindel discovered an interesting bug: Tag badges aren't awarded if there is already a regular badge with the same name. I suppose it's not common for a tag name to clash with a badge name, otherwise this bug (probably) would've been noticed earlier.
 
user10984358
print([id(z) for z in [deepcopy(y) for y in [x for x in repeat(list(range(4)),5)]]]) fwiw :/
 
12:43 PM
[x for x in repeat(list(range(4)),5)] is a needless step
print([id(z) for z in  [deepcopy(y) for y in repeat(list(range(4)),5)]])
I see 5 different ids for the record
 
osu
Hello is it possible for me to ask for some help here regarding python coding ?
 
@osu hello. Please read our local rules to see how to ask here :)
the likely answer is "yes"
 
osu
okay thanks !
 
user10984358
I’ll have to see where I went wrong then. Thanks !
 
I can try to compare the two later to see if your mappy is different
otherwise id is a red herring
 
osu
12:48 PM
So I have an issue here, I have this code ( dpaste.com/2QJ8D10.txt ) where I just want to filter some data that I have on a .csv, when doing it it says me UnicodeDecodeError: 'utf-8' codec can't decode byte 0xe8 in position 7: invalid continuation byte , can someone help me regarding this error ? I got some letters with "é è" and stuff like that.
On stackoverlow they have problems with 0xff which is "Position 0" as I remember, but mine is 0xe8, also, i'm a total noob at python, started today lol.
 
@TheNamesAlc it's indeed a reference thing: changing the inner listcomp into a generator comprehension will remove references and there's repetition
>>> print([id(z) for z in  [deepcopy(y) for y in repeat(list(range(4)),5)]])
[140030376989712, 140030378376640, 140030383530224, 140030383940224, 140030381436352]

>>> print([id(z) for z in  (deepcopy(y) for y in repeat(list(range(4)),5))])
[140030384993776, 140030376989712, 140030384993776, 140030376989712, 140030384993776]
If you have a listcomp a list is created and lives during the lifetime of the outer listcomp. With a genexp inside this doesn't happen.
 
user10984358
Not all is repeated but I get the point. Thank you.
 
@osu sounds like your csv file is not UTF encoded, so you have to tell the encoding to python. Odds are it's latin1 or latin2 or similar.
 
osu
How can I do it ?
 
google "pandas read_csv encoding"
 
osu
12:51 PM
okay thanks !
 
and/or look at its docs
 
may be this will help to find the encoding
 
And regarding the encoding: only you can know, or the person who created the text file.
 
but it's slow
 
osu
Okay i'll look at it, thanks alot
 
12:52 PM
no problem
 
1:02 PM
@anky_91 I've never used chardet, but it does have a good reputation. Given enough data, it can make good guesses, and eliminate encodings that don't match the data. But it cannot perform magic. ;) As Andras said, it's always better to check the docs, or ask the person responsible for encoding the data.
 
(The docs was for "how to pass the encoding to pandas")
 
> or ask the person responsible for encoding the data.

... and if they say, "what's encoding?"
 
@PaulMcG Slap them with a wet fish. And if they're an English-speaking Windows user, the odds are high that the encoding is cp-1252.
I'm not a fan of cp1252:
May 2 '19 at 19:42, by PM 2Ring
@roganjosh Vast amounts of HTML has been generated that claims to be ISO 8859-15 in its <meta> tag, but which is actually cp1252. The blame for that is squarely in Microsoft's court.
May 2 '19 at 19:50, by PM 2Ring
The fake ISO-8859-1 thing got so bad that all modern browsers assume that pages claiming to be ISO-8859-1 are really cp1252, and HTML5 made cp1252 the default text encoding, rather than ISO-8859-1. Of course, modern pages ought to use UTF-8, but there's still plenty that don't.
 
1:19 PM
@PM2Ring Agreed :)
 
1:33 PM
@osu 0xe8 is the encoding of è in several popular 8 bit encodings, including Latin1 & cp1252. The UTF-8 error messages make more sense if you know how the UTF-8 encoding works. You can read about that in the Description section of en.wikipedia.org/wiki/UTF-8 You certainly don't need to memorize that stuff, just get a rough idea of the general process.
 
osu
@PM2Ring Yes i've found the encoding that was used on it, it was Windows-1252
 
1:51 PM
I wish I was better at identifying the different dialects of mojibake on sight
"ah, yes, an AE ligature where you might expect to see a smart quote, surely this is a utf-32/Windows-1256 mistranslation"
 
@osu Ok! So if you pass encoding='cp1252' as an arg to pd.read_csv your errors should disappear.
 
osu
@PM2Ring Yes it did fix my error, thanks for the help
 
@osu No worries.
@Kevin I mostly just make a few educated guesses, and use trial & error. Martijn's pretty good at identifying mojibake, as one would expect from a guy with the gold Unicode badge. ;)
 
morning cabbages, folks
 
Cbg, inspectorG4dget
 
1:59 PM
Having educated guesses would be a substantial improvement for me :-) There are as many ways to screw up encoding as there are stars in the sky, so perfect deduction is out of reach
(unless you're Dutch)
Unrelated topic. Today is network connectivity whack-a-mole day. I have two laptops here which can each establish a socket connection with themselves, but not with each other. I'm going to blame... NAT.
 
Damnit Natalie!
 
NAT is easily enabled/disabled from a typical router administrator page, but Comcast in their wisdom have decided to forbid me access to the box sitting in my house unless I can solve their riddles three
 
2:16 PM
Ok, I promised my fattest goat to the bridge troll and I got to the router settings. There's no NAT checkbox, though.
I think I'll click every button in the Port Forwarding menu and see what that does
 
Just got a "unexpectedly lost connection" notification box from Steam so I'm moving in the wrong direction
Unless it's one of those omelette / broken-eggs situations
 
can I provide moral support by means of useless memes?
 
2:34 PM
By all means.
I'm not at the "lie down / try not to cry / cry a lot" stage yet, but I might reach it by noon
I'll pass through "you've just been stabbed in the thigh by a toddler" first
 
To respond to your eggs/omelette comment

https://images.app.goo.gl/gMG6DdqctzmNP7EA8
 
Classic episode
I've been given a "reserved IP address" which I guess is LAN-specific since it starts with a 10. I can't talk to it with ping or my socket program, so I don't know what it's supposed to be for.
 
2:54 PM
@Kevin are you trying via internal IPs?
I thought NAT had to do with external access
Port forwarding likewise
Firewall problem perhaps on the laptops?
 
I'm trying whatever I think will work
 
I mean trying to ping/ssh 192.168.*.*
 
If the Laptops Two can only talk when they're on the same wifi, that's fine
Nothing in the 192.168.?.? range appears to respond to ping
I've tried 192.168.1.1 (my router?) and 192.168.56.1 (the only instance of 192.168 that appears in the output of ipconfig /all)
 
Both laptop and router should tell you the laptops' IPs
on my tp-link router it's DHCP -> client list
 
Ten minutes ago I would have said that the LAN assigns local addresses in the range of 10.0.0.? rather than 192.168.?.?, but none of the 10.0.0 addresses from ipconfig /all will respond to pings either
I don't see any obvious listing for client ips in the router administrator page, but I do see that the router thinks of itself as 10.0.0.1
 
3:09 PM
Suspicious...there should also be a choice for DHCP IP range
(There's a reason I have a custom router after the ISP's modem ;)
 
Yep, I've got a DHCP range here. 10.0.0.2 through 10.0.0.253.
 
So, I have a list folder of .py files that I would like to import into my main file dynamically. How do I do that?

/filesIWantToImport
    bar.py
    spam.py
    eggs.py
main.py    # <-- I want them imported to this file

I tried pretty much all of [these solutions](stackoverflow.com/questions/1057431/…), but neither of them worked. Any ideas?
 
@Kevin that settles it :) try those
 
I would like to be able to do:

from filesIWantToImport import *
 
Network chat paused, Python chat unpaused
At a glance, the top solution in that linked post looks like it ought to work... Curious
 
3:16 PM
MCVE for not working then?
 
Please clarify the requirements. Suppose bar.py contains a variable foo = 23. How do you want to access foo from main.py? print(foo)? Or print(bar.foo)? Or some other way?
I think the linked answer will give you bar.foo but not foo
Cramming all the modules' variables into one big namespace is... Not completely advisable
 
That's what spyder is for ;)
 
Trying to figure out if I can finagle __import__ into emulating from thing import *
I suspect not
Or, is that what the fromlist param is for?
>>> __import__("math", fromlist=("*",))
<module 'math' (built-in)>
>>> sin
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
NameError: name 'sin' is not defined
Darn
 
Other way around? '*', fromlist=['math']? :D
 
3:32 PM
No module named '*', alas
 
<I glance furtively at the "break glass in case of emergency" panel that guards exec() from casual usage>
type is the windows command for "show the contents of the file", if that's not apparent
Let's see if the linked approach works for @SebastianNielsen
In the meantime, back to network troubleshooting
 
Hey, it worked Kevin! Thanks!
 
Any 10.0.* addresses in ipconfig?
 
👆
I hope one day you will forgive me for tainting your code base with exec
Incidentally none of this is necessary at all if you know ahead of time exactly what modules you want to be accessible. __init__.py could just contain from .bar import *; from .spam import *; from .eggs import *, if those are the only three you need
If you're thinking "ah, but I have a hundred modules that I need to import and can't be bothered to type out each one", then nevermind
@AndrasDeak Yep, I've got .1 and .38, both unresponsive to ping
I'm tempted to write a script that pings every IP in range, if I can just figure out how to make subprocess.check_output return meaningful data for nonzero exit codes
 
3:50 PM
Well, the reason why I wanted to achieve this is to avoid bugs that arises when I forget to import newly created files. So I wanted a way to dynamically import all files, so I didn't had to remember to always import each file manually -- it is also kinda nice not to have 10-20 import statements, now that you mention it.
 
I suspect making a super-everything-importer will solve that category of bugs, but create an entirely new category of bugs, along the lines of "oops, I forgot that spam and eggs both define zort and now one is overshadowing the other"
Use your best judgement to decide which category is less painful for you to solve
If you're thinking, "I'll just give all variables globally unique names, like spamzort and eggszort", you're about to reinvent namespaces. Better to simply use the answer from stackoverflow.com/questions/1057431/… which should make it possible for spam.zort and eggs.zort to be accessible, while still only requiring the single from filesIWantToImport import * statement
Ok, in 253*5 seconds I should have a full ping map of my DHCP range
So far the only thing that's responded to ping is this laptop's (public?) ipv6 address, but only when I ping it from itself
 
4:13 PM
@Kevin __import__ only handles the module loading, not the name binding.
 
Yeah, the docs were very insistent that it never mutates the globals argument
I found a couple stackoverflow posts suggesting how to work around this, but a lot of them had disclaimers like "but this doesn't work exactly like from thing import * in obscure corner cases X Y and Z". I got through three of those before I thought "you know what does work exactly like from thing import *? exec("from thing import *")"
 
@SebastianNielsen why do you have 10 to 20 import statements in the first place? for modules that seem to appear/disappear frequently, no less.
even for larger packages that grow over months, I have something like 10'ish import statements that are touched, erm, perhaps three times each at most.
$ python
Python 2.7.10 (default, Feb 22 2019, 21:55:15)
[GCC 4.2.1 Compatible Apple LLVM 10.0.1 (clang-1001.0.37.14)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>>
squirms
 
Ah, I found the router's device listing. It's an accessibility nightmare
 
I have a folder, "tasks", containing a lot of "task" files. Each "task" file, contains exactly one class that is named the same of that of its file.

My vision is to create a "Tasks" class that imports all of these classes and structures them. Whenever another class in my application needs a task, it should call the Tasks class.
I am not sure if I could have done it any better.
 
remember that this is not Java. One class per file is usually an anti-pattern.
 
4:21 PM
Uh ..
 
Is it? What's wrong with it?
 
The device information box has a neat elegant faded bottom border, which just happens to make the final row of data ten times harder to read
The final row happens to be the only row I'm interested in
 
What can I say, I just like how Java organizes everything, and I thought that it would make sense to do it the same way in python.
 
I have one class per file fairly often. But I usually don't have that many classes.
 
@Aran-Fey usually needless duplication. something.my_class.MyClass could just as well be something.MyClass. The module adds nothing relevant.
 
4:24 PM
Well, but the thing is, at this point I don't know how big each "task" class is going to be.
Some "task" files and thus "task" classes might get large, and so I would like to have each "task" class in a file on its own for the sake of consistency
 
One-class-per-file was one of my most hated features of Java. I saw it as just busywork, especially in light of IDEs that can jump to a class' declaration. Also, when I would write classes in a Strategy pattern, I tended to want them all in close proximity. The best I could do was in the same directory, which still required me to jump around multiple file tabs.
 
IIRC Raymond Hetting touched the subject in one of his talks. It's worth watching, even if you don't agree.
 
I don't hate having twenty classes in twenty files. But personally I'd grit my teeth and write out all twenty import statements manually rather than having a dynamic importer.
 
In Python, I like to find the appropriate subclass by walking the base class's __subclasses__() (which really could use a recurse=True argument), and then evaluating a selection method of some sort.
 
@Kevin, but what if you forget one, and it doesn't result in your system crashing?
 
4:28 PM
If you're writing a Task module / factory, then you should only need to do import them all once.
Ideally, it will be impossible for you to forget one, because your testing suite will notice immediately. You are writing a test suite for each task, right? 0:-)
 
@SebastianNielsen "what if you forgot doing what you wanted to do?" applies to basically everything.
No need to sprinkle magic on some niche case.
 
(being somewhat hypocritical here because my own testing suites are never close to comprehensive. But I know this, and compensate by trying very very hard to not forget any imports)
 
Perhaps, I just made some bad design choices that let me to this dilemma.
 
mumble mumble urlparse.urlparse mumble mumble
 
datetime.datetime is worse. Like 10 times worse.
 
4:34 PM
heh
 
Re-evaluating one's high level design is a good idea when you feel like there's no good solution for a low-level organization problem. But even good designs have tricky bits sometimes.
 
@Aran-Fey Jah, I always mess that up!
 
morning cabbage
 
urlparse.urlparse(urlparse.urlparse(...).path) FML
 
Where do you live? It's not morning
 
4:37 PM
:|
 
possibly on the west coast... or Hawaii. That's all I can think of that's still morning
... unless Code just woke up from a nap or such
 
@SebastianNielsen here you go
 
Wait, the Earth isn't flat?
._.
 
to be fair even flat earthers believe in time zones, I think
 
No way man, time zones is nothing but a social construct.
 
4:42 PM
@SebastianNielsen Well some places only differ by whether they observe daylight savings or not. So...
 
soon to come to the EU nearest to you
 
Is anyone available who wants to talk about a matplotlib formatting issuing I'm having?
 
just ask away and whoever can help and will, will respond
 
All right, I found the double secret router administrator page, which is only accessible from Laptop B and not Laptop A
 
hmm, there might be a MAC filter? But you'd have had to set that up
 
4:50 PM
My y-axis scale difference (the difference of the bottom number to the top one) is very small. This seems to tell matplotlib to write a small scientific notation number on the title line at the top of the plot showing a number that sets the scale. I would like to move that text so it does not conflict with the actual title. Anyone messed with that?
 
It's not as if Laptop B is registered as the only authorized box, because I bought it a week ago
 
the situation ^
 
duplicate (see comment); simple typo/thinko stackoverflow.com/q/59649128/874188
 
@kηives not sure what matplotlib.org/3.1.1/api/_as_gen/… does and if it would be enough to switch that
there's also a chance that the offset has an offsetbox which you can find in the children of the axes
 
No particularly novel options in the double secret admin page, but it's nice to know I can get to it
 
4:57 PM
@AndrasDeak thanks, just knowing if the name is "offset" already somewhat helps. My google didn't understand my questions about it based on "tiny text".
 
yeah, it's hard to google, took me a few tries to end up there
 
Last week I told Meatspace Friend X that I couldn't ping Laptop A from Laptop B. He expressed doubt, and I said, "watch, I'll show you". I then pinged A from B, and it worked, first try.
All techies have a personal field which makes electronics behave properly, and X's has always been much stronger than mine
 
I can only do the opposite
 
I need to lure him over and trap him in the guest room a la Cask of Amontillado
 
@Kevin The force is strong with that one.
 
5:12 PM
If I do a traceroute and the very first entry dies with "request timed out", does that mean the router didn't respond? Or is it somehow the fault of the machine itself?
 
I tried a traceroute (from linux) to another machine on this LAN, and I get only one step
 
Hmm. Shouldn't it be two steps? computer A to router to computer B?
 
$ traceroute 192.168.1.103
traceroute to 192.168.1.103 (192.168.1.103), 30 hops max, 60 byte packets
 1  192.168.1.103 (192.168.1.103)  4.301 ms  4.349 ms  4.326 ms
windows traceroute might be different, I don't know
you can try tracerouting the router
one step to the router too
then again my traceroute says something when I try invalid LAN addresses...
ah, !H means "host unreachable". Fair enough.
 
Hmm. Laptop B can ping 10.0.0.1, but Laptop A can't.
 
aloha, long shot - anyone have any experience with deploying (Python) databricks notebooks into a CI/CD pipeline within Azure DevOps?
if yes, can I pick you brain
 
5:21 PM
Laptop A can ping google and example.com, so the problem can't be "laptop A can't ping anything at all"
 
weird
 
superuser.com/questions/442313/… may be relevant, since net view gives System error 6118, just as it describes. It goes on to say that the error is described in detail in the link given. And, of course, the link points to a 404 now.
 
> Got an HTTP 302 response at crawl time
:/
I assume you've already checked your workgroup names
 
Five minutes ago I didn't know that there was such a thing. I have since confirmed that each laptop belongs to a workgroup named WORKGROUP.
 
hmmm
 
5:31 PM
I have 40% confidence that it's the same workgroup, and not two independent workgroups with identical names
 
from what I can read it should be as simple as setting the same name
Don't know what ICMP exceptions are but community.spiceworks.com/topic/…
 
5:53 PM
well, are you sure that Laptop B doesn't just ignore the ping packages?
 
Laptop A prints "General failure" when I try to ping 10.0.0.1 (the router), 10.0.0.124 (Laptop B), or 10.0.0.38 (Laptop A). If the receiving end is ignoring ping packages, then there are no innocent parties
 
wim
6:09 PM
https://github.com/uqfoundation/dill/blob/29a787aac5427317c4601bea6a2acb00851c8e2c/setup.py#L235-L236
https://github.com/uqfoundation/dill/blob/29a787aac5427317c4601bea6a2acb00851c8e2c/setup.py#L299-L300
why do they do code gen / exec?
 
wim
6:31 PM
@Aran-Fey hah, well if you've seen pythonclock.org you know they don't like fancy websites :P
I assume one of the ideas is that any idiot who knows how to run python3 -m http.server can host a simple index
@Arne try and open pypi.org/simple in your browser and tell me if you think it's a bad design?
 
6:44 PM
I'm more concerned about the idea of using HTML to build an API
 
People in here familiar with the Responsibility-driven design concept, how many of you would agree with [this answer](https://softwareengineering.stackexchange.com/questions/403326/responsibility-driven-design)?

The reason why I am asking is because it would be stupid to build my knowledge off of a single dude on the internet, so I am just looking for someone who can vouch for his answer.

- Did the concept really emerge with the CRC cards?
 
wim
@Aran-Fey the "simple" api doesn't prevent you from also specifying a json api
what's the concern?
 
Ah, I didn't realize there were other options
 
Has anyone here ever parsed an .rvt file with Python?
I'm looking to extract 3D vertices from the model--just pointcloud information
 
wim
@SebastianNielsen such discussion might be better fit in java room
 
6:57 PM
cbg
 
@wim, do some Python developers not follow the concept too?
 
@duhaime the only thing marginally related I've seen here is meshio which doesn't seem to support it based on its readme
 
wim
@SebastianNielsen yes I suppose, but they probably wouldn't give it a fancy name or write a textbook about it
 
I don't know ... I wouldn't be so sure about that.
 
idk if this is the right place to ask, but does anyone know why my github repo has 5 unique views, all from people ive personally showed it to, but 11 unique cloners
just out of curiousity
 
wim
7:00 PM
and wouldn't hesitate to deviate if it seemed to be in the way of getting real work done
 
This is within 5 days as well
 
well, you don't necessarily need to look at a github repo before cloning it
 
If developing larger applications with Python then good application design is key, which you'll get from a little planning and e.g. complying to Responsibility-Driven design. Something I think all Python developers would not hesitate to do.
But sure, if it's a smaller application which is often the case when you choose to develop in Python, then they probably wouldn't worry about it.
So I see your point.
 
@AndrasDeak thanks for that! This seems like a useful library, but you're right--it doesn't seem to support any Revit filetypes
 
true, but doesnt it seem a bit unlikely that 11 unique people just happened to download my repo from the command line
over just 5 days
 
7:03 PM
if they have dynamic IP then multiple clones might count as unique clones
 
@3141 if you write to GitHub they could provide you with a list of IP addresses from the clones--why are you curious though?
 
@duhaime no problem, sorry I can't help more
 
GitHub provided my lab with some usage data for our annual reports (I'm in a university) once
 
I might consider writing, and I'm just crious because it seems interesting and unlikely
ah ok
its probably not worth it
 
probably not
 
7:05 PM
Andras' explanation is right, but its strange that they would clone it more than once seeing as its very specific to me
 
there are probably bots bopping about cloning things
 
perhaps now that microsoft owns github they've replaced the backend behind those statistics with the same algorithm that estimates time left for things done by windows
 
ah
yeah bots are probably the best explanation around
well thanks guys
 
wim
grrr ... anyone got tips for speeding up --- Day 12: The N-Body Problem --- ?
 
How much? Beyond brute force?
 
wim
7:16 PM
yeah I mean there must be some trick
Eric says you can solve the puzzles under 15 seconds on 10 year old hardware
this is the last one I have remaining over target (0.3 seconds off)
 
Mine is 3.2 seconds for test + proper, and my 6-year-old laptop was half as fast
 
wim
and my hardware is a lot newer than 10 year old
dang, I must be doing something stupid but our codes are both similar brute force I thought
 
I don't think I did anything smart there beyond numpy tour de force
well, I did trick part 2 but that's necessary
 
wim
last night I was able to get Day 19: Tractor Beam under 1 second. my initial code was something like 30x slower.
 
oh yeah, we talked about this. I saw that using bytes for "hashing" was faster
 
wim
7:23 PM
yeah but this is already changed to use tobytes()
 
for p0, v0 in zip(p, v):
that has to be slow
 
how did you see his code @AndrasDeak?
 
oh woah!
 
I started from his github account first but I didn't remember the name of his repo so I had to defer to the sopython wiki
 
8:06 PM
oh @wim
sorry for late reply but try the barnes hut algorithm
Ive actually been working on this myself, I have some code I could share with you
 
8:46 PM
Say I want to write a descriptor that emits an event (i.e. calls a callback function) whenever its setter or deleter is called. That means I need to do initialization at the class level (create the descriptor) and the instance level (create the events). What's a good way of doing this? Currently thinking of something like this:
class ThingWithEventProperty:
    def __init__(self):
        EventProperty.add_events(self)

    @EventProperty
    def prop(self):
        return self._prop

    @prop.setter
    def prop(self, value):
        self._prop = value

# Usage:
obj = ThingWithEventProperty()
obj.prop_changed.connect(lambda value: print('prop has been set to', value))
obj.prop = 5  # output: "prop has been set to 5"
 
wim
do you want state shared between instances or not?
 
no
 
wim
well that's what EventProperty.add_events will do
 
Yeah, but is the interface nice? There's like a billion other options, like a metaclass or a class decorator
 
wim
does it need state from the instance, or just a reference to the instance itself (pardon the pun)
 
8:52 PM
All I want to do is create the relevant events (i.e. prop_changed), so the instance doesn't need to be in any particular state or anything, no
 
wim
9:12 PM
why the instance level init then?
you are aware, of course, that the descriptor already gets sent the instance reference when invoked?
oh man, pycharm can be so dumb - you have import dateutil in your code and it puts a red squiggle. you mouseover that and it offers to install the missing dependency. you click the button and then it tries to pip install dateutil, which of course doesn't work because the distribution is called python-dateutil
 
great chance for namespace squatters
 
wim
yep, that's what I was thinking
and it hides the console output so they won't even know what hit 'em
 
nice
 
Let's back up a bit here: I need the descriptor to exist at the class level, and separate prop_changed events for each instance
 
wim
so when I asked "do you want state shared between instances or not" you were confused..?
 
9:17 PM
Hmm? But I don't want state shared between instances though?
 
wim
descriptor instances live in the class namespace. but they can also maintain a map of the instances that they are ... descripting on ... in their own instance state.
i.e. the descriptor itself has a __dict__ , independent of the class dict and the instance dict
so, if your descriptor is a class attribute (as it is if you're modelling after "property") then you are going to have one descriptor per N instances
that is not necessarily a problem, mind you, but it is sharing state - and can have consequences for reference counting / garbage collection
 
Sorry, I'm not quite following. If you're suggesting that the descriptor should create a map of instances (and what else? A mapping of instances to other instances?) then that doesn't solve my problem - I need to create the prop_changed event before the descriptor is ever invoked
But to answer your question(s), yes, I understand how descriptors work
 
wim
> I need to create the prop_changed event before the descriptor is ever invoked
why?
 
Because people have to connect their callbacks to the event before the event is triggered
obj = ThingWithEventProperty()
obj.prop_changed.connect(lambda value: print('prop has been set to', value))
obj.prop = 5  # output: "prop has been set to 5"
^ prop_changed is used before prop is accessed
 
wim
9:33 PM
what is obj.prop_changed and where did that thing come from? shouldn't that be a method on the descriptor itself, not on obj?
 
It's an Event object. In the code I posted earlier, it would've been created by EventProperty.add_events(self). It can't be a method in the descriptor because each ThingWithEventProperty instance needs to have its own prop_changed instance
 
wim
That last bit is a non-sequitur
 
Here's a rewrite of it, complete with a simple Event class if that helps
 
wim
no pastebin here sorry
 
Oh. I thought dpaste was the one that's blocked for you
Anyway, to summarize: I need to create a descriptor on the class level, and an Event instance on the instance level (immediately when the instance is created). That's really what it boils down to
 
wim
9:44 PM
why is it important to have an Event instance per ThingWithEventProperty instance is the part I'm not understanding
I mean, it's one possible design, but seems a little wasteful if there can be many instances without any callback registered
I thought it would be better design to keep a sparse map of callbacks-to-instances, and keep that as state in the descriptor itself.
then you don't need this dumb self.callback = lambda: None on everything
 
It's not strictly necessary, that's true, but the whole lib is based around Event objects, so I'd like to keep using them for consistency
Actually, I suppose I could make the descriptor(s) return short-lived Event objects
Welp. Three days ago the lib was at v1.9, then I made some improvements and bumped to v2.0, and now it looks like there'll be v3.0 tomorrow. Even Chrome doesn't update that quickly
 
you're still nowhere near pip speed
 
ha, that's true
Okay, so help me out with the next design decision here: I want the current way (a separate Event instance for each ThingWithEvent instance) to keep working, but also implement wim's descriptor-based sparse Events. Should I just turn Event into a descriptor, or would it be saner to make two different classes?
class OldWay:
    def __init__(self):
        self.event = Event()

class NewWay:
    event = Event()  # is this fine?
    event = SparseClassEvent()  # would this be better?
 
00:00 - 22:0022:00 - 23:00

« first day (3371 days earlier)      last day (1593 days later) »