« first day (1294 days earlier)      last day (3879 days later) » 

19:08
Say you have a repeating task. The task takes seconds, the repeating interval is much longer, 5 or 10 minutes. Is it good practice to return control to the OS in that long interval? In other words, daemon the task?
That seems to be the standard way of doing it, yeah
What... hog the cpu.... nothing is more important than your program
good old while True: sleep(1)
(disclaimer: it is old, but not good)
instead of sleep(120) I'd want to say go_do_something_useful(120).and_then_come_back_here()
DSM
DSM
COME FROM
19:17
Ah yes, COME FROM. GOTO's hot cousin.
Yep. Probably not relevant to your situation, honestly...
That's a relief. I don't see how come from would be used in a go_be_useful_minutes() thing.
DSM
DSM
Relevance is overrated; here we just collect random thoughts sparked by things.
@Kevin :)
actually I was thinking about goto a lot, and I think I found reasonable usecases
where it is as maintainable and well structured as the the Python's try/except "goto"
@Peter if you longjmp nicely :)
19:36
longjmp?
I've seen arguments that it's useful in C for cleanup work in functions that you can't simply return from
@Kevin THAT'S EXACTLY WHAT I WAS THINKING ABOUT THIS AFTERNOON!
:)
/me feels a bit proud of himself now..
:-)
It just has a bad reputation from people misusing it
oh I can totally think of hundreds of bad usecases
so it doesn't surprise me, people are using it for not a good reason
and cooking their spaghetti code
but I think it is there for a good reason
K&R knew what they were doing
rbrb..
19:41
rhubarb @RolfBly
Metaclasses... so much black magic..
    field = getattr(_LocalizedForm, field_name)
    delattr(_LocalizedForm, field_name)
Imagine these two lines failing in the second call, although retrieving the attribute works fine.
(trying to make certain fields in a wtforms form duplicate themselves for i18n purposes)
DSM
DSM
I think there's a longjmp hack you can use to fake a yield in C which came in handy once.
Hmmmm?
This is a receipt for your DigitalOcean usage. This is only a receipt, no payment is due. If you have any questions please contact us anytime.
Thank you for your business!

-----------------------------------------------------
DigitalOcean Receipt - April 2014

Amount: $17.28

DigitalOcean
270 Lafayette St.
New York, NY 10012
-----------------------------------------------------
I think I know the difference between an invoice and a receipt thank you guys....
Do they have people contact 'em and SEND ALL IN CAPS - WHY YOU CHARGE ME AGAIN - I ALREADY PAID!!!
That wouldn't surprise me. Every disclaimer has a story behind it
Even "do not attempt to stop chainsaw with hands or genitals", unfortunately
20:02
guys any idea to do this kind of thing
What a stupid warning - I don't have hands...
x=['foo','var']
print ".. %s  %s" % unwrap(x)
That's so speciest
Have you tried just getting rid of the unwrap?
nah unwrap doesn't exist, and it won't work without, just imaginating such a function
DSM
DSM
I think you'd need to write ".. %s %s" % tuple(x), so that it knows you're passing a bunch of elements.
20:04
percent style formatting is lame, let's use format instead
>>> x = ["foo", "bar"]
>>> print ".. {} {}".format(*x)
.. foo bar
DSM
DSM
.. but I second the format recommendation.
Plus you should be using Python 3 anyway. :^)
@DSM correct
@Kevin noted ok
python has pointers!
or for purely rebellion... '.. ' + ' '.join(x)
DSM
DSM
Rebel! Rebel! (to the tune of "Unclean, unclean!")
well I'm actually doing a very long nasty sql query, but don't kill me for that
todo use orm
DSM
DSM
20:06
string formatting + sql = injection attack waiting to happen
@kwak you don't know how much attention you've just drawn :)
@kwak You're probably thinking of C++'s indirection operator, but Python's * has different behavior
@Kevin that's the one that multiplies things right?
20:07
@Kevin oh right I'm mixing * and &, I didn't C++ for long
@JonClements Yeah, and it does other stuff too
magical stuff :)
exponents (in pairs), censored profanity when used in comments, keyword args...
What search terms do I need to find out how to isolate just 3/4 files from a git repo
Hmm, I don't know
20:12
ideally I'd like to pull in the remote as a new branch, diff the current branch, then take out the subset of a directory into another branch to commit for use on another remote
I have no bloody idea what term I'm looking for (apart from probably really stupid and over thinking it)
Man, I've only just figured out that I can rename a file without erasing all its history
Yep, that's what I had in mind
I had something different in the cleanup like:
Ah, gotta go! I'll read your cleanup code on monday :-)
:P
one sec and I'm ready
create something1
if (<error1>)
    goto error1;

create something2
if (<error1>)
    goto error2;

create something3
if (<error1>)
    goto error3;

create something4
if (<error1>)
    goto error4;

goto fine;

error4:
    cleanup after something4
error3:
    cleanup after something3
error2:
    cleanup after something2
error1:
    cleanup after something1
fine:
    return;
@Kevin ^
I was really in a hurry, I hope I didn't do any typo, but I guess you git the point
you don't have to remove one more plus each time in the error
20:34
As manojlds pointed out in the comments, this will only work if nothing else has been stages and there are no other unpushed local commits. If that is the case, you are are probably best creating a new tracking branch from the remote, cherry picking the local commit into the new branch, pushing to the remote, then rebasing the original tracking branch. sigh :(
ofc I made typo mistakes.. <error2-3-4>
grr
@Peter lol.... flexible handling made easy - not error prone at all :)
@JonClements I barely understand the words.. what exactly are you suggesting?
:P
oh.. well, I had to make this quick, because Kevin is leaving
but I think he already left, only his binary-ghost is here..
heya @Johnston
20:43
I'm doing a accountIds = cursor.fetchall() (from sqlite) and get [(u'36917',), (u'test',)] How could I untuple inner items?
a user in multiple schools? well why not
It's owners of schools
a user is the admin of the schools
Using sqlalchemy.
If I have a `User` that has many `School`. Is these two queries the same?
`s = School.query.get(2)`
`User.query.filter(User.schools.contains(s)).all()`
vs:
`User.query.join(User.schools).filter(School.id == 1)`
*Are these two queries the same...
I don't have xp with sqlalchemy, but you could test maybe
ok. Well thank you anywho
21:02
Guys sorry for posting a picture but i am trying to install arelle and i am getting these error messages in cmd
Any idea?
I am really stuck from days on this one
Apparently you are missing the Postgresql lib code.google.com/p/pg8000 pg8000
I have downloaded pg8000
did you install it?
and still it is saying that no module is named pg8000
yes i installed it
then it's not in the right path
or the same path as your project
what is the right path
or it's not install right
?
where should i put it?
Looks like your other python stuff is in C:/python27
so where ever your python libs are normally. then it has to go in there.
21:07
Yes python is there
where did it install to?
so do you think i should go with cmd to that directory and install it there
?
C:\Python27\site-packages
the first time i went to the desktop where the pg8000 file is and typed python setup.py install there
What is the side-effect of 'from module import *' ? If any...
21:08
i didn't go to 'C:\Python27\site-packages`
Looks like that is where it should have wound up. It looks like that is where Python is looking.
Although I've never used that lib and I am not on Windows.
@Johnston but other Libs that were needed like sphinx i just downloaded the file i put it on the desktop went on that directory with cmd and then just typed python setup.py install and all went smooth... strange
Haha
Who knows. All I knows is you said there is an missing module.
thanx i'll see why pg8000 causes the problem
21:14
@PatrickBassut Ido it for scipy, because prefixes become annoying
s/prefixes/objects
@kwak I do it when I know they wont remain in memory much longer than when for example when running on wsgi
@ThiefMaster is it possible for you to create a "locked" room on SO for temporary use?
depends on the purpose of the room
@kwak That is if they do go to memory. Cause the interpreter might be smart enough to wipe out the module if anything coming from there isn't actually used
@ThiefMaster I'm going to find it rather difficult to host a skype/hangout room owner meeting regarding this room
(could do that... or possibly just an IRC server with an invite only channel - but the facilities to be able to one link and such would be useful)
21:19
@PatrickBassut ah ok good to know
Hmm AFAIK the unwritten policy is that such rooms should eventually become public
@kwak but there's must be a side effect since it is discouraged. Isn't highly discouraged tho
@ThiefMaster that's what I thought... I wouldn't mind the end discussion to be public, as that'd be the whole idea of it... just not the internal discussion kind of thing
When project managers start interfering with design:

http://t.co/NjpWR2LMxN
@JonClements i.e. you only want to make it public partially?
21:25
@ThiefMaster the conclusions and end results will be published on both sopython and here, the argument/debates leading to them, I don't think should be...
Cabbage all!
ok i'll see what I can do
@Iplodman Cbg!
@ThiefMaster ty... just let us know would be great... I'm going to aim sometime in the next week or so... should be able to collect enough info. to be able to host elsewhere if need be
yeah worst case you can just use an invite only channel e.g. on freenode
21:28
@PatrickBassut I believe I've mastered non-positional key arguments, but am I missing anything cool/important? imgur.com/ytwAbO8
@ThiefMaster yup, and then people asking for IRC clients and such :)
I just though a locked room, with a system everyone knows how to use... then we summarise at the end, you delete the banter, then room becomes public would be a viable solution
@Iplodman is that your code?
@PatrickBassut Yeah.
@Iplodman just the fact that you/someone-else overwrote a lot of built-in keywords made my eyes bleed already
Ahaha xD I was me, but what do you mean?
I overused them?
Oh right, the str/int kinda thing ;)
21:32
int, float, dict, etc are builtin keyword
Also, please post your code on gist the next time instead of creating a screenshot
but what's the purpose of showing me that?
@ThiefMaster Sure Thang.
And you shouldn't use camelCase in a new project. use lower_with_underscores
@ThiefMaster Ah, for the title?
21:34
You can also get rid of the else: after the raise. If you raise an exception the code after it won't be executed anyway. And that way you keep your indentation level lower.
DSM
DSM
Just to be pedantic, int etc aren't keywords, they're just built-in types. Keywords are things like for. (Try import keyword and then print(keyword.kwlist).)
"'" + foo + "'' is very ugly, too. Just use the plain string or its repr()
And.. .format() is your friend
actually you can make the whole validation logic nicer:
@Johnston You were so right!!! Now when i setup arelle in the cmd the: no module name pg8000 is replace by no module named pymysql and cx_Oracle and so on so i am installing those!!!!
@PatrickBassut Mm, my first time I noticed that I could use built-in types to send arguments, and it made the output presentation a bit neater.
21:37
@ExoticBirdsMerchant nice!
accepted = {'list', 'of', 'valid', 'args'}
unexpected = kwargs.viewkeys() - accepted
if unexpected:
    raise ValueError('Unexpected arguments: {}'.format(', '.join(unexpected)))
@ThiefMaster .format() is beyond me.
It's printf-ish, just nicer
the simple version is: every {} will be replaced with the corresponding argument passed to format()
(you can use {0} etc. to specify which one you want, and there are some modifiers etc. available. but for simple stuff you don't need that)
@ThiefMaster I'll look into that.
@ThiefMaster in fact... do you have two mins so I can describe exactly why I'd like the room ? (possibly in something that isn't the room here! :p)
21:40
Oh, a quick Q, what's a matrix, and it's uses?
@Iplodman sadly, not like in the movie. When I started out I thought it was
@PatrickBassut That would be cool.
@JonClements: Create the room and invite me
import matrix

matrix.dodge_bullet(leanStyle = twist)
matrix.play(all_scenes)
@PatrickBassut xD
@Iplodman although you can mistakenly make an infinite forloop printing some random numbers to look like this: s3.amazonaws.com/rapgenius/The_Matrix.gif
21:43
xD
Does anyone have an answer?
Google yields nothing.
@ThiefMaster @Iplodman Instead of .format, I prefer using the " '%s: %d arguments' % (argument, numbers)" kind of notation.
Matter of taste, but it gets very ugly once line-wrapping is involved
@PatrickBassut Yeah, I've been doing a bit of that.
@ThiefMaster Is it that thing where you 'stack' so to say, a list for example?
matrix = [[1, 2, 3,
           4, 5, 6,
           7, 8, 9]]
Like that? ^
@Iplodman yes
@Iplodman but that is a bit weird
@PatrickBassut Ah, that's simple enough.
I use that for dictionaries, and not much else.
21:49
matrix = [[1, 2, 3],
[4, 5, 6],
[7, 8, 9]] would do
meaning that each line of the matrix is at matrix[i]
Hm, so it's mainly used for 2D arrays then?
OH, that's clever!
where i, is the i-th line of it
yeah, thanks to Guido Van Rossum
actually no
Johan de Witt, I guess
Or some other guy that stole his work about matrix.
I lost you, didnt I?
My main criticisms about the Python IDE:
1: No line numbers
2: No column editing
And yeah, you so did xD
I get matrixes, just not the people thing.
21:55
That why you should consider Vim
*matrices?
Enlighten me, what is Vim?
I'd highly recommend PyCharm.
or another IDE, like PyCharm
Ah, an IDE.
I'll check em' out now.
It's (by a huge mile), the best thing for Python I've used.
21:55
TO THE GOOGLE!
Sublime is good!
Couldn't agree more with @Lattyware
Oh, I have PyCharm ;)
Sublime is not mainly for python
PyCharm is
It's apples to oranges, Sublime is an editor, PyCharm is an IDE
21:56
@PatrickBassut Aggred!!
Also good with other things, like Django, flash, pyramid, etc
@PatrickBassut Heh, tell that my coworkers who use sublime for a HUGE project (where "go to definition" etc. would be pretty useful).. and we actually have an opensource license for pycharm.
@ThiefMaster PyCharm has "go to definition" and I truly believe it's more accurate than sublime's
Exactly. That's why I'm using it instead of sublime
Tell that to you coworkers, right now. Save their lives
22:00
They are pretty used to search for class whatever.. and most of them want to switch to atom once it's out for linux
Setting up PyCharm now, it seems like the best choice.
Haven't used Atom yet. Heard it's enhanced for github things. You know, editing readme.md and all
At first, looks like Sublime
at least it's UI
I think sublime's mini-map features is what gets it on top of others editors
Therefore I don't think is that handy, once you have an IDE that's targeted for your language
not sure if the name is minimap
Just to clear this up, is __anAttributeHere__ a convention or a syntax requirement?
depends on the name
Could you give me an example?
22:07
__str__, __getattr__ etc. have special behavior (e.g. the latter is called when accessing an attribute that does not exist), and you are not supposed to create your own methods/attributes within that naming schema
Truth be told: 90% JetBrains(PyCharm owner for those who don't know) IDE's features aren't used either because they don't work well, or just because is hidden somehow.
That bugs me
@ThiefMaster Cheers.
@ThiefMaster "that doesn't exist"?
getattr is called only when you do obj.attr_that_does_not_exist?
22:09
yes
__getattribute__ is always called
@ThiefMaster that I didn't know
I've always overwritten getattr in order to intercept the get attribute behavior
the most weird thing is that, it worked flawlessly
I use python 2, if that matters
@ThiefMaster what is the benefit of atom?
I've never used it since I'm not an apple user but apparently it's extremely easy to extend since the whole UI is based on HTML5, CSS and JavaScript.
22:49
@PatrickBassut atom sucks and you shouldn't use it
Sure it's easy to extend because it's based on html and css, but we're talking about a desktop app here
you can notice the lag
23:22
be nice if my connection didn't keep playing up
@Ahmad it sounds like sublime at first. Very much like sublime
user559633
23:35
@Ahmad what's your hardware? atom worked just fine with me.
user559633
non-ssd?
23:52
Hmm what is DATABASE in http://peewee.readthedocs.org/en/latest/peewee/example.html
database = SqliteDatabase(DATABASE) #<- never defined

« first day (1294 days earlier)      last day (3879 days later) »