« first day (1501 days earlier)      last day (3675 days later) » 

00:00
it's the same reason that obj = object(); obj.x=3 will fail
Usually, each object gets its own __dict__ that replicates all the keys and values the type gives it. Those dicts also need to be dynamic as usual to work with new values etc. This often causes them to be bigger than ultimately necessary.
yeah, I get that
because a instantiated object of an object has no dict
Now, Python 3 shares the keys of the dicts of one type, so if you add a property to an object, all the other objects of those type are “prepared” to have that key too. Instead of having to add them dynamically to each instance individually, they are shared.
makes sense...
00:02
head screw of if you're use to other OOP languages though :)
So the amount of bytes you would be saving by using slots now got smaller, making it less attractive (since you heavily restrict the object with it).
@Jon Depends on those other languages. A lot of them are statically typed, so you wouldn’t expect anything else anyway :P
the most practical example of using slots is namedtuple
And e.g. JavaScript uses prototypes to save duplicate content.
(if you are actually using prototypes of course…)
hang on. Doesn't the fact that each instance could have different values for various attributes mean that there needs to exist a __dict__ like structure to map attribute names to each instance's value anyways?
the values can change, but the keys can't
00:05
The only way I can see __slots__ being helpful, is if it essentially says "these are the ONLY attributes that an instance of a class may EVER have"
ok, that too
@inspectorG4dget Yes, but think of __dict__ now being a very efficient implementation of a dictionary that kind-of caches the keys.
the compiler effectively "interns" a private dictionary with "interned" "slots"
an object can't shrink nor grow on key size
@poke: sure, but the keys can still change, and new keys can still be added. So how/why in py3 is __dict__ lighter than py2's __dict__?
I don’t know the implementation details, but it could for example work like this: The type has a dictionary key->index, and the instance then has a list of values and when you access a property of the object, you look up the index using the type’s dictionary and access the element from the list.
no... the keys can't change
you've interned the keys
00:08
@JonClements yes, they can? (we’re not talking about slots)
oh, sorry, we're now talking about dict again?
Yes, we have been for a while :P
the difference between 3's and 2's will be because of MRO
> Both the old and new dictionaries consist of a fixed-sized dict struct and a re-sizeable table. In the new dictionary the table can be further split into a keys table and values array.
PEP 412 – so it’s more or less what I said.
and being able to...
yeah... okay... beaten to it
00:11
Recap time - this is what I've understood so far: `__dict__` behaves like a dictionary, mapping attribute names to instance-level values of those attributes. Since it is dict-like, attribute names can be added/deleted/modified. On the other hand, `__slots__` is like `__dict__`, except that attribute names canNOT be added/deleted/modified. Because of this "fixed"-ness of `__slots__`, it is more efficient, in case we use multiple instances of a given class

Is this accurate?
Yeah, except that __slots__ is just a list of attribute names, and its presence during type definition will essentially remove __dict__ completely.
just remember that a class is a dict, containing a dict that references its class lookups
>>> class DictType ():
        pass
>>> DictType().__dict__
{}
>>> class SlotsType ():
        __slots__ = []
>>> SlotsType().__dict__
Traceback (most recent call last):
  File "<pyshell#8>", line 1, in <module>
    SlotsType().__dict__
AttributeError: 'SlotsType' object has no attribute '__dict__'
we'll await the question about metaclasses later :p
00:15
ok that makes perfect sense. But I still have one question: if __slots__ is effectively a list with attribute names, then where are the per-instance attribute values stored?
Doesn't there need to be a dictionary structure mapping the names in __slots__ to their per-instance values?
The presence of __slots__ at definition time basically bakes the attributes into the type. They become fixed. There will still be some underlying lookup and storage mechanism where the values are stored.
ahh! so it's the overhead space required by dictionaries (__dict__ in this case) that is saved. Correct?
Yes! :)
But as explained above, that overhead for __dict__ got smaller with Python 3, so not using __slots__ doesn’t hurt that much.
00:20
now, onto the next question: what does py3 do differently with `__dict__` to save more space? If it does indeed cache new attr names, then doesn't it stand to reason that it would waste space? Take this for example:

class Foo:
def __init__(self):
self.x = 5

f = Foo()
g = Foo()
f.y = 6

Now, because of the caching, doesn't python effectively put a `y` in `g`'s `__dict__` as well? Wouldn't that be a waste of space, since I don't use it?
@poke: is that simply because py3's dictionaries got more efficient in space usage?
From the PEP:
> In the event of the keys of these dictionaries starting to diverge, individual dictionaries will lazily convert to the combined-table form. This ensures good memory use in the common case, and correctness in all cases.
The “combined-table form” being the normal implementation of dictionaries.
the whole point of __slots__ is to restrict attributes - it's barely needed
So, if you make f too different from its type’s key set, then it’s likely that it will end up having a standard dictionary at some point.
I've seen it used to prevent attribute access incorrectly
it's one of those - seriously don't worry about it kind of things
I'm not "worried" about it; just super curious - I think it's way cool!
Thanks @poke @JonClements. This really clears things up :)
00:26
As I said, I don’t really know how exactly it’s implemented (I’m curious too though), and I couldn’t find a less abstract explanation than what’s in the PEP. So maybe someone should look into the source, figure it out, and then explain it in a self-answer on SO :D
trying to remember the name of the type of class that can't be inherited from in certain languages
arghghgh, what's the terminology
primitive?
nope
it's not concrete
interfaces are implemented, not inherited from
oh, you mean sealed types
or final
00:29
I was thinking final... but yeah... sealed...
They are both the same thing. It’s final in Java, and sealed in C#.
in static stuff, you can inherit/implement stuff from a class/interface, then as soon as it's done, you can't then go do any further...
alright, time for my evening snack. Rhubarb, all!
rbrb @inspectorG4dget
00:32
rhubarb!
anyone still here?
00:51
yup
you were supposed to be gone though
the cafeteria is temporarily closed. I'll be headed back down soon
does anyone use mac osx and fluid.app for SO?
no and no
grah! Alright thanks :)
and now I'm off! Rhubarb :)
oh heya @JonClements! Do you mac + fluid?
01:02
nope.. just a linux and sometimes winblows guy
hmm...
actually, would either of you be able to find me a userscript? userscripts.org is down and I can't seem to be able to find it elsewhere
haha... probably not... I don't have any userscripts installed on this version of my browser
must be my useless night
kthanks :)
01:23
"solved" (?) in comments / answer edited into question
01:36
sighs the discussions we've had here about bad teaching :(
I went from C++ to Python - not sure if it's harder the other way around... but I then found it easier to use C# from Python experience
I like how the rest of the people keep insisting that there are private variables in Python. I'm not sure what language they've been using...
IE support is moving to Stack Overflow: news.ycombinator.com/item?id=8654979
this will go about as well as Facebook support here
@davidism what is "high-rep" anyway? It's just internet points
The responses to the "Stack Overflow is terrible because it closes questions" on that HN article are good.
probably read that before... will double check later
01:54
@Jon yeah, you're right, it's just internet points. For some reason I've been really annoyed at SO today. cv-pls'ing left and right
it happens to us all... take a break from focusing on the site and relax a bit if needs be... it's not important in the grand scheme of things
the work you've done is way more than appreciated, but just get away from it a bit and do something else to relax for a bit or something
 
2 hours later…
03:57
@JonClements Not all, Puppy.... Probably @MartijnPieters is an exception :D
Is there a python 3 proxy class library?
something like this pypi.python.org/pypi/ProxyTypes but that's for python 2
How do you get private variables in Python? I saw @davidism mention it
05:05
Hey Python!
@Unihedron hey
Cool your avatar is a pic of python code!
302
A: Does python have 'private' variables in classes?

Kirk StrauserIt's cultural. In Python, you don't write to other classes' instance or class variables. In Java, nothing prevents you from doing the same if you really want to - after all, you can always edit the source of the class itself to achieve the same effect. Python drops that pretense of security an...

@RonaldMunodawafa essentially the convention (PEP 8) is to use double underscores as a prefix, but it is not truly private in the sense it would be in other languages such as Java
@Unihedron :)
05:24
"truly" private...
as there are ways of getting past it in java depending on things
I know in Ruby you can hack your way through. Not too sure about the other class-oriented languages
05:42
I mentioned it in the context of "there are no private variables in Python" and anyone trying to do that in Python is Doing It Wrong™.
@davidism __mythical_unicorn = 'My private pony'
:P
Privacy has more to do with visibility and scope except that the lifetime is of the object
hey guys, anyone here?
06:00
@majnemɪzdæn that's not a private variable
@user1561559 cbg, no
@davidism it was a sad attempt at humor
Unicorns are no joke! :)
@davidism true
 
1 hour later…
07:22
cbg
@RobertGrant cbg
07:41
cbg
Question: Can someone think of a decent name that encompasses Question/Answer/Comment
Basically, a class that all these would inherit from
If it was just Question/Answer then it could be Post, for example.
Post?
Yeah
But does Post work for Comment as well?
Yes, I think so
07:54
I suppose you still "post a comment"
Okay, cool.
Or Item, also suitable (imo)
BasePost, and then BaseTag, from Base
I was going to have SEObject -> Post -> Question/User/Answer
And then also have SEObject -> User
As it makes no sense for a User to have methods for posts.
07:57
well, a User isn't a Post... so you're thinking along the right lines :)
cbg @Martijn
08:11
cbg
cbg Steve
08:58
Man it's late. Gotta bug out. Here's me rhubarbing when I've only just cabbaged, sorry
09:08
Hi All
I am having issue in deploying a django project which i took from github
How many people have worked with futures here
And what were you experiences with them
i am using a windows laptop, python 2.7 and django 1.4
i tried using apache and mod_wsgi
but was not able to fix the issue
it is not able to find some modules which is present in the folder
i am also not able to sync the database from postgres
can anyone help me in deploying?
just need the steps.. as I am following the steps given in the django website
Does it involve any usage of futures
Since you were talking about database synchronisation
yes..
09:33
I have a csv file where I want to combine first two columns and parse it as datetime.
I've done the following:
    parse = lambda x: datetime.datetime.strptime(x, '%Y.%m.%d %H:%M')
    df = pd.read_csv(filepath, header=None, parse_dates=[[1, 2]],
                     names=column_names, date_parser=parse)
lambda takes exactly 1 argument, 2 given
has it not combined [1, 2] ?
so seems no one has used concurrent.futures but it has a really nice interface
@ArunRaja please link the project
i am using this to test the deployment of a django project
but this project does not involve futures
It appears to be better be multiprocessed than it is to be multithreaded.
i worked on futures in my previous projetc
cbg again.
09:45
When it comes to the discussion of concurrency in the books I read into there was no mention of futures. Only multithreading was discussed. In the Python 3.4 branch Guido had them made more efficient so that GIL argument has been made moot
There is no longer a reason not to use Python
Yeah, okay.
@holdenweb thought you were gonna bug out? :)
I now want to contribute to Python documentation. It is only noble to do so
@Ronald Please, and I mean this seriously as you seem to ignore a lot of what people say in here, if you're going to do something like this, make sure you know what you're talking about. Otherwise you'll just waste a lot of peoples time.
@Ffisegydd in other words I should shut up unless I have valuable input. Got it.
You're talking about contributing to the Python docs, a resource that is used extensively by most, if not all, people who work with Python. You have also said some things in the past few days that were just, plain wrong. If you try to contribute to the Python docs, there is a chance you will similarly make some mistakes, and then it's some poor editor's job to have to deal with it.
10:00
I will make sure to have strong peer reviewing prior to submission of anything
cbg
@Jon: sorry, office machine open again.
I managed to trigger a pointless spelling discussion, it seems. Shrug.
 
2 hours later…
12:57
Someone random seems to have added commits to nidaba/dev
But I can't work out who they are, or how they did it.
Link?
That's just a misconfigured local git setup.
Someone with a local copy on their disk pushed their changes, but their commits don't include an email address that is registered with GitHub.
Most likely that someone is ChillarAnand
Ah, yeah that would make sense. Maybe he was using a different machine, as it worked previously.
13:18
Cabbage!
cbg poke
Hmm, didn't it used to be possible to sign up for Stack Exchange sites without having to choose a new password for the account?
Like, it all fell under some global StackExchange account
I never set a single password.
@Ffisegydd I cloned the branch locally, and a git log shows it is Anand.
commit e1e2ce85189a2d527037b4a88de291f1b1fdbcb0
Author: K3 <[email protected]>
Date:   Tue Nov 25 18:06:10 2014 +0530

    added tests for Post Object
I signed up with my Facebook
13:25
@Martijn ah cheers, thanks for clearing that up :)
I dimly feel like that "password" field is a new addition
Instead of choosing “Sign up”, try the login button instead
That did it.
I need to learn the complex parts of git
13:32
hello all.
Hello
Sup @Chillar :)
i already have my project running on google cloud computing. Is there any document there to configure git in google cloud computing
I think it's stored in the Google
13:34
@Ffisegydd Do it already! :P
ha ha ! @RobertGrant . ss but i could not able find any document .. !
i know how to setup git with google appengine
but compute engine bit confuse me
@poke I have done in the past, I've read through the tutorials and examples and thought "Ok I know this now". Then I don't touch git for 3 months and so promptly forget everything (incidentally, I do the same with unicode). Now that Nidaba is starting to roll though, I'm using git pretty much everyday, so hopefully it will stick in my mind :P
@Ffisegydd same here :D
How's things going @Chillar, you good?
Thanks for everything you've done so far with Nidaba.
@ChillarAnand R u from bangalore ?
13:37
@Ffisegydd more to come :)
@rajasimon yep
@Ffisegydd actually i need to thank you for guiding me :D :D
:D we can both learn together
Let me know when you want me to look at the dev branch again, rather than me looking at it while you're working.
You can ping me in here or in a Github comment.
Once it's all sorted, I'll probably add some little bits to it myself and make everything fit into PEP8 (need to do it for the whole project tbh) then I'll merge it.
@ChillarAnand Don’t know if you noticed yet, but GitHub doesn’t know your email address yet.
@Ffisegydd i kinda get lost in super, init. let me dive into it.
@Chillar as we're using Python 3 only we can actually just have super().__init__(), ignoring the two variables.
As long as we're consistent, either way is fine.
@poke noticed that in last commit
13:44
What does PyCharm Professional Edition mean when it says it supports the Google App Engine? How does the Community Edition not support the App Engine?
> Develop applications for Google App Engine and delegate routine deployment tasks to the IDE. Create your app, run it and deploy it to the App Engine server without leaving PyCharm. Enjoy code completion and error highlighting in GQL queries and in YAML configuration files.
I can live without that
Thanks
@poke that's some good pasting
The new PyCharm v4 is sweet.
I am comparing the Community Edition to Codeblocks for differences because I might want to work with an IDE that is more fun
13:51
My version says it needs an upgrade, then when I go to check for updates it says it's up to date
@Robert mine did the same, but you can get v4 from the intertubes.
Are you guys using the Professional Edition?
Yes (well I am)
No (well I'm not)
Good to know. I am developing an aversion towards Codeblocks and I don't know why
13:53
@Ronald I believe you're a student? If you have an official email address you can get the Professional version for free.
In fact, you can get all of JetBrains' (the company that does PyCharm) software for free.
They also have IDEs for Java, JS, etc.
Jetbrains are freakin awesome, definitely take advantage of that
I noticed they also support JavaScript. I need to dump this idea of copying and pasting between from Notepad++ to Code Blocks
Also @Ronald while we're discussing free things for students have a look at education.github.com/pack
13:55
You guys are awesome!
I might was well install Ubuntu aside my Windows and delete VirtualBox
PyCharm is complex at first, and can be a bit intimidating, but I highly recommend it.
Yeah it's a little slow to start up, but really cool I think. I'd never done any Python before I installed it, and it's been a good IDE to learn in
PyCharm also supports VirtualBox/Vagrant, so you can write your code in Windows and then PyCharm will run it for you in a vbox automatically.
Which is what I'm going to do for Nidaba when I get round to developing on my PC as opposed to my MBA (damn screen size)
I normally work with Python Tools for Visual Studio but I am on a laptop and I am yet to mount the other monitor so I want a minimalist UI and Pycharm looks like it will do me good
PyCharm can get a bit hectic, but you can get it minimal as well.
13:57
cbg again
cbg pup
Thanks @RobertGrant and @Ffisegydd
Am I wrong to assume Ubuntu tightly integrated with Python?
Er well it comes with it, but tightly integrated is not the right phrase

« first day (1501 days earlier)      last day (3675 days later) »