« first day (1378 days earlier)      last day (3795 days later) » 
01:00 - 17:0017:00 - 00:00

01:32
is anyone up for a good ol' "let's prove this algorithm will always work?" kind of game?
01:46
psh, I'm too busy stealing davidism's code
he's really pro, I learned a lot of cool things today
 
4 hours later…
05:51
cbg guys
@PeterVaro here :P
06:31
cbg
When did we recover from the outage?
06:54
@toothberry please take a look at sopython.com/pages/chatroom
In particular we don't really like users bringing their new questions here
Anyone who is interested in answering will already be paying attention to the main site.
1 message moved to Trash
oh sorry, i didn't noe, alright thanks
07:33
Cbg :)
Cbg @IanClark
morning
07:50
Morning both :)
08:06
cbg all
Given a boolean value, would you guys prefer to read not foo.get('bar') or foo.get('bar', False) is False ?
I much prefer the simplicity of the former - I understand the semantics are different though that shouldn't matter for an expected Bool
so foo['bar'] is boolean? Hmm. I prefer foo.get('bar', False) is False
It's easier to read imo
"The object that you retrieve is False, and if it doesn't exist then it's False by default"
08:23
i prefer to read it as if not open
It's a shame PEP 463 wasn't accepted ... not (foo['bar'] except KeyError: False) is particularly nice and clear in this case.
Oooh that is quite nice.
GvR disagrees‌​, unfortunately.
"...and I disagree with the position that EAFP is better than LBYL, or "generally recommended" by Python." Wut?
Yeah, that made me double-take too.
08:41
I continued through the email and found no one speaking more about GvR's claim there.
There's a D in BDFL for a reason ;-)
Yeah :P but I thought it might have been discussed more.
I thought it was common knowledge that Python advocates EAFP over LBYL
I do think he got that one wrong ... and his EAFP / LBYL claim is implicitly contradicted by the docs IMO.
mail.python.org/pipermail/python-dev/2014-June/134866.html if this gets through it will be seriously useful.
It should, I believe, remove the "I can't find vcvarsall.bat when installing numpy/scipy/whateverpy/etc" problem.
Luckily, I never need to worry about Python on Windows. Whenever I read about it in passing, it sounds painful.
08:57
It is. There are some SO questions out there that give details but a lot of the serious details are in comments, not in the main bodies.
I just use the pre-built ones from Gohlke.
09:14
should python migrate to visual C++ as the main compiler? just for windows?? dislike
It already uses Visual as the main compiler.
cabbage :)
The issue is that 2.7 uses VS2008
It's already difficult to find the correct version of VS2008 to use, never mind over the next 4(or maybe 6) years that Python 2.7 is going to be supported.
Trying to use a compiler that's 10-12 years old to support Python? Not gonna work.
09:17
is there a slight possibility of a universal compiler?
The issue is that that'll mean that 2.7.8 uses VS2008 but 2.7.9 uses VS2014 (for example) which means a minor upgrade can break your python packages.
why the different VS versions??
Because they get upgraded with time? Remember that 2.7 came out what? 4 years ago?
So it made sense to use VS2008 as it was new.
hmmm
you example uses 2.7.8 and 2.7.9 and the time gap for VS version to be 6 years so : ) confused..:D
2.7.8 is the brand new version of 2.7 right?
And it still uses VS2008
09:20
yup
Because they don't want to change compilers in a minor release.
If there was 2.8 then they could change it happily, but 2.8 will never happen.
why won't it happen?? : )
Because 2.7 is dead.
And Python 3 is the future.
okkk
i use 2.7.8 : )
You should think about moving to 3.x if you can.
09:22
yea have thought about it for a while....after this one month time. need to get my project working first before i go about making changes.
Even if it wasn't prohibited, a 2.8 release to change the Windows compiler would mean a point release that doesn't change anything on Unix, which is unpleasant.
Exactly.
And I think morally GvR just won't do it.
It's something of a "damned if you do, damned if you don't" situation.
Yeah I've read through the whole convo and it does sound ugly.
But it's better than trying to find VS2008 in 6 years time...
Admittedly this is from the perspective of someone happily unaffected, but it does seem to me that just leaving it might be the best bet. It will get progressively more painful to develop using Python 2.7 on Windows, and that will encourage people to move away from 2.7, or Windows, or both. Win-win :-)
09:32
Yeah ;)
A few people made that point in the mailing list.
09:57
(removed)
added
and
(removed)
here is the ndarray and i am setting all indices in the nd array to a specified value.. any other alternatives to this ?
So block is a 2d array?
And you want to set all elements to value?
In [3]: import numpy as np

In [4]: block = np.zeros((10,10))

In [5]: block[:,:] = 1
So literally all you'd want is block[:,:] = value
In fact you only need block[:] = value
it is an n dimensional list, i guess. it says can only assign an iterable
10:05
Are you using numpy arrays or lists?
Because an ndarray is a numpy array.
sorry about that mistake up there.
it is a list.
Ah. What are you actually doing?
Because if you're working with nested lists you might be better off using numpy anyway.
i am using python opencv, and cv2 allows image manipulation as numpy nd list, and so all numpy operations can be done in it.
So it's a numpy array then?
Not a list?
Any Gold badge users? Does this look like a sensible dupe close?
0
Q: Getting derived class name statically in python

AnubisHow can i implement the static method get_class_name() to get the expected results. I need to get the correct class name without instantiating. (I know this can be done with an instance). Python version is 2.6. class base_class(): @staticmethod def get_class_name(): return <??> ...

this is a n dimensional list?
10:11
No that is a numpy array that has been printed out, you can tell by the lack of commas.
Try print(type(block))
so it is an ndarray...
Yes. Which is not a list and has nothing to do with lists.
It may look like a list and it may act like a list but it's a numpy.ndarray.
This means you can use numpy methods on it.
Meaning all you need is block[:] = value
Does anyone have a link to the meta discussion where it says "you should close with a duplicate question, not a duplicate answer"
not that too
here what am i doing wrong ?
i get it now.... the print out prints it out like a list and makes it so damn irritating! i was getting entirely confused all the while
It doesn't look like a list, the lists have commas.
what is that type called?
10:22
What is what type called?
that print out : )
That's just how it's printed out.
does the print out qualify into any type?
stupid, tried to use that print out and solve my problem
It's defined by the __str__ method
IIRC
10:45
thank you for your help!
11:37
cbg
11:52
cbg @AnttiHaapala
bleh, may have an all day meeting today.
My friend is looking to put together a python package which uses Fourier theory to encode data into an image (stenography basically). Chocolate cookies to the person who comes up with the best package name.
12:20
My random word chooser suggests "guanases"
plz give teh cookies
That is not the best, we haven't heard everyone else's ideas yet.
So far, I'm winning by default :-)
I'll be buying the cookies from Ikea so you'll receive butter, sugar, an egg, some flour, and some chocolate chips and then you just put it together yourself.
I think my word chooser is buggy... It always outputs words that are so not random, like "statists" or "pilgarlics". Never "monkey" or "cheese" or "dishwasher".
I don't think it really gets the spirit of randomness.
cbg
does any of you use 2 spaces for indentation?
according to googles python style guidelines they use 2 instead of 4
12:25
Depends if I'm in a heretical mood or not.
and imo 2 space indentation looks way nicer
always been a fan of it
hehe :P
Better than the cookies at Ikea^2, where they give you a cow, a chicken, and seeds for sugarcane/grain/cacao
And a hex wrench, for some reason???
The illustrated instructions are not entirely clear.
Or Ikea**3 where they simply give you a box of infinite energy with instructions to make something called a "Big Bang"
And eventually you'll get your cookies.
Cabbage all! :D
@Iplodman heyy
12:33
This reminds me of a dumb physics question I had the other day... They say that matter can be converted to energy. Does this mean it's possible to have a system that's all energy and no matter?
They say that if we could convert all of the dark matter from a new-born baby into energy we could power a nuclear power plant for a year.
Quick question - what's the purpose of converting a method to a property?
That's an unusual choice of energy source.
@Kevin I'd just use - I dunno', jelly babies or something.
Dirt, I guess?
I use properties when I'm sick of writing widget.get_sprocket() and want to write widget.sprocket instead
12:39
What does making it a property actually do though?
I'm new to this stuff.
@Zero you have overtaken @Kevin in the cookie race.
A more pertinent question might be "what's the purpose of converting an attribute to a property"?
PyCharm suggested that I should change my method to a property.
As in, Why write a property method that returns the height of your matrix when you could just have a plain Matrix.height attribute?
12:42
@Iplodman did you have a method called (something like) get_my_variable which returned variable?
Actually, it yields a value, but yeah.
You been reading Java books again? We told ya! Them things are full o' filth!
Wait, what? xD
If Matrix can change in size on the fly, it may be more convenient to have a function that recalculates the height value every time, rather than having to manually update the attribute yourself in every circumstance where the dimensions of the Matrix might change.
Oh, I get it.
So you can just use the returned value from it rather than a function?
And it just automatically updates the returned value?
12:45
Not really. I think I've just confused everything more.
Maybe this will be helpful?
241
Q: Python @property versus getters and setters

BasicWolfHere is a pure Python-specific design question: class MyClass(object): ... def get_my_attr(self): ... def set_my_attr(self, value): ... and class MyClass(object): ... @property def my_attr(self): ... @my_attr.setter def my_at...

I don't think so.
I'm going to try and have multiple GUIs in a sequence in my program now. So like Setup -> Gameplay -> Aftergame GUI.
13:01
I will attempt to demonstrate with an example. Here is a class which uses ordinary attributes to store its height and width. It has a million methods which may change height and width on the fly. In all one million of these methods, it's necessary to recalculate the attributes at the end.
In contrast, here is the same class, except it uses properties for height and width. Now all one million of my methods are one line shorter, saving a lot of effort and memory.
One may ask, "in the second class, why not skip having height and width properties entirely, and make the user call get_height() and get_width() instead?". The answer being, "That is perfectly valid, although the user may be annoyed by the extra verbosity".
I think I get it now.
Let's say you have a list, and you've got its length, two indices, which are 'inside' the list and they are different, and you have a block_length. now, the question is, if you want to swap index1 + block_length with index2 + block_length blocks, how will you check: 1) if the blocks are overlapping or not, 2) if both blocks are inside the list?
The challenge is: is it possible to find a way, where you don't have to know which index is greater, compare the lesser + block_size to the greater, then the greater + block_size to the whole length?
something like: non_overlapped = abs((length - index1) - (length - index2)) >= block_size
(but this one is not working if one of the indices is the last one)
@PeterVaro, dear, I know you're try to help, and I do appreciate that, but I think that for now I'll just stick to trying to remember Tkinter :P
One day I'll come across it and figure it out.
@Iplodman what I posted, has nothing to do with your problem ;P
That'd explain why it made even less sense to me then xD
13:12
abs(idx_2 - idx_1) < block_size will return true if the blocks overlap, I believe.
@Kevin reply that's correct
So I guess you want if abs(idx_2 - idx_1) < block_size or idx_2 + block_size > length or idx_1 + block_size > length: raise ArgumentException
some of those might need to be >=. Watch those off by one errors.
@Kevin so there is no way to solve this problem with a single truth test/comparison, isn't there?
Using only one greater/less than sign? No, I don't think so.
You could create a list containing [index of start of first block, index of end of first block, index of start of second block, index of end of second block, index of final element in the list], and raise an exception if the values aren't sorted
Or, no, that's no good, if you don't know which idx is smaller
that's more time consuming (it is not python btw, it is more like a hypothetical question, on this algorithm, if there's any algorithm here in the first place)
13:20
If it's just a matter of code cleanliness, I like to do this: when a function takes two numerical parameters, and I would like the first one to always be smaller than the second, I'll swap them at the beginning of the function if they aren't properly ordered: if a > b: a,b = b,a
@Kevin that's exactly what I do now
but that takes two conditional statements and new variables (if not python)
Or sometimes I'll do if a > b: return thisFunction(b,a) although that incurs a bit of function call overhead.
13:42
I hate pub wifi. "Please give us all your details just to connect to some bloody wifi"
I'd rather pay and have it anonymous than get "free" wifi
I'm using Django and I'm trying to delete a field from a model (Model._meta.fields) someone knows how to do that in console command?
Not I
Well what I wanna do is to remove a django field (CharField) from a list
@Kevin what do you think about this one:
abs((length - (index1 + count)) + (length - (index2 + count))) >= count
Have added sopython.com/canon/36 to the canon list. Was looking for one for stackoverflow.com/questions/24957267/…
13:57
false alarm.. nope it is not working either..
I was about to say. gives the wrong result for length=10, count=1, index1=1, index2=1
Or, if it's supposed to return True when there's overlap/out of bounds and false otherwise, it fails for 10/1/9/9
it has to return True if error (like overlap or out of bounds)
but that doesn't change the fact it is still not working ;)
I removed 2 fields from my model's Model._meta.fields list in python shell. How do I save this? If I leave shell the fields are still there
14:12
@dguay Can you do something like db.session.commit()? Have you looked up the docs? I don't use Django.
I did check in the docs but I can't find anything
The field is not in my db that's the problem
I'd suggest you ask a question on the main SO site.
I know most of the people in this room and I don't think we have many Django users, or at least users that are on at this time.
sup @Jonny.
I did but no one answers me
Thank you anyway
Changes you make in the interpreter are not persisted to your source files.
You will need to change the source to make is persist between interpreter sessions.
How can I change the source files
Since my fields are not in my db
The thing I did is adding fields to auth.Group with the add_to_class function
14:18
I'm talking about models.py.
There is nothing left of it in my models.py file
Are you trying to delete columns from the database then?
No the fields are not shown in my database
Then it is unclear what you are trying to do, explain better.
14:20
It's not a thread, it's a question (small, but important, distinction).
Ok sorry
I think they answered you pretty clearly in the comments. Either take out the code that's adding the columns, or use a schema migration to add the columns described by that code to the database.
I already did both
You're getting errors because the database table does not match the model definition.
There is nothing left in my models.py
14:21
Then you have a magic problem that is unsolvable unless you provide more details.
and like I said south doesn't track these changes so when I try to do the schemamigration, nothing happens
add the changes manually
you can edit the migration files before running them
There is no migration file created but what you say is I should make a migration file^
Yes, if it's not picked up automatically, but you know you need one, make one.
But when I check in db with phppgadmin, there is no column of my fields
Should I add them manually in the db and make a migration to remove them^
14:24
Happy SysAdmin Day Guys :)
You're saying you have a) no column in the table, and b) no field in the model, but you are getting an error about fields not existing? Again, magic.
Happy SysAdmin Day @thefourtheye :P we missed Physics Day this year
That's what I'm saying
If I use python shell
Obviously you are missing some details here, maybe try adding for instance the exception you are getting to your question.
and check in Group._meta.fields, I see my 2 fields there
14:26
@Ffisegydd Oh, when is that?
April 24th apparently.
Yes, you will see them there if you added them to the model, now you need to create them in the database so things match up.
Ok I can do that but I want to remove them. I should make a manuel migration after this to remove them?
I'm done.
Well thank you anyway and sorry to bother you lol
14:28
so what is an instance folder in flask primarily for? I see that the documentation says configs are one part of it. Is that it?
It's a folder outside of the package structure, so that you can have dynamic content without changing versioned or installed files.
local config, user uploads, etc.
ah okay. Davidism I had a question on your code... particularly two lines in auth/models
There's nothing special about it vs. any other folder except Flask has some helper methods to access it easily.
_groups = db.relationship(Group, lambda: user_group, collection_class=set, backref=db.backref('users', collection_class=set))
    groups = association_proxy('_groups', 'name', creator=Group.get_unique)
what do those lines mean?
@Ffisegydd Its only a national physics day it seems.
14:32
The first sets up a many-to-many relationship between User and Group, the second uses that relationship to set up an association proxy to the group names.
association proxy just lets you read/write from a relationship?
groups looks like a set of strings, but is backed by Group.name from the _groups relationship.
hip cbg <-- gross
@dguay go and read about alembic
@dguay nothing in main sqlalchemy reflects the changes in table metadata like you'd assume
for removing columns from metadata
14:40
i want to learn regex..give me a probable question on it...that one should be able to solve..a simple one to begin with
@davidism I've added tags to the canon index as per trello.com/c/OjZASBqD/48-should-tags-appear-in-the-canon-index it's not an important change though so it can wait to be installed on the site itself for whenever you make your next big change.
I'll take a look in a little while. I was going to start working on tags and searching, so it might change.
@AnttiHaapala I'm use Postgres
@AnttiHaapala he's also using django
@dguay and I had a nishiki bicycle - does not matter.
@davidism hmm? :D
@davidism i was looking at backlog and it was about flask and updating metadata :D
oh well :d
14:43
54 mins ago, by dguay
I'm using Django and I'm trying to delete a field from a model (Model._meta.fields) someone knows how to do that in console command?
is sopython contributable by others? if so i would like to look up the source.
so it seems :d
then I have no comment
If you would like to contribute to sopython, the code is on GitHub.
Our roadmap is on Trello.
thank you
15:00
what needs will sopython-site cater to?
The main features are the wiki and canonical items. Eventually, we will tie in Nidaba, our duplicate identifier project.
great.
gtg ...rhbrb.
what is the best way to do abstract methods now in 3.4
def some_method(self): raise Exception("Not implemented in abstract base class")?
15:16
@davidism did you get SoC in the end?
@AnttiHaapala not sure is what you need : docs.python.org/3/library/abc.html
Hmm... PS Move sounds like fun to develop software for.
I've found a Python API but I'm not sure whether or not it supports the PS Move Navigation controller.
@Ffisegydd STEWIE!!!!!!!!!!!!!!!!!
@Jon Briiiiiiiiiiiiiiian!
Has the commenting interface on SO changed? I see " add a comment | show 2 more comments ", and I don't recall seeing both buttons side by side before.
I don't like change :<
15:30
@Kevin I've just noticed that
Glad it's not just me that thought: "umm... that's not how it usually works..."
Finally, I can contribute to a conversation without having to actually read the entirety of said conversation!
@Kevin nope
@Kevin and also raise NotImplementedError instead
Is there any easy way to delete a field from Model._meta.fields??
15:52
@davidism I see... do you happen to know if there's an extension which does this sort of thing?
@Jon yes I did! :) I'm a little slow to respond right now because I'm moving.
Unlike the cat, I do like it.
I had an AMAZING IDEA for sopython while on the bus and I've now forgotten it! wqoitgbrqejigibgjsdbfj!
Never mind remembered it!
I'm getting insane deja vu from this post. I distinctly remember reading the phrase "I get some suggestions to use regex (.*?)=(.*)" before
@davidism no worries - just wanted to check :p
on that as well, I suppose. Unclear on account of he didn't actually ask a question.
Posts that contain no question marks or tracebacks should be auto-closed, and their authors given a mild electric shock.
What if they learn to enjoy the mild electric shock?
Then we crank it up to 11.
so davidism, do you use the flask command to run your application? I tried exporting FLASK_APP to where my manage.py lived, but it did not register when I did flask run
(on my application, not on yours)
Surely they can find an easier way to get electric shocks than by asking unclear questions. Electricity is all around us.
16:24
How I get mild electric shock? Need asap. Pls help thx.
woot - a complete Python room closure :)
Boom. Another "closed-by-5-sopythonistas" question.
:P
Lick a nine volt battery
Actually no I don't like sopythonistas...what about...sopythoneers...
Or sopythonauts.
The scooby gang? :)
16:28
The Dark Council looks unfavorably on your "question".
3
Need to capitalise the D and C...
And now it's star-worthy :P
The Pythonidabas :)
I dunno I like Pythonauts (credit to @tristan)
sopython should have a weekly poll on important issues like this!
I like "Dark Council" :)
Kinda like Slashdot does.
16:34
@Ffisegydd wow... haven't visited slashdot in years :)
SD, HN, and Wired are my "tech sites"
@Ffisegydd I quite like dontevenreply.com
Can't beat clientsfromhell.
Cabbages to all! Python Kats (kind of like SWAT Kats :D) or what about simply...Pythons!
clients from hell makes me thankful that I'm not a contractor
Contracting seems like an... interesting... profession, in both the good and bad sense
16:45
Wow... the amount of conversations I could add to that clientsfromhell :)
@Kevin notalwaysworking.com is good too.
@Kevin you should meet one of my clients. She had a designer redesign her logo 40 times (literally) only to choose the first one again. Which was absolutely attrocious.
I like the ones with happy endings. Like 'my client called and said "I prayed to God and he said I don't need to pay you". I waited ten minutes and called back. "that's funny, I prayed to God and he said you should pay me." He paid shortly afterward.'
@JonClements +1 to that Puppy :D
ME: Since we are on such a tight schedule, could you please be more precise when giving me feedback on this?

CLIENT: It needs to look a bit nicer.
I pity that person... I've had that more times than I'd like to remember :)
I remember spending an entire day writing a 7 page document with options, pros/cons, next steps, timescales and costs, and asking how the client would like to proceed...
16:50
JON: please let me know which of these four designs you prefer.
CLIENT: looks good, go ahead and push to production.
To get back: "Sounds good Jon. Do that"
Deploy all designs, multiply fee by ten
my client said "I want a website"... so I said "what kind of website...?". She was like "uh... I dunno". "do you have any examples...?" "uh... no". Why would someone ask for something with zero plans past that?
hehehe.
@Crow Have you seen this video?
16:56
oh that video... ah don't get me started. Especially since everyone thinks their ideas are so wonderful and original
I love that video :)
@Crow This one is understandable if they just want a site as a status symbol. "I want to be hip and on the cutting edge. Build me a web site so everyone knows how modern I am"
The meetings I've been in that were like that :(
yeah. She wanted to throw everything in. Like she just looked at tons of gimmick sites and said she wanted things. Like she said she wanted webgl water, 3D CG animations, parallax scroll, single page blahblah, for a news site
I've only used the ol' "ten years, twenty million dollars" estimate in a real meeting once. The boss was not amused.
01:00 - 17:0017:00 - 00:00

« first day (1378 days earlier)      last day (3795 days later) »