« first day (2327 days earlier)      last day (2627 days later) » 
00:00 - 17:0017:00 - 00:00

5:00 PM
rb folks
 
so...no
 
@MooingRawr You should try steel cut oats. Basically, oatmeal is actually more like rice grains, they just usually flatten it out.
Takes longer to cook and involves some soaking - but it's way better
@PM2Ring Runny and old.
Some Vodka, too
 
maybe... I'll give it a try one day if I can get my hands on em.
 
Hello, I'm looking to hire an angry mob.
0
A: Why do (1+1) and 1 returns 1 instead of 2?

Jean-François FabreBoth operands of and evaluate to True because they're different from 0, so True and True is True and True evaluates to 1 when added (using +) to other numbers (it's just a specialized integer). And 1/0 is just a scalar division by zero, which triggers exception. It's not a logical operation.

Well, not angry so much as downvoting-for-the-sake-of-not-confusing-potential-future-readers.
 
or just find the duplicate that most certainly exists and probably is more detailed
 
5:14 PM
@sidnical try to implement adding text to widget dynamically, not everything at once but as user scroll down
 
I tried; couldn't find a good dupe target. Closest was stackoverflow.com/questions/2580136/… – whose accepted answer is very poor.
 
@excaza i'll have to look up how to profile my code in order to find a bottleneck because I dont know what you mean
 
There are questions with good answers, but in those cases the questions were IMO not close enough to be immediately obvious to the (obviously beginner) OP.
 
@marxin I didn't even know that was possible.
 
always a fan of div-0 checks for that kind of question
 
5:18 PM
@sidnical I don't know if its possible in whatever framework you use, but I would try this way
easy solution would be to load page by page, like on website, say for 100 results per page
 
print(1 or 1/0)
 
scrolling might be more tricky
 
DSM
@ZeroPiraeus: did what I could. This is a case where someone knows enough to be dangerous..
 
@DSM ... and what you could was enough! Answer is now deleted :-)
Ta! :-)
 
good idea. I'll see if it makes a difference in usability.
 
5:21 PM
Ok, now I've sated my appetite for public-spiritedness, anyone wanna help me toward a Reversal badge? ;-)
I kid, I kid.
 
@ZeroPiraeus Your answer is a tiny bit confusing. It mentions short-circuiting but then your point 1 implies that both operands of and are evaluated before it's decided which one will be returned
 
You're right; will fix.
 
I'm rather fond of this answer I wrote a while ago stackoverflow.com/a/36551857/4014959
 
In [1]: import dis

In [2]: dis.dis('(1+1) and 1')
  1           0 LOAD_CONST               1 (2)
              2 JUMP_IF_FALSE_OR_POP     6
              4 LOAD_CONST               0 (1)
        >>    6 RETURN_VALUE
I'm actually kind of surprised at the dis of dat.
 
5:31 PM
dis of dat*
 
@WayneWerner Nice alternative approach :-)
 
DSM
@WayneWerner: is it the fact it's 2? Lots of arith ops which can't raise are optimized at compile time.
 
I was mildly surprised by that, but it was actually the JUMP_IF_FALSE_OR_POP part that surprised me. I'm not sure what I expected but that wasn't it.
 
I might be late to this party, but nutella&banana crepes for the win
incidentally, the missus is making crepes (sans bananas I'm afraid)
 
5:39 PM
Melted 70% cacao chocolate, crushed hazelnuts and banana, shurely?
 
@ZeroPiraeus Definitely
 
I'm a tolerant person, I'm sure we can make it work
homework, eh?
you guys should've went into elaborate discussions of (1+1) and 1 being evaluated in unary
 
@wim gh:ionelmc/cookiecutter-pylibrary
tox works, but idk why py.test doesn't work, this kinda sucks for running unittests :D
hmm py.test tests works, but py.test without args doesn't :D
this now has separate src and tests folders
 
@AndrasDeak Oh man, so good. Also you can try creme cheese, powdered sugar, and bananas for "banana cheesecake" crêpes. Or, if you're like me, just pour powdered sugar on it for that extra taste of diabetes.
 
@PM2Ring I think that's an excellent answer -- the only thing I'd add is how true-ish and false-ish is generally assessed
 
5:49 PM
Nah, I dislike cheese in my sweets. Except cottage cheese and tiramisu, but those don't count
 
haha
I python-hammered a question accidentally :D
 
lol. Oops.
 
@MarcusS Thanks! I guess I should add that info to make it more complete and self-contained. I didn't add it originally because I figured that it was getting a bit long, and I expected interested readers wouldn't have much trouble finding that info themselves. ;)
 
@MarcusS I added a link to the docs - don't want the answer getting too long.
 
@WayneWerner I mean, I am glad it was hammered but it was a C question with just tagged because of "I am converting this python code into C and now it crashes"
 
5:54 PM
Ah, you weren't complimenting me. Oops. Yes, @PM2Ring's answer is very good.
 
I won't do it right now though - it's very late, and I'm on my phone.
 
@WayneWerner "Hard to argue with the interpreter/bytecode" No, it isn't
 
@MarcusS So I played about 90 minutes of Hollow Knight yesterday and I'm quite enjoying it.
 
@ZeroPiraeus Yours is a great answer as well XD
 
Thematically it feels very Dark Souls.
 
5:58 PM
@MarcusS 'tis!
 
@Kevin Definitely agree
 
@MarcusS You're doing it wrong.
 
Sorry, the five minutes is up.
 
We used to have those chairs
 
@MarcusS have you consider working in a cryptography field? I think with your excellent math background, you would be good in that field.
 
6:01 PM
I especially felt the similarity when I died deep in the underground and had to trek back to that position to reclaim my currency and the full use of my magic abilities
But it doesn't have Dark Souls' brutal difficulty. I know this because I didn't die three seconds into the first boss fight.
 
@MooingRawr I don't have a math background
 
but you are good with math... :\ is my point
 
The fact that you have an opinion about what does and does not count as a "math background" means that you're qualified
 
@Kevin Careful ... you just qualified thousands of beltway pundits (whose job is to have an opinion on everything) to work in cryptography. That way lies Clipper.
 
DSM
Overhearing a colleague debug a problem with a NY consultant's way-too-long database code. I really need to replace the whole thing with python/postgresql. #thingsillneverhavetimetodo
 
6:11 PM
s/opinion/informed opinion/, then.
 
wim
@AnttiHaapala oh, I've looked at that one , but he pulls in click doesn't he?
I hate click ... might have to make my own template which is just argparse
 
wat, no
I don't have any reference to click
 
wim
oh, right, it's customisable
 
just grep-r'd all the files; just some jquery code in docs, cov
 
wim
which was generated from that cookie cutter
but he must have used non-default parameters to generate it
 
6:24 PM
yeah I am not going to use click
 
wim
man, I've yet to find a nice, simple, standard python lib template ...
all the cookie cutters I've seen are over-engineered
 
well, I want tox + travis and such
 
wim
I just want travis, setuptools, coveralls..
 
tox is ok
hmm this has appveyor too...
you don't want docs? :D
"it's open source, rtfs"
 
Interestingly enough, buildbot source is infintely more helpful than the docs
 
6:31 PM
if you say "no" you will not have a single mention of click or such in your project.
 
which is also why I've started building my own auto build tool :P
kennethreitz and armin projects tend to have really good docs
and, failing that, they have really good source
 
guys when implementing a design pattern, should I strictly follow all the naming conventions of method and classes or I can implement the pattern the way that make more sense as log as i am accomplishing the same result?
 
conventions usually make sense
 
My opinion is the same as it was yesterday
 
Flask Migrate not working for me..
 
6:40 PM
@AndrasDeak Are you married to a left-leaning British journalist? twitter.com/MissEllieMae/status/836641381875613697
 
I don't know how to do a proper migrate.
 
I'd follow the conventions with the caveat that you should be naming your things well.
 
My revision file contains,
 
E.g. if I were doing something like a reactor, I'd have something called "reactor". But it might be "ReactorOfDoom"
 
# revision identifiers, used by Alembic.
revision = '9bd307a576ce'
down_revision = None
branch_labels = None
depends_on = None


def upgrade():
    # ### commands auto generated by Alembic - please adjust! ###
    op.drop_table('user')
    op.drop_table('email_history')
    op.drop_table('event_monitor')
    # ### end Alembic commands ###
 
6:41 PM
@AvinashRaj looks reasonable to me
 
don't know why it tries to drop user, ... tables on db upgrade..
 
because they were auto generated by something or another
 
but where is the code for creating tables?
 
presumably you had a user table and you don't any more
 
Just now only I erased my staging db..
 
6:43 PM
if you want to create a table you'll need to read the instructions for how to do that
 
I want to create new tables on the staging db through flask migrate
 
basically it's just op.create_table(...)
 
I tried deleting my migrations folder in local and run init and migrate command..
But still it won't show the code for creating tables..
Why it fails to detect the models i declared..
 
pretty sure you need to create the tables from the models first
 
@ZeroPiraeus good heavens, no. Also: when the British say pancakes, do they mean crepes?
 
6:48 PM
but I've only used alembic on its own.
 
I think it checks for any change in the local db, if so then only It would add the create tables query.
 
@AndrasDeak Traditional British pancakes are similar enough to crêpes for the words to conceivably be used interchangeably. Scotch pancakes are a whole different ballgame, of course.
A pancake (or hotcake, griddlecake, or flapjack) is a flat cake, often thin and round, prepared from a starch-based batter that may contain eggs, milk and butter and cooked on a hot surface such as a griddle or frying pan, often frying with oil or butter. In Britain, pancakes are often unleavened and resemble a crêpe. In North America, a leavening agent is used (typically baking powder). American pancakes are similar to Scotch pancakes or drop scones. Archaeological evidence suggests that pancakes were probably the earliest and most widespread cereal food eaten in prehistoric societies. The pancake...
 
thanks
 
I want to do python but i think that it does not teach interacies of working of computer can someone correct me or point me to where should i go , i love C and wants to do development work
 
wim
If you love C you probably won't love Python
 
Python can get as intricate as any other programming language but yeah you're probably not going to be writing "close to the metal" like you would with a lower-level language
 
cut the fat, and do assembly
 
Assembly? Whatever happened to punch cards and machine code?
 
7:29 PM
keep it real
@KevinMGranger have you ever dealt with punch cards? I would love to try it once
just to say I did
 
I think the question presupposes that low-level languages are somehow more "real" than high level ones. My advice is to ignore semantics and use the right tool for the right job.
 
@SurajJain Python is a lot further from the bare metal than C. On the other hand, it's unusually forthcoming about its own workings compared to other high level languages, which allows you a different vantage point from which to explore the intricacies of computing.
In other words, there's not much magic.
 
wim
C is like a F-1 car and Python is more like a family sedan
 
I have a punch card from a computing museum, that I filled in by hitting keys on an old punch-typewriter. So, I've "dealt" with them.
A family sedan with LAZERS
 
@idjaw Punch cards? extravagance. All you need is eight on-off switches and a button so you can enter bytes one by one.
 
7:31 PM
@KevinMGranger dude....would you be OK sharing a picture of that?
 
Uh, I hope I kept the card. I'll find it once I'm home :P
 
would love to see it
cool :) thanks
I think family sedan is a bit harsh. How about a sporty hatchback with a fuel efficient turbo engine
 
It was from an event called "Swipe Right: Modern Valentine" so the card technically represents what my dating profile would be if I was using a 1960's computer dating service
 
kinda like a Golf 1.8T
It's not crazy fast, but it's just right
 
So if I send it to you I promise I'm not hitting on you in the nerdiest way possible
 
@KevinMGranger wink wink
 
Hmm, I remember Antti complaining about not being able to access an lru_cache's cache itself. Could you use that cell access thing to get to it?
 
wim
7:49 PM
@idjaw OK, Python can be a sporty hatchback. But Python 2.7 is still the fucking 2010 toyota corolla
 
We can agree on that.
nods
UuUuUuUuUuUuUuUuUugggggghhhh
1

Common Exceptions (topic request)

We see a lot of the same questions on here due to the same exceptions, like "No module named XXXX" or "AttributeError: 'X_OBJECT' object has no attribute 'Y_METHOD'". Other than just saying "Hey please read the error message and fix that " It would be nice to have some documentation to link them to.
requested by TehTris 1.6k
 
Go get them rep points and write up a doc draft
 
no
no no no
 
@PM2Ring I actually got a chance to finally sit down and step line through line of that code you sent me, that's good stuff man. I would have never thought of doing it like that at all.
 
wim
8:08 PM
@idjaw do you prefer mysql or postgres ?
I'm starting a new proj on 3.6.0 and trying to decide how to store the state
 
I'm going to try fresh and try not to peek and recreate it.
 
wim
it's not web
will be about 35 million rows in the biggest table
 
Heh. S3 went down and S3's status was hosted on S3
 
wim
I've not used sql for something that big before and concerned about things falling over
 
@wim Very good question. I think either of those will get the job done for you. I know that in my world right now, MySQL is pretty much the go-to. What kind of data would you be storing in the database?
I need to confirm this, but I think postgres actually plays nice with JSON?
whereas MySQL might not? Unless they updated support for it
ah, here is a very simple postgres example
 
DSM
8:16 PM
This should have been fixed long ago. Just had to help a minion work around it under pressure. :-P
 
^^ wow....how did I never encounter that
 
How often do you iterate over lines for something, and how often is your unit test for that code just testing on a single-line basis anyway?
 
DSM
@KevinMGranger: the use case here was something iterating over a .jsonl file (where each line is a json-encoded object).
 
wim
8:34 PM
the model is going to look a lot like a filesystem , but without the actual files
 
It's impossible to say without knowing more. The only thing I've heard offhand is that MySQL has a better replication story, but Postgres has nicer features by default
 
wim
paths, stat results (permissions, create/modified/access times, etc), and checksums plus some other metadata
 
Postgres plays very nice with JSON
we use Postgres (though not the JSON abilities)
 
^^ yeah. that's the only thing that I can come up with too
 
We have lots and lots of rows in our DB... looking for quantity now
I know we have several partitioned tables
 
wim
8:39 PM
anything like 35M rows ?
this is orders of magnitude larger than anything I've handled before, so I'm proceeding with caution ...
 
pretty sure. Maybe more?
one recommendation for PG - if you're worried about things falling over make sure to stay a version behind bleeding edge
 
Remember to do the low-hanging fruit first-- indexes and query optimization-- before trying to change the structure or partitioning, etc.
 
Oh yeah, our main transaction table has 72,346,269 rows
so, a lot.
 
@KevinMGranger +1
 
wim
postgres or mysql ? do you use autofield for the pk or other?
 
8:44 PM
@wim any reasons for the rollback?
 
I imagine it's due to occupying a different position in the "sunlight is the best disinfectant" — "don't polish turds" continuum.
has no particular opinion either way
 
I'm trying to get a field from a website which contains the euro symbol €, using scrapy and xpath. I get the following error: 'charmap' codec can't encode character '\u20ac' in position 11: character maps to <undefined>. I tries setting the Request enconding to iso-8859-1, just as the website HTML dictates, but the error is still the same. Any idea? I would prefer to stick to xpath to avoid changing all the code to bs4
 
Of course, a polished turd will tend to reflect sunlight, so the analogy doesn't quite work. Unless you have a bunch of turds, which you polish and then arrange into a parabolic mirror, periodically unpolishing and moving one of the turds to the focus.
 
wim
9:11 PM
@vaultah the edit fixed his bug!!
 
DSM
Ooh, I remember once where a well-meaning edit accidentally corrected the problem..
 
@wim the OP has a typo, but the edit only changed the indentation
(to enable the code formatting)
 
@wim postgres. We actually moved from some weird database on the alpha? Maybe this thing? en.wikipedia.org/wiki/VAX
Anyway, it didn't have RDBMS, so that was dumb. Now we have RDBMS, and life is better
 
wim
@vaultah Hmm, I could have sworn it corrected the variable name. But now I don't see it in the edit history. Probably I'm smoking crack, sorry
 
Could be in the edit window
that is, the window of time in which edits don't appear as edits
 
9:17 PM
"grace period"
 
so today's company town hall was incredibly boring.... at least they fed us :\
 
are you fed up with the town hall?
 
yes :D
everything had a lactose product in it except the fruit cups.. I ate like 3 fruit cups... But I didn't bite on what they were trying to tell us.... :\
 
DSM
I misread that as "lacrosse product" and was thinking of some mix of sports and calculus!
 
wim
>>> import msgpack
>>> msgpack.dumps({0})
TypeError: can't serialize set([0])
wat??? msgpack handle dict but not sets? why?
 
9:22 PM
@MooingRawr I've seen some fruit cups with lactose -_-
 
Dumb mathy question: say that you convert a string like #FFFFFF to it's numerical value. From that, is it possible to extract its value in the form of [ red, green, blue ] from that?
 
@wim I imagine because, like JSON, it tries to exist in the intersection of language features rather than the union (sensible for a language-agnostic communication medium), and sets aren't common enough.
 
wim
oh man
>>> msgpack.loads(msgpack.dumps({b'k1': b'bytes', u'k2': u'text'}))
{'k1': 'bytes', 'k2': 'text'}
screw this thing ...
at least throw a warning or something when information is destroyed
 
@corvid 2 hexadecimals = 1 byte. FF => 255
 
@Programmer but say you had 16777215, is there any way to determine that is 255, 255, 255?
 
9:33 PM
I'm not quite sure what that number represents. Rbrb
 
convert to binary/hexa?
 
decimal for white (16777215 in base 10 = FFFFFF in base 16)
Do (n >> 16) & 0xff, (n >> 8) & 0xff, n & 0xff
where n is the decimal value
 
i.e. convert to binary/hexa
 
16777215 is basically equivilent to parseInt('FFFFFF', 16), I just did that in the JS console
 
@WayneWerner yogurt and fruits right ?
 
9:34 PM
@MooingRawr no...
 
what.... ?
 
Yeah, I don't remember the product. We put weird things in things here in America
 
@MarcusS does that get the last value?
 
wim
The mathsy way to do that is divmod
>>> divmod(16777215, 2**8)
(65535, 255)
 
@corvid r, g, b = (int(''.join(s), 16) for s in zip(*[iter('{:x}'.format(16777215))]*2))
 
wim
9:38 PM
then divmod again on 65535
 
@corvid Last value?
 
given 003366, I get 102, which is the blue value
 
DSM
When I was in elementary school I was way too proud of how many powers of two I knew.
 
wim
@MarcusS is fond of bit shift hacks but I don't recommend that in python
 
wait, sorry, that was my fault for doing it wrong
 
9:40 PM
yes
 
wim
>>> def rgb(n):
...     rg, b = divmod(n, 256)
...     r, g = divmod(rg, 256)
...     return r, g, b
...
>>> rgb(0xffffff)
(255, 255, 255)
good enough?
 
Way too readable, -1
6
 
that feeling when you fix 10+ errors in a client's code rules, and still haven't found the original issue. that feeling when you finally find the issue and it's not even in the client rules and it's on client config files :( life is hard wasted hours on this matter :( I think I'm going to lie down a bit.
 
@wim Not entirely true -- I like bitshift hacks when the process is likely to be used repeatedly where speed may matter / where the hacks themselves are easy to understand (color math, yes/no state masks, etc)
 
DSM
@MooingRawr: whenever something like that happens I try to look at it as an opportunity to write a smarter test harness which would catch problems in that entire category. (emphasis on try..)
 
wim
9:47 PM
that's great if you are writing on some hardware chip that is for doing color math
python is a high level language so don't use low-level constructs unless necessary for performance
 
user2176127
Is there a way to iterate over class variables (not instance variables) without "touching" them first?
 
touching?
 
user2176127
They don't seem to appear in self.__dict__ unless I set them to some value in init first
 
ugh....read Linus' explanation on git sha1 and so disappointed with the lack of profanity and hard hitting disses.
-1
 
user2176127
If I do self.var1 = self.var2 = self.var... = self.varN = None they appear in self.__dict__
 
9:51 PM
get nvidia involved somehow
 
haha
 
user2176127
but that's not nice
 
@user2176127 Please correct your language.
 
DSM
Before I wield my broom of power.
 
you have a couple of minutes to edit that
 
9:51 PM
type(self).__dict__ contains it
 
either delete or edit @user2176127
thank you @user2176127
 
user2176127
@idjaw thanks that works
 
DSM
Am I the only one who likes vars(obj) instead of obj.__dict__? Avoid the dunders, that's what I say.
 
user2176127
i was literally googling that for about an hour and trying around but couldn't find it anywhere
 
wim
@user2176127 you're not understanding variable lookup properly
 
9:53 PM
@DSM I agree....usually when I see a dunder usage, I always check to make sure there is a 'cleaner' way to represent that call
 
wim
you're not "touching" them, you're creating new variables on the instance
 
I'm happy with vars
 
wim
which are shadowing the same names on the class
 
user2176127
@wim Yeah I'm new to Python
 
DSM
I remember seeing some code -- can't remember if it was on SO or IRL -- which was all something.__add__(something_else). I'm impressed that they bothered to stick with Python if that's what they thought you needed to do..
 
9:55 PM
I've seen something like that too, so it might have been here
 
wim
@DSM you have to use them if you go through super proxy
 
That's gross
 
Super proxy, awaaaay
 
DSM
@wim: these were basic types, used in standard ways.
 
yeah super().__thing__is the only way I think I ever use them
@AndrasDeak it's a method! It's a function! No, it's super proxy!
 
9:56 PM
@user2176127 I read this which made me understand the concept of class vs instance attributes. I'm not sure how authoritative that post is, but it definitely helped me
 
side note. I make a point to change all py2 style supers to py3 supers
 
py3 supers are so super
 
So why don't they call them dupers, hmm?
 
super pytendo sixty FOUUUUUUUUUUUR
 
wim
using dunders is a sneaky way to avoid lambdas sometimes
 
9:57 PM
I can never remember the py2 invocation - is it classname, self or self, classname? But then again I don't use Python2 that much
 
DSM
Yeah, but if you use the dunder instead of the lambda you're type-locked. Not very ducky.
 
class Foo(Bar):
    def __init__(self):
        super(Foo, self).__init__()
@WayneWerner ^^ py2
 
user2176127
@AndrasDeak Is there any difference between type(self).__dict__ and self.__class__.__dict__?
 
I just love how much sense that py2 super doesn't make
wait....it does
:D
 
@user2176127 I guess it's the same thing discussed above, dunder vs direct? But I'm not very OOP-savvy, and I don't know if some multiple inheritance or something else can make a difference
nevermind; you can overwrite __class__ but type will tell you the class
 
wim
10:02 PM
self.__class__ and type(self) can be different for old-style classes
i.e. ones that don't inherit object on Python 2
they can also be different in Python 3, but only under extremely devious situations
 
hmm...I wonder how they can differ in py3
not coming to me right away
 
>>> class Foo:
...  def __init__(self):
...   self.__class__ = 'asdf'
...
>>> foo=Foo()
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "<stdin>", line 3, in __init__
TypeError: __class__ must be set to a class, not 'str' object
neat
but you can shadow __class__ with a method of the same name
I don't think one should worry about old-style classes nowadays:P
 
24
A: Difference between type(obj) and obj.__class__

FlavienThis is an old question, but none of the answers seems to mention that. in the general case, it IS possible for a new-style class to have different values for type(instance) and instance.__class__: class ClassA(object): def display(self): print("ClassA") class ClassB(object): __...

 
supporting py2 3 years prior to EOL is one thing, but ensuring deprecated features to work...
 
DSM
@ZeroPiraeus: nice pull.
 
10:06 PM
@DSM I have no control over the client's rules they write, I don't have control over the config, so I guess I have to write my own test cases for their rules and configs. Thanks for the insight. I will try better next time :(
 
@MooingRawr Don't know how these config rules are being verified for usage in your application, but is there a finite list of these configuration variations?
it seems like there are some cases that can be put together to help control the outcome
maybe limit to what you know for sure should be accepted, and throw back an error with an explanation on what and why the rejection happened
 
so without going into details, we have our base app which we let our clients set up certain rules (if members can only do something if they start an event at a certain day, or logic on how or when parts of our apps should run). We also allow the clients to set up their own configs to match their rules, for example config for one set of group to only use half the app, but have client rules to check for their group and execute custom combination of our apps...
so when I get one of these tickets in, I have to look at what they did, how they set it up and if it's wrong or just syntactically incorrect. I then have to recommend the fix to them. Yes too much power is in the user and I don't like it but hey, I'm lower dev tier so my opinion on this matter falls on deaf ears :\
/rant over. work is over, anyway, another ticket done, Leafs game tonight so I know what I'm going to be doing ;D
 
wim
>>> class A(object):
...     def __init__(self, data):
...         self.data = data
...
...
>>> a = A(data='potato potato')
>>> class B(object):  # note: not inheriting from A!
...     def foo(self):
...         print(f"I'm a {type(self)} and I have data {self.data}")
...
>>> a.__class__ = B  # polymorph instance to different type without destroying data
>>> a.foo()
I'm a <class '__main__.B'> and I have data potato potato
 
DSM
@MooingRawr: yeah, here's hoping.
And on that go-leafs-go note, end-of-day rhubarb for all!
 
rhubarb
 
10:13 PM
rbrb \o safe trip to y'all.
 
rbrb to you guys and enjoy the game @MooingRawr
 
10:46 PM
Is there any issue with not joining threads in python? I just want to fire off threads to complete tasks and don't care about any return values...
 
wim
10:59 PM
you don't get the return value with join anyway :P
 
11:26 PM
Well, ok. But you know what I mean... I've a script that will ultimately spawn 10 - 100,000 threads over the course of, say, an hour. Are there any memory overheads with creating threads like this or is everything garbage collected? They only run ~2-3 seconds each, max.
 
I'm pretty sure you have to take care of the cleanup yourself
and should
maybe not explicitly through a join. join waits for termination -> docs.python.org/3/library/threading.html#threading.Thread.join
 
11:45 PM
cbg
i'm having some trouble with the multiprocessing module
I'm looking at the code here and trying to understand it/make it run because I need to use the module for a more complex project.
however, i'm getting an error
_pickle.PicklingError: Can't pickle <function solve1 at 0x7fc143d7ad90>: attribute lookup solve1 on __main__ failed
the code i have can be viewed here
any help would be appreciated =)
 
@heather this might or might not be similar to using a lambda with map: stackoverflow.com/questions/4827432/…
hmm...looking at your code, it probably isn't
(I'm not sure you need multiprcessing for this)
 
no, I don't for that code, it's practice
thanks, I will look at the link
 
it probably won't help...
weird, this here suggests that your function should be picklable
it isn't inside a function or class, is it?
 
00:00 - 17:0017:00 - 00:00

« first day (2327 days earlier)      last day (2627 days later) »