« first day (2270 days earlier)      last day (2903 days later) » 
00:00 - 17:0017:00 - 22:00

00:13
It's always nice when your code eventually works.
 
1 hour later…
01:39
Hey, has anyone running 3.6 been unable to use Tkinter in an interactive REPL session? A simple root = __import__('tkinter').Tk() pops a Tkinter window in 3.4, but when I try that on 3.6 it doesn't do anything.
@PM2Ring you'll be happy to hear that I've just used lru_cache with success for a coin change problem;)
@TigerhawkT3 why are you using __import__('tkinter')? cause that's not sane
@WayneWerner Just for a chat-friendly single line.
ah. import tkinter; tkinter.Tk() is also a "single" line
that fails on one of the major pythons, right?
although I'd stick with that variant regardless
01:48
@AndrasDeak the ; or Tkinter vs tkinter?
the import + ;
works on 2.7.10 and 3.6
I'm not aware of anything it doesn't work on
but it doesn't
yeah, I'm confusing it with something
if you got access to some ancient systems, you're welcome to try it ;)
I'd swear I've seen something similar where something wasn't allowed on the same line as something... or something:/
oh well
01:51
There probably is something that's not allowed on the same line as something. Maybe a lambda?
I don't like semicolons.
We don't like bare __import__s:P
Well, yes, for production code you should never use ;, that's just insane
Your mom is a bare __import__! :(
but there's probably a reason, somewhere, for using __import__. But you don't have that reason.
01:53
yeah, like, for using __import__ in a lambda in a list comp
All I wanted was a simple, single statement that could be easily copy-pasted.
we're probably straying from the topic
I could've gone with exec('import tkinter as tk\nroot = tk.Tk()'). :P
much better
who said oneliners are not elegant
import tkinter; tkinter.Tk() is vastly less likely to cause problems. AFAIK, __import__() actually does work slightly differently than import
I could be wrong there
And if someone can verify my wrongness I'm more than happy for them to do so :)
01:57
Well, do it the normal way, then. My question was really about Tkinter not being usable in an interactive REPL session in 3.6.
you could also always just do two lines with the fixed font option --->
Anyway, works fine in my REPL. When you say "doesn't work"... that's not an [mcve]
Nothing happens.
>>> import tkinter; tkinter.Tk()
>>>
In cmd.exe or PowerShell, just trying to test little Tkinter things without writing and saving a script.
that's what you get, and no Tkinter window?
01:59
Yeah, when I do that in 3.4, it pops a window. 3.6, no window.
OS?
and presumably you're on 3.6.0, not an rc or anything right?
Just wondering if it's working as intended. Yes, full release version.
doesn't sound like it is. I suspect something is gone sideways.
I guess I'll try restarting my PC at some point.
what's your OS?
02:07
Windows 8.1.
Well, no clue. I'd give restart a try. I'm off for dinner rhubarb
Rhubarb.
 
2 hours later…
03:56
Cabbage :-)
 
2 hours later…
05:54
does anyone in here know how to handle foreign characters when trying to append text from a file to a new element using lxml? I keep running into UnicodeEncodeError and can't seem to avoid this problem
 
2 hours later…
07:38
@Johnny yes, use python3
@Johnny Validating beforehand might help you xmlvalidation.com
08:13
@AseemYadav it doesn't have anything to do with this issue..
08:54
Happy new year cbg
09:13
cbg
happy new year
 
1 hour later…
10:16
new year guys
10:29
New Year people
Guys I need to learn python. Cann somebody recommend me some good tutorial. Thanks in advance
@Gardezi we have a small list here
Hello, does anyone know why Pelican CMS website is not available since 4 days by now? docs.getpelican.com
thanks @vaultah
@BillalBEGUERADJ nope
thank you
Can I ask my question on SO or is it off-topic?
10:40
how can i create new python environment in emacs just like virtualenv in shell
so that inferior python environment
belongs to
that environment
cbg guys!
guys, I was trying to convert a huge dictionary (that had many keys, each key having many values) to lowercase. for that I used this -`import ast
synlist_lowercase=ast.literal_eval(str(synlist).lower())`
but as a result of this, I lost some entries for some reason
its difficult to find which easily, as the dictionary has millions of elements
any idea whats happening?
11:45
@user1993 natural, you had some keys such as Swede and swede
only one of them remained.
each key has only one value - possibly a list
Cabbage
@user1993 What Antti said. To avoid earlier items getting clobbered by later ones you'll need to build the lowercase dictionary the slow way, looping over items one by one so that when you encounter a key that already exists you can add the new data to the existing data. Assuming the values are lists, you can use the list .extend method for that.
Hi, Antti.
I get the feeling that this OP still doesn't quite get the __str__ vs __repr__ issue as it applies to strings, but I don't know what more I can say to her. stackoverflow.com/questions/41413667/…
12:05
cbg
"slow way"
@user1993 the "slow" way isn't slow
Happy new year
you'd have a d = defaultdict(list); then for each key, values pair in the dictionary, you'd do d[key.lower()].extend(values) - that is, if they're lists...
@PM2Ring actually I think you're not getting it :d
the question is: why are \u2000-\u20ff escaped
@PM2Ring their answer is correct
@AnttiHaapala Maybe. :) IMHO, everything apart from printable ASCII ought to be escaped in a string's repr, with a \x sequence for codepoints < 256 and with \u or \U for higher codepoints.
bollocks, it was a bug in Python 2
Python 3 uses UTF-8 for source code, it is now perfectly valid to have string literals with unicode in it
which one is better in your opinion?
[u'\u4e2d', u'\u570b', u'\u54f2', u'\u5b78', u'\u66f8', u'\u96fb', u'\u5b50', u'\u5316', u'\u8a08', u'\u5283']
['中', '國', '哲', '學', '書', '電', '子', '化', '計', '劃']
or
which one would the NLP programmer working with Chinese languages prefer?!?!
12:18
@AnttiHaapala Fair enough, in an ideal world. But UTF-8 support isn't perfect everywhere. Just ask most Windows users programmers.
I don't ask windows users
most windows users wouldn't care
novice windows programmers would care.
most windows users just want their shit to work
the solution is to use UTF-8 everywhere...
and stop doing that ansi crap
@AnttiHaapala dont use slang.
@TheExorcist scusi, what's slang? ansi crap is a technical term.
the word shit
12:21
oh shit, he said that
I thought you meant crap
@TheExorcist You may make requests of other members here in regards to their behaviour, but please do not tell others how to behave, especially when the other person is a room owner.
agreed
"Rudeness and belittling language are not okay. Your tone should match the way you'd talk in person with someone you respect and whom you want to respect you. If you don't have time to say something politely, just leave it for someone who does." :D
12:23
@TheExorcist Thankyou for your cooperation in this matter.
this is how Finns talk with the people who they respect :D
@TheExorcist I would also suggest giving more consideration to what you flag. A message that gets deleted due to offensive flags will lead to an automatic 30-minute ban for the author. It is sort of a rude gesture to flag non-offensive material.
@AnttiHaapala well some of them might be complex analysis, eh? hyperbolic sine of i*t
@AnttiHaapala also, there's a name coming up on that list a lot of times:DD
on the first page :P
12:27
hmm ..after doing that i realized
on the next page, not that often
@AnttiHaapala The other day I was trying to answer a Unicode question that involved some Hangul. The fonts I use in my editor & terminal have tons of alphabets & a zillion emojis, but couldn't render that Hangul, which was rather annoying, and it also made it hard for me to demonstrate that my code gave the desired result.
yeah, I didn't check page 2:)
@PM2Ring rly?!
hmm gotta test
12:29
cbg
훈민정음
cbg
@PM2Ring ^that seemed to work rather nicely in my terminal
Hey, anyone with 3.6 unable to pop a Tkinter window from the REPL? I asked here earlier and stepped away until I got a chance to reboot. Rebooted and still seeing the same issue.
@AnttiHaapala Yeah. Here's the question: stackoverflow.com/q/41374122/4014959
12:30
hehe we should open donations for PM2 to buy a new computer that can run a recent ubuntu
@PM2Ring though it seems that all hangul are also double-width.
perhaps that's your problem, what program do you use as the terminal?
I'm currently on a Chromebook, which seems to be a bit better with Unicode stuff than my old desktop machine. OTOH, I did update my fonts on that machine only a couple of months ago so I could do full-colour emojis.
is that a good thing?:P
My usual terminal is KDE's konsole. But remember it's on a dead distro. It does have problems with fancy Unicode stuff, especially with glyphs of non-standard width, or with RTL text.
yeah ubuntu 16.10 is rather good
how old is your desktop=
I built mine in beginning of 2009
12:34
I want to extract from the database lastly recorded

c.execute("SELECT content FROM page WHERE URL = 'url'")
extract = c.fetchone()[0]
but gives me first record
any idea?
What's wrong with RTL text, חבר? :P
@IsabelCariod there is no ordering in tables...
@IsabelCariod you should first go on google and do a query over there
@TigerhawkT3 I have Python 3.6 on my desktop machine (& I'm using this Chromebook in guest mode, so I don't have much apart from a browser). I do a bit with Tkinter, but I hardly ever do Tkinter stuff in the REPL, so I'm not sure if I've encountered your problem myself.
@TigerhawkT3 RTL text is a pita...
I get headache when I try to copy-paste some arabic text
12:35
@AnttiHaapala Good; I love pita bread! It's RTL's favorite bread.
use fetchall()
@TheExorcist ... no
I want one record
@IsabelCariod you need to order by a relevant column, tables are unordered; then limit 1 to make the query to result in only one.
if you don't have a column that would tell the recentness of a row, you can't do this in standard sql
@TigerhawkT3 I see what you did there, and I like your sense of hummus.
12:37
I will use id
thanks!
@AnttiHaapala you are correct my query can damage my machine.
for example: SELECT content FROM page WHERE url = 'url' ORDER BY id DESC LIMIT 1
(god FSM I hate SQL)
waiting for unicode 10
The SQL is always worse than the original.
@TigerhawkT3 why are you pun-ishing us
is the best way to store information on any type of app
12:41
@AnttiHaapala Maybe 10 years old, it's hard to know exactly because it's all built from recycled parts. The CPU is 32 bit genuine Intel, 2GHz, and I have 2GB of RAM, which is the maximum it can take.
yah
mine has now 8G ram, mobo, processor are originals
64bit
:D:D
Closed
13:23
Quick question guys, explained in: dpaste.de/VOTH
haha Haparanda-Tornio twin city had a "Happy New Twice" party, where you could celebrate New Year once in Finland, then walk 10 meters to celebrate the new year once more
@Emre does the keywise ordering matter?
Yeah
anyway, use zip(*d.values())
>>> list(zip(*d.values()))
[([5, 6], [1, 2], 'foo'), ([7, 8], [3, 4], 'bar')]
if you need ordering, sort the keys, extract values
>>> list(zip(*(d[k] for k in sorted(d.keys()))))
[([1, 2], 'foo', [5, 6]), ([3, 4], 'bar', [7, 8])]
>>> for row in zip(*(d[k] for k in sorted(d.keys()))):
...     print(row)
...
([1, 2], 'foo', [5, 6])
([3, 4], 'bar', [7, 8])
The last 1 is not correct
and why is it not correct
13:34
for a weird reason if i do the * in the zip it doesn't get everything of the dict
but if I remove the *, it gets everything
user error?
I have absolutely no idea about what you're doing there, did you try to copy paste verbatim
works for me
>>> d = {'c': [[5, 6], [7, 8]], 'a': [[1, 2], [3, 4]], 'b': ['foo', 'bar']}
>>> for row in zip(*(d[k] for k in sorted(d.keys()))):
...     print(row)
...
([1, 2], 'foo', [5, 6])
([3, 4], 'bar', [7, 8])
(dict condenced on one line, but equals your original)
(well, the original had indentation error in the for loop)
13:36
if you didn't get the same result, you're suffering from a PEBKAC error.
(and a syntax error)
PEBKAC?
@Emre Problem Exists Between Keyboard And Chair
@Emre see, the problem is that your data is not of even length.
>>> d = {'c': [[5, 6], [7, 8]], 'a': [[1, 2], [3, 4]], 'b': ['foo']}
>>> for row in zip(*(d[k] for k in sorted(d.keys()))):
...     print(row)
...
([1, 2], 'foo', [5, 6])
so, you were lying to us: your data was not of that format.
13:39
I did remove the sorted
(see how that 'b' is missing one 'bar')
@AnttiHaapala where did you see that?
@AndrasDeak nowhere, I just deduced it.
13:40
also known as the ID10T error
the fault is in the red component in that assembly
@Emre try itertools.zip_longest with an appropriate fill value
@AnttiHaapala that won't help
they'll need to first figure out what the hell they actually want to do with their data
Now, now, guys. You'll make Emre feel like they're being picked on...
>>> for row in zip_longest(*(d[k] for k in sorted(d.keys())), fillvalue='THIS ONE IS MISSING!!!'):
...     print(row)
...
([1, 2], 'foo', [5, 6])
([3, 4], 'THIS ONE IS MISSING!!!', [7, 8])
Sorry, I didn't mean that. Consider my previous message without any emotional connotations whatsoever:P
13:42
Ahh I see what you mean antti
Wait
Im gonna make a new dpaste
1 sec
@Emre If you don't need the sorted then you should just use Antti's simpler original version. But you probably really do want sorted so that you can get the dict items in the order you want them to be in.
I tried to ask if the key ordering matters, Emre said "yes" so I ordered the keys
otherwise the order of the items in the result is guaranteed to be arbitrary
otherwise just list(zip(*d.values()))
13:44
In CPython in 3.6, dict is no longer unordered.
yes
to put that statement in perspective: people still use python 2
Well, they should cut that out. :P
and Python 3.5
;/
@TigerhawkT3 True, but that's an implementation detail that (currently) should not be relied on. FWIW, it's not the case in the alpha version of 3.6 that I've been running.
Heck, I am even using Python 3.4
13:45
3.6 is too cool not to use.
we won't stop assuming unordered dicts anytime soon
The PEP about it flatly states that dict is ordered. A summary of the PEP in the "what's new in 3.6" page says it's an implementation detail. I'm not sure what the deal is.
what is true of 3.6 is that keyword arguments are ordered...
@TigerhawkT3 maybe pypy or jython don't (won't?) guarantee it to be ordered?
but it could be that there are 2 dictionary implementations
13:47
dpaste.de/fHhW Updated version
your pseudocode is confusing
and you seem to be doing something entirely different, is that on purpose?
Yeah
and when you say "prints (foo) (bar)" or "prints (1,2) (3,4)", what do you actually want it to print?
@TigerhawkT3 PEPs live in an ivory tower. :) Give it time, and it may become an official feature rather than an implementation detail. Stuff like that needs to go through at least a release or two of real-world testing. And possible enhancements to the implementation.
13:51
I'll keep that in mind.
So far, the only drawback to 3.6 is that Tkinter doesn't work from the REPL for some odd reason.
@AndrasDeak I've just found another solution. I've been thinking too complex. My apologies.
@TigerhawkT3 the problem of ordering-preserving dictionary is that it is a behavioural change, whose absence can lead to subtle bugs
it might very much be that the ordering of a dictionary will be 'a', 'b', 'c' on python 2 say...
Consider the changes made to division. The // operator was introduced in 2.2 or 2.3, but it wasn't until 3 that the old / behaviour was finally deprecated (although we've had the new behaviour via the __future__ import for almost all that time, IIRC).
but that's actually a counter-example - all this time you should have used from __future__ import division in your code
and it was 2.2
16 years ago.
and people are complaining: "we weren't told, our code breaks in python 3, python 3 is sh*t"
My old workplace moved from Perl to Python in 2015.
Python 2.
They thought Python 3 was some sort of unstable alpha with no libraries.
13:57
lol?
COL! (crying out loud)
@TigerhawkT3 they'll learn the hard way
Last I heard, everyone there was too busy wondering about layoffs to actually get any work done.
@AnttiHaapala It's an example of how long it takes for fundamental changes to become fully sanctioned. I agree with what you're saying about using the future import, though. And although I didn't use that import, I always used // when appropriate & never wrote code that used / that wouldn't function correctly under either set of rules (although as we've discussed before, doing stuff like 22./7 is inferior to using the future import).
@TigerhawkT3 "They thought Python 3 was some sort of unstable alpha with no libraries." Where did you work? ZedShaw Industries? :)
12
*did
As it turns out, converting interns to full employees isn't really a thing when you buy a company and take on a few hundred million dollars in debt.
rbrb
14:04
rbrb
I'll probably be back soon-ish
bisy backson
14:22
re-cbg
re-cbg
re-cbg
DSM
DSM
Morning cabbage for all.
14:32
Hi, DSM. Sorry I didn't acknowledge your greeting the other day. I was typing on my new phone, which is kinda painful, and I wanted to finish the discussion I was having ASAP because I had IRL stuff I needed to do.
DSM
DSM
.. I have no idea what you're talking about, which I think you should take as a positive, in that I clearly took no offence. :-)
@TigerhawkT3 balance wheel watches, slide rules, punch cards :D
proven technology.
@DSM Oh good. :)
@PM2Ring no one actually types on an android phone. Have you tried dictation?
@AnttiHaapala Yeah, they didn't want to take unnecessary risks with their internal-use scripting language while gambling the whole company.
14:39
......
they just did
@AnttiHaapala No, I haven't tried dictation... I guess I should give it a go.
my fav was setting the language to Indian English :D
then speaking like
Actual Android devices (not FireOS) generally use the Google keyboard, which allows swipe input. I find that much faster than tapping each individual key.
I am thinking that could be amusing.
100 % correct :D
14:42
If your phone supports USB OTG, you can plug in an adapter dongle and just connect a USB keyboard.
And then you can be this guy.
You might also want a hands-free headset.
15:11
anyone an idea how i can assume there is a specific parameter (named "xy" for example) - want to create a decorator that checks the value of the "xy" parameter
@TryToSolveItSimple the easy way is to only allow keyword arguments
@TryToSolveItSimple for a more general case, something like this: stackoverflow.com/questions/627501/…
thanks i'll have a look into it
hmm
@TryToSolveItSimple are you using Python 3.recent?
any specific reason why 3.3?
15:16
company is using this release atm - would need to test alot before upgrading the python install on our servers
there is a better api for this in Python 3...
a sec, I will answer there
inspect.getcallargs(func, *args, **kwds)
@TryToSolveItSimple this should work in 3.3 rather nicely but it is now deprecated
great thanks alot
>>> def test_func(x, y=5, *a, z, **kw): pass
...
>>> import inspect
>>> inspect.getcallargs(test_func, *[1], **{'z': 42, 'k': 56})
{'a': (), 'kw': {'k': 56}, 'z': 42, 'y': 5, 'x': 1}
so it will work even if you call a function with positional arg (above, x is passed in as a positional arg, but it is available in the dictionary nevertheless)
15:37
There are so many corner cases to the automatic tablename generation in Flask-SQLAlchemy, and it's driving me crazy: github.com/mitsuhiko/flask-sqlalchemy/issues/349. Every fix I try breaks a different case.
etc.
DSM
DSM
Sounds like a fun Monday!
Have to worry about abstract models, mixins, direct attributes, computed attributes, and at least three different meanings of inheritance depending on other attributes.
DSM
DSM
If the implementation is hard to explain..
Blame SQLAlchemy.
DSM
DSM
Is there anything that sqlalchemy could do which would make your life easier?
(I'm thinking of some projects where we eventually asked numpy to change some stuff. Took them forever but they got around to it.)
15:48
We're copying Django's automatic tablename feature, but SQLAlchemy is just a lot more complex so it's not straightforward. Nothing SQLAlchemy can do.
Today's my last day off so I figured I'd at least try to get some open source work done. :-)
DSM
DSM
Sounds like you're just hosed. Ah, well, that's what they (don't) pay us for.. I was pinged a few times about some PRs of mine which are slowly bitrotting, but I went the other way and thought to myself "I'm on vacation, the only code I'm writing is for AoC.."
"blame sqlalchemy?!"
I blame thiefmaster for using a total antipattern :D
and the last comment is correct... that's what one should do.
16:06
It still results in unmanaged access errors.
Yeah, because __get__ is still called on declared_attrs. It also doesn't solve the problem with mixins (323).
Trying an EAFP approach now, assuming it's safe to call DeclarativeMeta.__init__ more than once for a class.
16:25
Here is a image dataset available: http://www.multimedia-computing.de/flickrlogos/sdk/FlickrLogos-32_eval-kit-1.0.3/testdata/retrieval/bow_tfidf-sqrt-trainval_root-sift_k=1000000.html

Does anyone know how to convert it into Tensorflow's `.weight` file? Do I have to extract/scrap the images from this link?
I think there should be some way to directly download it into folder as this dataset is mentioned as part of tutorial
user7355702
Is it possible to "enrypt" your python code, so other people cant steal the code.
user7355702
?
No. But that's ok, no one wants to steal your code. Really.
user7355702
Really, there is no way... At all?
16:40
No, really, no one wants to steal your code.
Focus on writing good stuff instead of worrying about that.
user7355702
dude.
user7355702
thats not what I am asking
I've answered your direct question and your implied question.
user7355702
uh
user7355702
nvm
16:42
You could run it as a remote service and never release the code publicly. That's the only way, in any language.
user7355702
By the way, I got another question.
user7355702
What is the diffrent on a software engineer and a software developer
user7355702
who has the highest avg. salary?
The only difference is the word a particular company chooses.
user7355702
so its the same?
user7355702
16:43
thats what you are saying.
Or it might be different. There's no standard.
user7355702
so you are not sure?
user7355702
you are guessing?
No, I'm sure there's no standard.
DSM
DSM
davidism is right. My firm doesn't even have any "software engineers". Other firms make a very strong distinction between engineers and developers and have both.
16:50
I think in general, "software engineers" are seen as better at producing robust code, whereas a "developer" is seen as a code monkey. That's just my impression though.
I work for a large firm with lots of Python programmers. Outlook says I'm a "Programmer". My group is called f"{Something} Architecture". We use "software engineer" and "developer" fairly interchangeably - probably because we have bigger fish to fry than trying to split hairs on the semantics. We'd never use the term "code monkey" - that would probably be a career limiting move.
Yeah I personally see them as interchangeable, but there are certainly people who make the distinction and it usually comes down to "software engineering" as the one they see as more prestigious/capable
user7355702
Uhm, software engineering, and software development. Is two diffrent things. I tried searching for the avg. salary of both of them in my country.. Check them out:
user7355702
16:55
You can see that software development earn a little more
user7355702
every month
Oh, of course, we were supposed to be talking about Denmark's standards.
user7355702
(u can set it to english, its properly in danish)
Really, it's not standardized from one place to another.
user7355702
no not at all..
16:55
I remember reading about a guy who was a carpenter who built decks. He changed his title to "designer" or something like that and doubled his hourly rate.
user7355702
Its just.. how it is in my country..
DSM
DSM
@SebastianNielsen: several people have told you now that the words are used in lots of different ways. Why are you so convinced that there's One True Meaning(tm)?
user7355702
Do you know why I care about this so much?
DSM
DSM
I'm still not sure what it is that you're caring about.
user7355702
I am soon finnished with school, and are going to choose my "path."
16:56
Because you're looking for a job? Just go ask companies. Really, we'll answer questions if you have them.
user7355702
I can choose between software engineering, and software development.
If you're in school, then ask your career center or guidance counselor.
user7355702
But they dont know..
user7355702
Or I havet asked them..
Don't ask random people in a worldwide chat room about Python.
user7355702
16:58
Well, you got a point, but it was worth a try.
00:00 - 17:0017:00 - 22:00

« first day (2270 days earlier)      last day (2903 days later) »