« first day (2688 days earlier)      last day (2485 days later) » 

00:01
@SebastianNielsen Not knowing Selenium does not help but it looks like a dictionary might be more efficient than what you have at the moment. I know you mention performance wise but I would go for the most efficient and to me that is a dictionary
You seem quite set on what you have currently and I would say that is fine. It's down to personal preference as well
Well in my case it is pretty much about personal preference as the function will only be run a minimal ammount of times. But you are right in that I properly should consider the dictionary approach if the function were to be run multiple times in order to avoid overhead.
Goodnight guys and thank you for your time Simon, it is very much appreciated.
00:18
@SebastianNielsen No problem. Rhubarb. Good luck with your project. You'll have thought of a solution by morning
00:35
Recbg
@SebastianNielsen a third alternative is to use lists.
@Simon @SebastianNielsen general software design principles are typically much more important than efficiency
And optimizations for speed should be made based on measurements, not guesses
I had in mind not creating 2 unnecessary variables. Also tuples over lists.
00:57
My 13yo brother started learning Python
But he's using Learn python the hard way :s what do?
@TomasZubiri "What do?"?
01:16
Rhubarb all.
 
9 hours later…
09:47
cbg
TIL about /bin/true
cbg all, this is my first visit to this chatroom.
recbg & welcome!
 
1 hour later…
 
2 hours later…
12:49
@TomasZubiri tell him not to do that, because it really is the hard way
Also point him to the wiki for some specific complaints, and tell him to forget python 2 and learn 3 because 2 will die in 2 years
@AshishNitinPatil nice
@Aran-Fey why no comments?
13:10
hi there!
Any ideas on how python script can be run from chemstation?
@БеляковаАнастасия A generic solution would be to be able to execute a system command which will look something like this
/path/to/python.exe my_script.py
13:38
@AshishNitinPatil Thank you. How to do that in macro?
I don't know how chemstation communicates (or is able to) with the system.
14:00
@AndrasDeak not in the mood to babysit anyone today
Hmm, weird, I can't reproduce your output
b'Loading...\r\n'
sending data...
done
And then it just hangs
It does print the remaining output after I interrupt it with ctrl+c though
14:19
@Aran-Fey Python3? Plus, I modified the ciao.py a bit.
Python 3.4. It works if I add flush=True to the print('Done')
I don't know, my goal was to give direction, I think I achieved that. Currently my brain is out of processing capacity (even though less productive day) :/
Guess there's nothing wrong with your code. Not sure why it buffers those 2 lines though
14:34
rbrb, have a nice (remainder) day
14:50
afternoon
jjj
jjj
afternoon! (finally someone from my timezone)
 
1 hour later…
answer
@AndrasDeak lol Andras
I'm running this script as I'm trying to start a ssh server based on python. Found some script here and there.
from pexpect import pxssh
conn = pxssh.pxssh()
if not conn.login ('127.0.0.1', 'toto', 'tata'):
    print("SSH session failed on login.")
    print(str(conn))
else:
    print("SSH session login successful")
    conn.sendline ('ls -l')
    conn.prompt()         # match the prompt
    print(conn.before)     # print everything before the prompt.
    conn.logout()
This one for example
@AndrasDeak oh yeah. Let me do it now
isn't that just part of the traceback?
16:16
@AndrasDeak wait. let me try something
good stuff. son in law is working his math in front of me and I'm geeking hard
win - win
ha, I didn't know you were old! :P
@AndrasDeak yep I am
not that old but still older
trying to keep my goofball attitude though
it keeps me young at heart
lol
:) your age is not obvious so it might be working ;)
@AndrasDeak lmaaaoo
damn. how to teach a kid to work hard when you were not that hard working when you were studying
they don't have to know that, plus they don't have to work hard if they can work smart
16:21
@AndrasDeak he's not doing that yet
lacking methodology
yeah, I don't know about that...
but going to a coffee and working with him do the trick
smart kid but lacks the discipline yet
but going there
he'll likely grow into it
16:22
I see the difference now and when I arrived to be with my girlfriend
thanks for the advice, Andras, of not telling him that I was not much hard working ;)
no problem :P
16:34
I really love the corresponding PEP references, and the other fine details I was oblivious of.
New super ... *facepalm* stupidly using the old style till now.
jjj
jjj
16:47
@AndyK :D that's very funny
Hhm, at the beginning K. Lamar looks a bit like Omar from the wire
@AshishNitinPatil I had no idea about nonlocal. Seems useful
17:05
CBG
@Code-Apprentice that all caps cbg reminded me of this comment (the reply to the highlighted one)
17:28
Helo guys,where can I ask algorithm related question?
like maximization of path in 2c yarra
@AshishNitinPatil and was entirely accidental...
that reddit is very amusing
jjj
jjj
Is the game any good? Ive never played it
Oh, ok I had no idea what its about. nvm
@jjj (highly biased opinion since I've been playing for >9 years) Yes, it's the best MMORPG out there. Regular tournaments with biggest prize pools in the history of online gaming.
17:37
okay...I think it is time to switch back to KDE.
jjj
jjj
@AshishNitinPatil good to know. For some reason Ive never got into mmorpgs. Maybe I should try it then.
I'm too annoyed with GNOME right now.
@AshishNitinPatil Which MMO? I can't find the beginning of this convo.
@jjj The in-game tutorials aren't very great, but there're quite some online guides out there that are very newbie friendly. Good luck!
@Code-Apprentice The reddit link is to Dota 2.
jjj
jjj
thks :)
ahh...I didn't look at which subreddit it was.
I was busy laughing at the ppl holding down SHIFT
17:40
YEAH ME TOO :D
@Momo6aye3 @ZackTarr Have you looked at the source code for tkinter? Particularly scrolledtext.py. It's source code demonstrates a working example.
If you don't know where to find it run import tkinter.scrolledtext as st, st.__file__ and it will give you a file location.
brief cbg
Cabbage.
jjj
jjj
18:22
Huh, this question is so good
well not "so good" if it were asked today ;)
jjj
jjj
hm, maybe I meant the top answer :)
for some reason I really enjoy these optimization related questions and answers
19:12
@jjj lol
@jjj Omar... That character was played like ... wow
hey @AaronHall
@AndyK Hi!
@AaronHall how's life as a mod?
Interesting sometimes...
@AaronHall lol
@AaronHall hopefully you have pleasant surprises, from time to time :)
With my user-hat, sometimes, rarely when wearing my mod hat, actually...
19:28
@AaronHall damn...
@AndyK easy on the swears, please, that's a little outside of normal for the Python room. Or maybe not, depending on how you define normal...
Building a community is hard, I created my own Finance meetup, 2 others rsvp'd for the first meetup and both didn't show, I'm currently at my second one, nobody else RSVPd... :/
But at least I'm hanging out with a Python buddy...
at least you have 100% turnout today
200%, to be precise... :)
Have you included me? If not that makes 201% :p
19:44
See, I can hang out with you guys from the comfort of my living room couch or even my bed. But with a real-live meetup, I get the benefit of packing up, getting on the subway, sitting on a bench that has had God-knows-what on it, with no wifi, then getting to the building and hoping we're not going to have any problems actually getting in... then sitting awkwardly on a bench at the work-share place wondering if someone's going to actually rsvp at the last minute,
or if it's just going to be me and the guy who's letting us use the space...
You missed a part: "getting lost". That always happens when it is important not to be late
 
1 hour later…
20:59
recbg
21:17
how would you write something like this in python from js let object= {hello:"world"}
@Rick object = {"hello": "world"}
OR
hello = "hello"
object= {hello: "world"}
o cool same syntax, and can you iterate over a collection of objects using [{},{},{},{}] the range function
Not exactly. range is used to construct iterators for easy consumption (mainly via indices), but you could iterate like following
for fruit in ['apple', 'guava', 'mango']:
    print(fruit)
With range it'd look something like
fruits = ['apple', 'guava', 'mango']
for i in range(len(fruits)):
    print(fruits[i])
well how about property iteration for exmaple in js [{name:"sam"},{name:"joe"},{name:"sammy"}].forEach(x=>console.log(x.name))
It'd work similar to js, although a few syntactical differences for defining properties (usage is the same, x.name)
21:29
so this not an object literal in python
object= {"hello": "world"}
Since it's interactive, you should fire up a python shell and try for yourself! A good place to start can be the official docs or some 3rd party interactive tutorial, like learnpython.org
@Rick no, that's a dictionary in python. objects are bit different.
no offense but python documentation is abysmal. Thanks anyway @AshishNitinPatil
@Rick Umm, IMO python documentation is one of, if not the best docs for any language / framework.
You can even access it in your interpreter by doing something like help(print) or print.__doc__
21:44
@Rick to avoid "" when you have keys that are legal Python names it's common to do:
a_dict = dict(
    hello="world",
    something="else",
)
@AaronHall o nice, can you iterate over a collection of these dictionaries in an array/list?
Yes.
@Rick I would not call the docs abysmal, either, this usage is noted in the official tutorial: docs.python.org/3/tutorial/datastructures.html#dictionaries
When the keys are simple strings, it is sometimes easier to specify pairs using keyword arguments:
>>> dict(sape=4139, guido=4127, jack=4098)
{'sape': 4139, 'jack': 4098, 'guido': 4127}
nice!! let say I wanted to iterate over a collection of these dict over the jack property in your example ?
assuming all dicts had the same property but with different property values
for each in [{"name":"sam"},{"name":"joe"},{"name":"sammy"}]:
    print(each["name"])
"each" may not be the least confusing variable name to use :P
21:53
I might do it:
for each_dict in [{"name":"sam"},{"name":"joe"},{"name":"sammy"}]:
    print(each_dict["name"])
@Aran-Fey agreed, I was relating it to the "forEach" in a way, but yeah, a _dict at the end won't hurt.
(forgets the opposite of prepend...)
time to sleep before I forget anything else apart from append :-p rbrb
interesting the "in" keyword is exactly like "of" in js
I never see this type of standard for loop in python for(var i=0; i<25;i++){}
You probably have. It's for i in range(25):
@Rick Well, in python doesn't need to declare variables before assignment, so, the above could just be interpreted (in python) as
for i in range(0, 25, +1): # do something
The 0 and +1 are defaults, so don't need to be explicitly mentioned.
is the iterator i in your example a global or is it an implied closure?
22:06
python rarely deletes variables you've created. The i will live until the end of the function/class/scope
>>> for i in range(5):
...  pass
...
>>> i
4
>>> for i in range(5):
........... for i in range(1)
...
>>> i
what happens to i now
Each for loop overwrites i's value, so it'll be 0 at the end.
and the loops will work just fine
is python considered a functional language or is it a strictly Object-oriented?
The reason I ask is that I see init everywhere and I don't know what relationship functions have to object in python or if there is one.
22:26
It's an imperative language, not functional. And as usual in OOP, the relationship between functions and classes is that functions turn into methods if they're defined in a class. The __init__ method is the constructor.
Hmm, I wonder how many people are currently trying their best to resist the urge to "well, actually" me
Let me add this disclaimer: Everything I say may or may not be slightly simplified to make it easier to understand and more appropriate for the beginner level
@Aran-Fey exactly what I thought I should put out while I was replying, but was too lazy to do.
23:02
@Rick I would describe Python as an object-oriented language that supports the functional paradigm to an extent. For a bit more of a discussion of where Python and other languages fall here, I suggest you read the introduction here: docs.python.org/3/howto/functional.html

« first day (2688 days earlier)      last day (2485 days later) »