« first day (1599 days earlier)      last day (3342 days later) » 

12:05 AM
Hi All! Can anyone answer some questions about p2app?
Or would someone possibly be willing to attempt to build an app for me (1 small file)
 
Welcome @user2229838 - please read sopython.com/chatroom - especially:
> You may ask your question without a preamble.
For example, you do not need to say “anyone here know Django?” before asking a question about Django. Even if you do, the Django experts in the room might not step forward until hearing the actual question. They may not wish to commit themselves to help until they know how much effort it will entail.
 
Thanks for the tip. Specifically I'm trying to make my script distributable but have run into this issue with py2app:
Jordans-MacBook-Pro:desktop Bailejor$ pythonw setup.py py2app
running py2app
creating /Users/Bailejor/Desktop/build
creating /Users/Bailejor/Desktop/build/bdist.macosx-10.5-x86_64
creating /Users/Bailejor/Desktop/build/bdist.macosx-10.5-x86_64/python2.7-standalone
creating /Users/Bailejor/Desktop/build/bdist.macosx-10.5-x86_64/python2.7-standalone/app
creating /Users/Bailejor/Desktop/build/bdist.macosx-10.5-x86_64/python2.7-standalone/app/collect
 
... and maybe
> Only paste code directly into chat if it is not very long. There is no hard limit, but about a dozen lines is acceptable. For longer code, use an external paste tool such as dpaste.
;-)
 
Noted! Sorry I didn't think it was too long of a traceback as far as tracebacks go. I've been at this for a couple hours a day for the last two weeks. Can't find a solution using cx_freeze, pyinstaller, or py2app.
 
I don't know py2app by the way – I don't think I've seen it mentioned here, but it's always possible there's someone who knows about it.
@user2229838 I see you've posted a question on SO about it ... in a low-volume tag like you can usualyy expect to wait a while for an answer.
 
12:21 AM
Ohh, so if I tag it with just python or python2.7 I'll have better luck?
 
No, I just mean that there won't be hordes of people with expertise in the subject. Your tags are fine :-)
 
Gotcha. Thanks for your help!
 
12:45 AM
you might have better luck adding cx-freeze tag to it if you havent already
but really i say this is what you get for using a mac :P
 
It's so very painful. I've had multiple versions of linux installed but was never fully happy with it. There was always something that wasn't working properly. I also got sick of windows...so mac was the next option and I guess I just like to complain a lot or create problems somehow
 
 
1 hour later…
2:11 AM
@AvinashRaj Nope... This is what I get
import re
matches = re.match(r'NSLocalizedString\(@\"(\w+)\", @\"\w+\"\)',
                   'NSLocalizedString(@"key", @"comment")')
print matches.group(0)
# NSLocalizedString(@"key", @"comment")
 
3:06 AM
I have what should be a quick question that Google inherently can't answer: In Python, is there a specific use for the ` character?
 
@Sean you use to be able to do `varname` which effectively did repr(varname) - it was never really used, nor considered very nice, and has been removed for a while now
 
I noticed it on codegolf. Bummer that it's removed. Thanks
What is that character named?
 
@Sean yeah... think that's about the only place it's ever used/deemed acceptable :p
 
lmao!
 
Think it's generally called "back tick"
 
3:13 AM
Awesome. Now I have something I can put to Google without worrying about filters.
 
4
Q: Meaning of the backtick character in Python

Sam HeatherI'm just getting started with python. Can somebody interpret line 2 of the following code snippet? I don't understand the `num` bit. I tried to replace the backtick character with a single tick ', but then it broke. Just a detailed explanation of that line would be great. loop_count = 1000000 i...

 
That page is already open in another tab :) but thanks
It looks like it was an alias for repr; and it also looks like my python 27 still implements it. I prefer 3 tho
 
A minor ambition of mine is to introduce one of the other two unused punctuation characters $ or ? into Python.
 
You must write excellent code to consider contributing to that. My take on Python is the source is really well written
 
I was thinking more of coming up with a plausible idea and getting GvR to accept it ;-)
This may or may not involve kidnapping.
 
3:19 AM
gvr?
 
Oh ok I didn't know his name.
 
He left a while back to work at Dropbox.
 
fascinating
 
is definitely not stalking Guido
 
3:22 AM
uh huh lol
 
Any rumours of a plan to lure him to a purpose-built dungeon with stroopwafel are entirely unsubstantiated.
 
that stuff is awesome. my grandmother made these awesome cakes out of it
her pierogi was the best thing i've ever eaten
i wonder if python 1 source is as difficult to find as is an obsolete copy of solaris
 
The remake of Solaris with George Clooney was rubbish :)
 
Mmm, pierogi ... I had some Polish houseguests who made those for me once :-)
@JonClements Haven't seen it, but Tarkovsky's version would be tough to beat.
Then again, maybe not :-/
There :-)
 
3:39 AM
omg that's awesome. thanks
 
4:16 AM
Cbg
 
This is starting to take shape nicely now....
 
Wussat then?
 
@Zero new admin and reporting system for a client
 
'spretty.
 
Yeah... need to put hovering over... and put in a jvectormap
I'm sure a proper designer can do better, but for me, I'm actually quite impressed :)
 
4:29 AM
I suppose it depends on the user base, but it occurs to me that, assuming it will have the name of the month in big letters somewhere when it's done, the "Day of Month" / "Hour of Day" labels are unnecessary (because it's obvious from the x-axis labels).
Then again, you have mentioned dealing with somewhat ... challenged users sometimes ;-)
 
I think challenged is being generous :p
 
strives to be diplomatic at all times
 
 
4 hours later…
8:05 AM
4 hours window ;_;
 
Cbg @RobertGrant
 
Cbg
 
cbg
I added my dict comprehension answer to sopython.com/canon/45/…
but if there is an older version of the same post perhaps it needs to be used instead and my current question duped.
It is hard to find these however.
 
8:21 AM
 
@61612 No, we already have a canonical for list comprehensions.
It's a dupe of that canonical.
 
Yeah
 
 
1 hour later…
9:31 AM
@JonClements: thanks again for the Ambassadors tip; that was brilliant. Thoroughly enjoyed it, sorry to see it won't be coming back in that form.
 
@Martijn I thoroughly enjoyed them :p
 
I still have the music starting up in my head from time to time.
 
I was unsure of whether M&W would make it work... but boy, they were awesome
Anyways, been up 26 hours now... project deployed for user to play with... think I've got time for a couple hours snooze before they get back to me... rbrb for now
 
This keeps cropping up again and again: stackoverflow.com/questions/28828375/…
We need a canonical dupe target for that one; I think it is an online code course question.
@JonClements Sleep well!
@JonClements I loved the fact there was real meat to the stories; drama with a huge wink.
 
10:03 AM
Cabbage!
 
Cbg
 
10:59 AM
cbg
@MartijnPieters It's worse than that: it's a GCSE task, as described on reddit
Wikipedia says:
The General Certificate of Secondary Education (GCSE) is an academic qualification awarded in a specified subject, generally taken in a number of subjects by pupils aged 14–16 in secondary education in England, Wales and Northern Ireland. One of the main changes to previous educational qualifications in the United Kingdom was to allow pupils to complete coursework during their two years of study, which was marked by their teachers and contributed to their final examination grade.
Does really pathetic indentation count as a typo? :) stackoverflow.com/questions/28829550/…
 
11:16 AM
@PM2Ring Downvoted. If OP can't work out what's going on from that error message, there's no hope for them.
 
Significant whitespace is Python's way of punishing cargo-cult copy & paste programming.
 
Also, SO provides twenty-five questions with near-identical titles when you type that one in when asking a question.
 
@PM2Ring woohoo! cheating students, whodavethunk.
 
@ZeroPiraeus You'd think the OP would notice all the Related questions in the sidebar. OTOH, according to a Meta post I read a week or so ago, it seems that lots of people are oblivious to sidebars, since they are so often populated with advertising.
 
Hello. I use a variable inside the constructor of a class. However I am not sure if it will be a matrix or an integer later in the program. Is it safe to initialize it inside the constructor to 0 or to None ?
 
11:27 AM
@MartijnPieters Yeah. It's bad enough cheating on a normal homework assignment. But cheating on something that is a major project for your final high-school marks is a bit rich. However, these students are permitted to do online research for these tasks. But of course there's a big difference between doing research and expecting to be spoon-fed working code.
@Kabyle None is often a good choice when you want a variable to say "My value hasn't been set yet".
 
@PM2Ring Thank you very much.
 
cbg
@Kabyle None is good but sometimes you need to distinguish between explicit None and a value that is not set, then you can use an anonymous object:
NOT_SET = object()
def func(value=NOT_SET):
    if value is NOT_SET:
also if you do have a meaningful default, then provide it in the default args, so that it is visible in help()
 
@AnttiHaapala I never heard about anonymous objects. However I must copy/past your code and read about this notion first on internet. Rakastan kalakukkoa.
@AnttiHaapala kiitos
if value is NOT_SET: ... I think something is missing here ? @AnttiHaapala
 
no
now it can distinguish value is set to any value and value is not set
 
@AnttiHaapala that's clever
 
11:39 AM
@AnttiHaapala Indeed! But I didn't mention that since Kabyle said that once the attribute is set, it will only ever be an integer or a matrix, i.e., None will never be a legitimate value for it.
 
yes
use None for those cases, NOT_SET if None is a valid value
 
@AnttiHaapala Kiitos
 
though the help is not really nice for that one :D
 
@AnttiHaapala but I do not know what are anonymous objects, thanks to you they won't remain anonymous to me :)
 
@PM2Ring: in any case, the Reddit link is very helpful. I helped someone that was trying to work on problem 3 of problem set #2 recently. They at least had tried to get there on their own most of the way.
 
11:43 AM
hello
 
@AnttiHaapala I'm sure I've recently seen code by Martijn that uses that trick, but it's not easy to find stuff like that using Google...
 
@PM2Ring It is normal you can not find them on Google: they are anonymous :D
 
@MartijnPieters IIRC, I first saw that Reddit GCSE link in a comment by JonClements, and I've used it in my own comments several times, to let other potential answerers know what's going on.
OTOH, a week or so ago there was a guy in India who was working on one of those projects for his own self-study, and he got quite indignant when it was suggested that he was cheating on his exams.
@Kabyle :) Martijn should write a book: Code Python like a Ninja. :)
 
@PM2Ring Netherlands gives every year one of the best martial artists fighters, so it is normal he sees coding as fight :D
 
12:09 PM
@PM2Ring I usually name that object _sentinel, in case that's helpful.
 
@PM2Ring as long as you're sure it was self study :)
 
But I learned the trick from people at Zope Corp, probably Jim Fulton, using a list instance.
this was in the 1.5.x days, long before new-style classes and object() were available.
 
@MartijnPieters Ah! I did actually search for sentinel, but I forgot the leading underscore.
 
Can no longer be reproduced.
okay I genuinely don't know why but it has suddenly started working, I just kept trying to run it and now it works fine? — Keith Hardie 6 mins ago
 
@RobertGrant Who knows. :)
 
12:15 PM
@Kabyle I was actually given my tagline by one of the founders of the Plone project as a LinkedIn endorsement, years ago.
It started with Invisible Framework Coding Ninja, plus another 3 words. I liked it, it stuck.
 
Were the other three words "doesn't describe Martijn"?
If so, then that's pretty harsh
 
I guess it's time to this baby: stackoverflow.com/questions/28829550/…
 
@RobertGrant . Guy is great.
 
Thanks :) Can you say that on my LinkedIn?
 
12:23 PM
Yes, I'm in a silly mood
 
Tip: get your colleagues to give you these endorsements on LinkedIn.
 
user559633
I like ZUMBA/CSS personally
 
12:59 PM
re-cbg
 
user559633
cbg
 
Does anyone have a recommendation for software for keeping track of personal and/or business accounts? As in record keeping, expenses, etc?
Tempted by YNAB for personal budgeting, but wondered if anyone had any alternatives? And any for (self-employed) businesses.
 
Accountant is still on my list of "jobs to automate"
Having said that, that does look cool
 
user559633
that looks like the worst video game ever
 
1:10 PM
"Kind of like EVE Online except there's no subscription fees and it's with real money. "
 
user559633
eve online uses real money too
 
user559633
eve online is a service that converts money from minimum wage jobs into human misery over the internet
 
And it's stackless
 
It is Stackless.
 
Do we also perform type checking when one provides an abstraction of some functionality?
for example square root accepting only float or int type values
 
1:18 PM
Nah
 
user559633
I'm pretty sure that they're making "stacks" off fake spaceships that sell for real money
 
@overexchange You're restricting yourself that way. Suppose that your square root function only uses regular arithmetic to calculate the result. Then there are many numeric data types that it could potentially work on, so it doesn't make sense to restrict to those two. What if I wanted to use your sqrt func on a Fraction? What if I made my own numeric type that you don't know exists?
 
@tristan never mind that; I've spent so much on movies and TV, and none of it was real!
 
user559633
@RobertGrant none of this is real
 
user559633
Never mind that, we can't even be sure that we all perceive the same "real"
 
1:21 PM
well that depends on how good is your abstraction of sqrt functionality, passing Fraction should not raise type check error. sqrt has to take care, if it can as per the contract
 
user559633
Which explains why some people get to the fork in the road of Python and Ruby and go down the path of Ruby. It's because they see the world as some magic place where interpreters create bubblegum that floats down rivers of pink soda.
 
@Kevin my point is, releasing the control of type checking from programmer(with uni-typed thought process while coding) is prone to runtime errors.
 
Sure, but raising an exception if you get the wrong type at the top of the function is also a runtime error
 
Does that mean the money they spent also wasn't real?
 
One could argue "better to get an error message at the beginning of sqrt than in the middle of it", which does have merit
 
user559633
1:25 PM
@RobertGrant money is the least-real bit of things that we've convinced ourselves is based on some sort of reality
 
Then it becomes a matter of how much you value "fail-fast" over "wide compatibility where possible"
There's no easy answer here, I think.
 
I feel, type checking at compile time rather than run time, makes application less error prone. Otherwise testing phase will be very difficult
 
user559633
typing conversation in a duck type language yayyyyyy
3
 
Hey, you need some way of telling if it's a duck :)
 
user559633
why not just take whatever, convert it to float, then check the result at the end. if it can be an int without losing information, cast and return, else, leave it alone
 
1:26 PM
hmm, isn't there a "numeric" abstract base class somewhere in the standard lib? That would nicely resolve this issue.
 
user559633
"numbers"
 
Then you could do assert is_numeric(arg) or whatever at the beginning of your function. Then you get your fail-fast behavior, and it works on most numbery things.
 
user559633
numbery things are a few of my favorite things
 
Numbers are an uncountably many amount of my favorite things
 
@tristan But then you can't get the sqrt of a fraction and get a fraction result. FWIW, Newton's method for sqrt even works on polynomials, if you pass it a suitable first approximation.
 
@Kevin am trying to understand, what is the advantage am I getting by programming in dynamic languages(unityped at coding time) when python is any ways strictly typed at runtime
 
Coder convenience, mostly. Then the user can type def f(a): rather than def f(AbstractFactoryMessagePassingBeanSingleton a):
 
user559633
python is a generic purpose language. you can use it to write a little web framework around your thing
 
All my code is strictly typed at programming-time. I can't type fast enough to program while it's running.
 
Every time I type seq = [] I am thankful that I don't have to type List<someType> seq = new List<someType>();
 
1:30 PM
I've got a list of every bad joke you make Bobby. One day you're gonna cross a like and wake up dead.
 
user559633
if you want your code to be strongly typed, you picked a funny language or you really like putting screws next to every nail you drive
 
@Ffisegydd :)
You're just mad because of my unhappy Googling
 
Damn, I want to do the "how can you wake up if you're dead?" bit from Scary Movie, but I don't remember how it goes
 
;_;
Me and Robert had an idea for an April Fools Day PEP where we'd suggest adding Roman Numeral literals to the Python language. Turns out it's already been fu**ing suggested :'(
 
user559633
I had a dream last night in which I met god at a bar and I asked him why we exist and he responded with "what is consciousness?" Even in my dreams, people are contrarian.
 
user559633
1:32 PM
Let's do a PEP for Python 2.9 in which it's async by default a la nodejs
 
@tristan you'd be better off just saying "contrary"
 
slow clap That...that was nice.
 
My favourite band is Mary Mary
 
@overexchange, ah ha! I found the number base class. It's in the numbers module.
 
1:34 PM
@Kevin So, dynamic languages are introduced to provide coder convenience?
 
Great it's snowing. Can someone drop Nature an email and remind her it's bloody March.
 
You can do if not isinstance(arg, numbers.real): raise Exception("Expected real value") and your function will allow ints and floats and fractions and lots of other types.
@overexchange Pretty much yeah. As processing speed and memory capacity has improved over time, coder time has become increasingly more valuable than computer time.
 
@overexchange e.g. write a Java method that accepts all numeric types
 
If I save 50% off my development cycle by making a program that's a hundred times slower, this may be a reasonable bargain.
 
1:36 PM
If my program takes a hundredth of a nanosecond to execute, who cares if it instead takes a nanosecond to execute?
 
@Kevin the nanobot you just sent into a wall
 
Using dynamic lang, ya because type checking is performance overhead at runtime
 
If you want performance, switch to Fortran, it's 117 times faster than Python :-)
 
117 times?
 
(going by this single benchmark, which I usually get yelled at for posting because it's effectively a single data point and thus shouldn't be used to draw any conclusions)
 
1:38 PM
cbg
 
user559633
I love when people love C++ templates and claim to hate dynamic languages
 
Wow, don't show the Ruby guys that
 
@RobertGrant Mrs Roberts can.
 
Oh, sorry is that JRuby. Never mind.
 
morning everyone
 
1:39 PM
I'm not sure it's actually the same @tristan. I think templates do enforce types, just let you decide what types at runtime.
 
popcorn
 
user559633
Sure sure @ReutSharabani but you get my point for compiled v interpreted
 
@tristan When I used generics in java, I felt the necessity to use it because I had to avoid explicit type castings. I am not usre how this topic is related for the good reasons to use dynamic language
 
throws popcorn at @Ffisegydd
 
user559633
because it's taking a generic type in to the same function.
 
1:41 PM
wow fortran's generated code is faster than c++? that's impressive
 
user559633
in which you then decide how to handle each specific type
 
user559633
for an nbody @ReutSharabani
 
I'm not sure what an nbody is
 
If we use generics, there is no chance of type mismatch at runtime.
 
user559633
1:42 PM
it's a benchmark of the language's speed in doing something you probably will never do
 
FORTRAN is pretty hench. But it's a pig to develop in.
 
@Kevin already voted.
 
@ReutSharabani I assume it's a computer simulation of the "N Body Problem", which is a physics problem that asks: "given N massive objects that are affected by each other's gravity, determine their position at some point in the far future"
 
Both to close and on the question.
 
@Kevin basically it tests the speed of this loop:
def advance(dt, n, bodies=SYSTEM, pairs=PAIRS):
    for i in range(n):
        for (([x1, y1, z1], v1, m1),
             ([x2, y2, z2], v2, m2)) in pairs:
            dx = x1 - x2
            dy = y1 - y2
            dz = z1 - z2
            mag = dt * ((dx * dx + dy * dy + dz * dz) ** (-1.5))
            b1m = m1 * mag
            b2m = m2 * mag
            v1[0] -= dx * b2m
            v1[1] -= dy * b2m
            v1[2] -= dz * b2m
            v2[0] += dx * b1m
            v2[1] += dy * b1m
            v2[2] += dz * b1m
 
1:43 PM
For any N greater than two, there's no known closed form solution, so you can only grind out an answer by simulating each time slice
 
@Kevin I just read that up in wikipedia: en.wikipedia.org/wiki/N-body_simulation
 
if you can speed that up...
the inner for loop
 
@Antti it wouldn't be a like-for-like comparison if it used, for example, Cython or numpy vectorisation.
As long as that point is made clear, the results are still valid.
 
yeah I am thinking if there are big constants
in the tuple destructurizationalization
 
I really need to start using pandaas and numpy. They seem to be big among other developers and I've never used them.
 
user559633
1:44 PM
that's a pretty poor reason to do a thing
 
user559633
if all your developer buddies jumped off a cliff....
 
@ReutSharabani try Java or C# if that's your metric
@tristan Milhouse jumped off a cliff? I'm there! - Bart
 
thinks "Panda as a Service" is a great idea.
 
@tristan If all employers required five years experience in cliff jumping, and the alternative is to starve in the street, the choice is apparent.
 
@tristan I'm guessing there is a reason they're used... And maybe stuff I'm doing today will be easier using these modules instead.
 
user559633
1:46 PM
@Kevin Eh, just say you have 6 years, even if cliff jumping was invented 3 years ago.
 
Then they show me my office, which is on the side of a cliff and... This metaphor isn't working out.
 
yeah there is nothing to optimize really
I cannot see how to optimize that loop any more
 
user559633
use the C api and be smug about your benchmark
 
in python
assuming CPython
 
my implementation is import os; os.sytem("nbody_fortran_implementation.exe")
Wow, we're shooting to the top of the chart!
 
user559633
1:51 PM
same, but on a HPC node, so linux
 
user559633
err, a similarly spec host that offloads it to the HPC node so we're inline with the requirements and all
 
print open("precalculated_results.txt").read(). O(1) solution!!!
 
user559633
planet-alignment.io is soon to be live!!!
 
hrmph... how can you normalize more complex sorting tasks in a database?
 
define normalize
 
user559633
1:53 PM
define database
 
like if you think of something like reddit. It has some algorithm to sort the "most relevant" posts, which uses the current time to degrade older posts. I'm trying to find a way to do something similar with MongoDB
 
user559633
haha knew it
 
Webscale.
 
webscale :D
yes...
 
user559633
relevant is just a query that gets stored in a denormalized table
 
1:55 PM
there is no problem that couldn't be made difficult with mongodb
4
 
@AnttiHaapala for the most part it's been working fine, but having advanced querying seems particularly difficult
 
like I thought that "now that mongodb has lists, I can make a fifo queue in a document" - nope.
@corvid advanced querying means that which was implemented in MySQL in the beginning of 90s
 
user559633
mongodb, the toy firetruck that claims to put out fires
 
corvid: Your choice of store aside, what do you actually mean by 'normalize'?
 
But getting into Mongo is a good idea; then in 20 years' time you can troubleshoot all the legacy mongo databases for a fortune
 
1:59 PM
yeah
 
No joke
At least you'll know it
 
I do not understand how they could manage to raise 1 G$ for a project that I could code in a year.
 
@overexchange Yes, but it's not just convenience - it's a different programming philosophy. Sure, there are benefits in strict typing, like making code more robust, and more amenable to automated proof of its correctness. But those benefits come at a cost of more long-winded syntax, and a reduction of versatility.
 
would probably be better :d
 
it seems like mongodb is used in a lot of people though... I'm just going with what the framework says
 
1:59 PM
If you don't have all that type cruft in the way it's easier to see what code is doing. And you can use the same piece of code on any applicable object without having to care about its type. A rough analogy: strict typing is like training wheels on a bicycle. Yes, they make the vehicle safer, but they can also get in the way. If you ride responsibly you don't actually need the training wheels.
 
Lol is that a gigadollar?
 

« first day (1599 days earlier)      last day (3342 days later) »