« first day (1592 days earlier)      last day (3581 days later) » 

17:00
My initial instinct is to create an empty set to begin with, and add an item to it each time an update occurs.
This is faster than regenerating a brand new set from scratch using a set comprehension after each update.
Ahh... thought that CA reverse string looked familiar.. 101 ways already here
You should go from O(N^2) time to O(N)
for sure
the caveat is removing the item once it disappears
Wat? A man apparently has killed 8 people in a restaurant in the Czech Republic before killing himself... (supposedly not terror related...)
Oh, if removals are possible too, it would be better to use a Counter instead of a set
17:03
I think that's where the collections.counter comes in
incrementing and decrementing name counts as they are added and removed, and removing the key-value pair entirely if the value drops to zero
I had not heard of a collections.counter before. But I get the idea.
Hi, I type print b[0] and I get this [28 3]. What is this data structure ? I want to display 28 only. But I have no idea what is this data structure in Python [28 3]
user559633
@Kabyle paste the relevant code
17:05
Theoretically you could just use a dictionary whose keys are strings and whose values are integers. Counter is just that with a few convenience functions tacked on
it's a list with 1 element
there then it should only display 28 ...
or maybe b[0].split()[0]
@Kevin got it
I tried print b[0] but I get the same
I recognize that profile picture...
17:06
b could be a list containing strings that just happen to look like lists.
>>> b = ["[28 3]"]
>>> print b[0]
[28 3]
user559633
@Kabyle again. paste relevant code.
Umm... I had no idea ipython did that...
@kevin ok then how to display only 28 ?
But it could be anything, really. You can make all sorts of user-defined classes that override getitem and repr to produce whatever output you choose
I guess subconsciously I was wondering if there was something about Counter that was important for speed, vs. rolling your own
user559633
17:07
garlic
being that this is an optimization problem in the first place
@Kabyle Not sure I get your question. If you want 28 to be printed, I suggest print 28
is there a way to suppress a warning/errors on a given line in pycharm with a comment perhaps? ie #@IgnoreUnusedVariableError ?
@Kevin nailed it
Thanks all for the help
If your question is "I have this string that appears to be a collection of space-delimited integers, with a '[' and ']' on either side. How do I convert this into a list of integers and access the first item?" then you can do something like print int(b[0].strip("[]").split()[0])
... With the practical answer being "smack your coworker and tell him to send you JSON instead of his weird homebrew space-delimited format"
17:11
I found out how to do it suppress warning/error in pycharm ... its a comment on the line above (and you can select it from the error window)
@Kevin I'm so sorry , i was wrong in what i said. In reality I can display it with b[0]. Thank you very much people.
Oh good, everything worked out :-)
user559633
:] so much garlic i'm thinking of making pasta
:3
I might have some garlic on my steak tonight. (Yes I'm having steak again (yes I'm spoilt :D))
17:13
@tristan not bread?
@Ffisegydd thought you were having steak last night?
Is it guaranteed that if type(var1) == type(var2) then type(var1) is type(var2)?
user559633
@Ffisegydd you're breaking my gosh darn heart with your cooking strategy
Nah I won't have garlic on the steak :P just salt and pepper.
user559633
@61612 yeah because the type to id is evaluated once and shared by that interpreter
Cool, that's what I was thinking, just needed some proof
user559633
17:14
if somehow type(var2) was coming from a different process, then not necessarily (unless python always allocs that location for "core builtin" obj)
user559633
i'm going to ask my 5th question on stackoverflow later tonight (i'm so excited!)
@tristan we'll have the downvotes ready...
Gosh they're launching Stack Overflow in Russian
user2555451
@61612 Most of the time when you do type(var1) is type(var2), you meant to do isinstance(var1, var2). Using type like that will not factor in inheritance (which may or may not be what you want).
@61612 in Russia - Stack Overflow launches you!
17:20
Jon, outstanding
They haven't launched it yet, I already hate it
@61612 you need to make your mark! Get a modship! Take it over!
user559633
@JonClements :) it will be my typical "i researched this to the point of not being able to have a suitable answer" question of getting url_maps in flask's blueprints without putting the instantiation of the flask object in global scope
user559633
I'd be really curious to see what tags are popular in stackoverflow in russian
user559633
I'd imagine C++, PHP, JS, Linux
user559633
weird, i can't click on the question at target of the link
@tristan they're not real questions, they're just examples
user559633
@61612 ah thanks, i'm dumb
user559633
@osimerpothe read the room rules
user559633
also garlic
17:26
ok . =)
user559633
@61612 stackoverflow in russian would be cool -- i'd use it for language practice
I hate the proposed questions, I hate to see smileys like "))", I hate the Russian programming slang, I hate the idea of dividing SO
user559633
Yeah, the )) is a bit weird to see on a stackoverflow. I don't know russian programming slang, but I can understand not wanting to split SO
what is ))
?
any mechanical keyboard aficionados here?
DSM
DSM
17:29
What, like typewriter-style? Steampunk for the win!
@JoranBeasley Russians like to express :) as ))))) (the number of brackets is unlimited)
user559633
@JoranBeasley it's like joking/happy
That's truly disgusting imo
@DSM that's so cool
user559633
@61612 wow, you really hate the parens smilie that much?
17:32
I love the futuristic/archaic motif as in the movie Dark City
user559633
i really don't like how popular animated/graphic heavy emoji are outside of north america/western europe
user559633
e.g. skype emojis
@Pete classic film :)
@JonClements even if you change it to Pete from Peter
it still pings me..
shame on you SO chat..
:)
@tristan I read a HN article the other day about the messaging company "Line", which is big in Japan right now. Apparently their breakthrough feature is "larger emojis than usual"
Me, reading the article: so... Just regular sized images, then?
user559633
17:34
@Kevin lol, it's hard to not lose respect for a culture after reading something like that
Can't say I get the appeal. Although the compsny masvots are cute
@Peter good point - but at least it's not my fault! :)
.. at least ;)
anyway: have you guys checked the new pebble watch yet?
64 colors epaper -- pretty amazing IMHO :)
Here is the actual article, for the curious.
user559633
we're at the end of history
17:39
@PeterVaro, Now that I've got a mail-in Netflix account, I've finally begun my film backlog. First up was Calvary. I didn't like the ending at first, but it grows on me as I think about it.
@Kevin I liked that film especially for the ending
user559633
@Kevin i just don't get why they had to kill the dog
think about it: what would be the point of it, the real weight of the film, without that ending?
@61612 Did you just spot the Area 51 proposal, or have you seen a recent announcement on plans/progress/etc?
I'm still puzzled about the dog myself.
Although I do find it kind of funny that the town butcher would react so angrily at an accusation of animal cruelty
(not that I consider butchers to be an inherently cruel profession.)
17:41
is trying to keep an eye on the Stack Overflow in Spanish proposal
user559633
@Kevin what was the purpose of his daughter in that? terrible actress, boring character
It's all a set up for the final shot when she is on the other side of the glass from the guy from the IT crowd.
I think that scene had some very deliberate stage direction. It's important that you can see the other actor's reflection in the glass
Although what precisely that symbolizes, I can't quite articulate
DSM
DSM
I wonder if there's going to come a time when the only answer I can find to a question is on SO but in another language. I suppose that's what situation non-English speakers are in at the moment.
We should have a @Thor ping.
user559633
17:45
I like to think that the priest is the continuation of Brendan Gleeson's character from The Guard and that Roy from IT crowd was there because his office switched to Google Apps and OS X and he had to move back to the hills of Ireland
@Kevin absolutely agreed
the whole film was about the agony and that last moment
I regret not rewinding to watch the epilogue-slideshow thing of all the side characters at the end. I think there's a lot to see there.
Thor ping would be nice.
DSM
DSM
♫ get a taste of this Scandinavian greatness ♫
17:45
The rich guy glancing at his watch... Oh, my heart broke there.
user559633
What would a Thor ping do?
@Kevin which one will be next from the list?
DSM
DSM
♫ Ragnarok the house ♫, obviously.
@osimerpothe you should copy your error message to the stackoverflow search box first before asking a new question ;)
user559633
I uhh, still don't understand the Thor thing
17:47
@PeterVaro Not sure what order they're being sent in, considering Calvary was in the dead center of my list before I entered it into the system.
user559633
just random.choice it
If it's alphabetical order, Coherence is next
DSM
DSM
@tristan: Mjolnir, the hammer. The idea is to ping people who have the power to hammer-close a dupe.
user559633
@DSM Ah. thanks.
@Kevin ahh... I'm very curious about the reactions you will have ;)
(don't forget to share)
Can you share the list? Need something to watch until HoC S3 on Friday.
user559633
oooh google doc please
Or wiki.
I don't have too many. They can all fit in one post.
Utopia, Enemy (2013), Under the skin, Snow Piercer, Death comes to town, Calvary, Edge of Tomorrow, Coherence, The man from Earth, Rubicon, The Predestination, The middleman, Whiplash
user559633
does anyone bail out of argparse at the earliest moment?
17:50
Odd, I thought I had The Sunset Limited on there. I must remember to add it.
i use argparse all the time... what do you mean bail?
DSM
DSM
No, argparse works fine for what I need it to do.
user559633
instead of dealing with argparse, once i'm done collecting args, i go to argument_dictionary = vars(args) and work with a standard dict instead
ah, there are 2 "wow it worked" answers there at the target
I will protect the question
@Kevin wonderful list.. wondering who has such a nice taste for films like those :P:P
17:51
;-)
(sorry for the pings)
I rarely use command-line flags at all, so no opinion on argparse I guess
DSM
DSM
I use it mostly when I'm writing utilities that will be used by others.
Right now KS' flags are ks.py filename [--strict] and that's it
(If you specify strictness, it crashes if you forget the semicolon at the end of the file)
@tristan usually args.whatever is fine, but here and there I will assign to something else more compact or readable. But I don't re-map as a rule
user559633
17:53
I feel like whenever i start going into mutually exclusive groups and options, it just turns into this mess of fur and lint
permissive semicolon adding, just like its pappy javascript
user559633
like, once i go over 50 lines with some logic in the argparse commands, i start hating life
Just get all your user input from input, problem solved
No command line args, no headache
you might consider moving to input files e.g. json in those cases
DSM
DSM
I don't like json as a config option because nothing stays where it's put. XML is verbose and clunky, but at least it's relatively easy to round-trip.
17:55
Or perhaps a config.ini for longer-lived options
DSM
DSM
I like it for serialization purposes, though.
json.load is extremely powerful and puts everything into a dict for you
DSM
DSM
Dictionaries aren't ordered, which is the problem.
For one of the few work projects I get to do in Python, one of them needed a configuration file that a non-computer-savvy user could modify. I ended up naming it config.py and just importing it in the main program. Such is the benefit of a friendly syntax - no need for separate config grammar :-)
@Pete not if the JSON you are loading defines a list...
@AnttiHaapala: stackoverflow.com/…
Working through this now.
18:00
I am editing the answer a bit
true, config.py is sometimes the best option
but config.py fails when you have to iterate your program many times over different configs
user559633
@Pete meh. input files aren't always the best option. anyway, just complaining
oh ffs - why does it take soooo long to withdraw money from an ISA
it's an interesting thought process... what should I put in the CL options, config.py, input.xml or input.json...
user559633
@Pete i just do variable precedence and allow them anyway
user559633
18:03
command line switches win, 100% of the time, then a config file that's specified, then a default config file, then envvars
that's right, we have to add envvars to the list :)
user559633
then app defaults, then fail
@tristan they're mostly used by kids, I shiver when I see 20 y.o guy using them. See this.
all covered now.
edited
made TL;DR part on top
42
A: What does "SyntaxError: Missing parentheses in call to 'print'" mean in Python?

ncoghlanThis error message means that your program uses the Python 2 print statement print "Hello world" The statement above is does not work in Python 3. In Python 3 you need to add parentheses around the value to be printed: print("Hello world") “SyntaxError: Missing parentheses in call to ...

user559633
18:06
@61612 my girlfriend and her friends make liberal use of those and skype emoji. i get the same ehhh feeling
To me, )))) is reminiscent of poorly designed code. Like I'm reading the end of a line with a quadruply nested function call.
@ZeroPiraeus I wasn't aware of the proposal until today
Not the connotation that I would usually assign to a smile.
:))))))))))))))
nice))
Sighs
18:09
@61612 Ah, okay :-)
ugh, look at all these unmatched parens. Here: ((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((‌​((((((((((((((((((((
That should catch the next hundred smiley faces or so.
Nothing I can do about the ones in the past, however.
@JonClements helionoctis.com/Helix/011807-white-tiger was the mix I was playing at the beginning
@davidism cheers :)
oh someone removed my unessecary sarcasm from one of my answers :(
18:12
So it goes.
@Pete I use the Truly Ergonomic, love it. :)
Can someone point me to a tutorial that shows how to do a Alembic migration with adding/removing/edit relationships?
@jwanglof relationships are a purely sqlalchemy construct, they are never part of migrations
there is no "relationship thing" in the database, only in your model code
@musk please read the rules before continuing: sopython.com/chatroom
@davidism wow, haven't seen that one. mx brown keyswitches? Recently got the daskeyboard brown. love it.
@jwanglof more to the point, they are SQLAlchemy ORM concept; Alembic works on SQLAlchemy tables, and does not care nor know anything about the ORM.
18:22
@musk just use class MyProcesor(
derp ... meant to delete that
I was gonna be sarcastic
but then I thought better of it
@DSM I think the OP just means he wants a collection of items, and used imprecise terminology.
DSM
DSM
@Kevin: your code won't work. No guarantee that the orders match.
@davidism @AnttiHaapala Alrigth, can you point me to a tutorial where they change the constraint on a foreign key? I'm trying to change a foreign key from user.id to user.uid and keeps getting "(1005, "Can't create table 'tillsammans_dev.#sql-4c1_95' (errno: 150)") 'ALTER TABLE profile_accommodation_contact ADD FOREIGN KEY(fk_from_user) REFERENCES user (uid)' ()"
Whoooooops
DSM
DSM
I was thinking [d[i] for i,x in enumerate(seq) if x].
18:23
Darn you, implementation-dependent behavior! shakes fist
Yeah, that's a good idea.
I think I'll stay in deleted land unless I can think of something even better
@jwanglof actually, I already saw your question on the main site, just wait for someone to answer there
basically, we're already aware of it and asking again in here, but without any code, isn't really going to help
@davidism: Alright
@AnttiHaapala: Been reading through it a couple of times but can't get it to work. But I will wait until someone answers my question. Thanks =)
@jwanglof alembic.readthedocs.org/en/latest/… basically like that, but instead of create_table, you'd only do create_foreign_key for the new, and delete_constraint for the old; and the reverse in downgrade
@AnttiHaapala this is why it gets confusing when they re-ask their main site questions
his real question shows that he's already doing that
the real problem is an issue with his data, 1025 is a mysql error code
does anyone know of a good tool to make diagrams of database schemas on mac, that can make it into HTML?
I'm tempted to dupe close it against this: stackoverflow.com/questions/160233/…
18:29
dang im really annoyed with users this morning ... I think i should log off before I destroy someones dreams of becoming a programmer
@JoranBeasley :D
on a side note I found out this works
class X(int if condition else object):
@corvid You mean like an SVG?
not that I would ever do that :P
but it might come in handy in a snarky answer
@Ffisegydd that would be ideal
18:30
:P
@corvid use iDraw. It's relatively cheap (like £20) and does an amazing job while still being simple to learn/use.
@jwanglof if you can still change the DBMS then I warmly recommend PostgreSQL, transactional DDL is a good thing to have when doing migrations...
@jwanglof the truth is, it can be that you have already done half of your migration in MySQL and it is failing because of that
@AnttiHaapala: Okey )(
=)
@MartijnPieters what do you think about duping this to this?
the problem is not really with alembic, it's with mysql, which is what the dupe is about
@jwanglof see the duplicate I linked, basically you're using the wrong thing to name the constraint
ah that is better
18:35
@AnttiHaapala nice, did you miss me linking the other one earlier?
@davidism But the error codes don't match.
150 vs. 152
d'oh
retracted
wait a sec
it is errno
@MartijnPieters seems that same error, see here: stackoverflow.com/questions/160233/… the errno is 152
Yeah, looking into the error code.
But how should a Alembic user fix this?
18:38
the migration was autogenerated
Can the drop be adjusted to use the constraint name?
Yes, but you can then edit it.
yes
the alembic autogeneration really does not even try hard on mysql bc it is impossible to get some metadata
and alembic does use drop_constraint.
and no one really cares, go to #sqlalchemy @ freenode and everyone recommends to ditch mysql
@jwanglof SHOW ENGINE INNODB STATUS
the error is there, maybe...
Uh oh, sort is broken apparently
8
(would it have killed them to have provided a sample list that exhibits this problem? Why do I need to git clone just to get that?)
DSM
DSM
18:45
"However, on current machines it is not possible to trigger an out-of-bounds error in the Python version: it allocates 85 elements for runLen, which suffices (following our analysis in the full paper) for arrays with less than 2^49 elements."
So... Not small enough to copy-paste, then. Got it.
DSM
DSM
:-)
Neat paper, though. It looks like the best of all worlds: an interesting bug, an interesting approach, and yet no chance that it's ever affected anything I've done. That's the kind of bug I like. :-)
Can't write Deep Thought in Python then, I need to support at least 42^42 elements...
@AnttiHaapala: SHOW ENGINE INNODB STATUS; shows: pastie.org/9979157
@jwanglof I do not know what that means even. Frankly I have never chosen MySQL anywhere, only migrated systems away from it.
18:51
@AnttiHaapala: Care to explain why? Just shortly
bc MySQL error messages are incomprehensible, it is slow, does not follow SQL standards, did not even understand Unicod (though a bit better), does not enforce transactional integrity on schema changes to name some.
Is it technically accurate to say "python functions are always pass-by-reference"? I want to school this OP but I don't want to teach them something incorrect
Righty, thanks. Gonna see if we can migrate from mysql to postresql
@Kevin I'd say it is, in CPython it is PyObject* that gets passed around
@jwanglof personally I do not understand how MySQL is boasted to be so easy, I have never seen anything as incomprehensible as you just evidenced, coming from PostgreSQL

« first day (1592 days earlier)      last day (3581 days later) »