« first day (1321 days earlier)      last day (3081 days later) » 

6:05 AM
Hey folks, just wanted to know whether this edit is apropriate?

http://workplace.stackexchange.com/review/suggested-edits/37137
 
 
3 hours later…
8:50 AM
@Lilienthal Thanks a lot !!! It worked! They replied me to come on the original date. I don't know how to thank you for your nice answer. — Crazy Ninja 2 hours ago
Feel-good Monday. :)
 
 
12 hours later…
8:43 PM
@AaronHall just upvoted another of your answers... :P
 
9:12 PM
@enderland thx, just improved it again, since you brought it to mind and it looked improvable.
 
@AaronHall a recent p.se question made me wonder what the difference between __str__ and __repr__ are :)
 
I aim for canonical answers.
I read "Here's how it works" and I get frustrated at how long it takes for my material to "work"
 
It might help to also add "what does repr stand for" or "why would you use this vs str?" - the definitions suggest str is "string" and "repr" is "representation" though
 
9:26 PM
I also feel frustrated at the give-away answers that got accepted in the early days of the site and earned their owners big rep since then. Maybe I don't "deserve" it as much because I haven't the tenure. I only got active in answering 2 years ago. But still.
 
yeah...
 
@AaronHall so a followup question outside the scope of that question, how does __repr__ work on more complicated objects?
it'd be a decent suggestion to make a less complicated object, I guess...
 
well in some cases, you can't just recreate a substantially identical object based on the repr with a single evalable expression.
 
Yeah, that's kind of what I figured
I am liking Python more and more the more I play with it
 
9:38 PM
I think good design should attempt it, but sometimes it's just not possible feasible.
 
yeah
can you use that to instantiate copies of objects dynamically?
I guess that concept makes no sense in Python
 
I think a friend misused __repr__ to use Python objects to create Javascript - he should have used __str__ instead
Yeah, if it meets the eval(repr(obj)) == obj test, that makes an equivalent copy.
but it would be better to do that without eval and repr, I think.
 
well that's less important without strict typing
 
It's probably tricky to get the name right, I should look into that facet of the answer and improve that.
 
It seems python does a lot of things differently than strictly typed languages, but I seem to enjoy it all better every time I learn about them
 
9:47 PM
Yeah. I really like it. Seems to have used the best of a lot of ideas and keeps trying to do that.
You know every module is it's own global namespace, and there is no true global namespace?
 
@AaronHall what's an example of that?
like if you define
foo = 3
in foo1.py and foo2.py ?
you could do from foo1/2 import foo I think
 
you'd have to do it in both, or import the name from one into the other
 
so no real namespaces then?
can you ever specify foo1.foo (referring to a method/object defined in foo1)?
 
and definitions that use globals point to the module, so when the global changes, it changes for the functions
however, locals are lexically scoped, so they're locked in closure attributes of inner functions.
 
@AaronHall so does python have any concept of a public class variable then? probably not?
sorry, some of these I could and perhaps should just google myself. lol :P
 
9:52 PM
all classes and variables are public. Justification cites the consenting adults principle.
You indicate public versus hands-off by prefixing a single underscore to the front of a name
 
@AaronHall ooooh. that makes a lot of python make more sense
so you really should not be doing something like
foo._my_func
even though you can technically do that
 
yep, in general, don't use private api. It's there if you need to, but you're the programmer and there's nobody going to stop you from shooting yourself in the foot
Public (no prefix underscore) should not change, private ... well, test your code well before you release new stuff to production.
 
speaking of python, have you ever played with selenium?
 
Sometimes you're expected to use the special names e.g. from my answer which cites the standard library: self.__class__.__name__ but not always. you could do the same with type(self).__name__ and there's a lot more with the builtin inspect library (but no getname, if I recall...)
I've helped other people who were using selenium, but their problems were usually that they didn't know Python.
Or how to program, really.
There's about 30 keywords (depending on your version) in Python.
 
@AaronHall awww. so you probably can't answer my python/dart/selenium SO question which is going for tumbleweed badge ;)
 
10:02 PM
:) sorry, probably not
 
@AaronHall that seems small to me, I'd be curious how many there are in many other languagse
 
>>> import keyword
>>> len(keyword.kwlist)
31
 
lol
 
>>> import __builtin__, string
>>> len([i for i in dir(__builtin__) if any(i.startswith(c) for c in string.lowercase)])
84
84 builtin functions/names/objects
80 ish
 
for some reason being able to so easily get that sort of information is super awesome to me, lol
 
10:06 PM
You should know what they are even if what you know is you shouldn't use them.
And know what generator expressions and list comprehensions are, and generators, and decorators, and slice notation, and I think you'll be able to say you know the language.
 
definitely not there yet ;)
 
And popular standard lib modules are: os, sys, itertools, functools, collections etc...
Seems like I'm always learning about a new one.
atexit is cool - you can register callables to be called when the program exits
I think there's a similar function in C?
Use subprocess to kick off new processes. Use multiprocessing to get separate processes that work like threads. Use threading to do real os threading, but you'll only use one processor at a time, thanks to the GIL.
Some foreign functions (compiled binary code called by Python) releases the GIL, but I don't have any experience with that stuff.
some of the keywords do double (quadruple) duty, so you want to know if which contexts they do what.
from can be used in importing and subroutine delegation (Python 3) and raising exceptions
else applies to 1) final clause in if elif else, 2) "nobreak" in for or while loop, 3) exception handling (no exception) 4) ternary condition
I like to point experienced people at the grammar file: docs.python.org/3/reference/grammar.html
 
11:09 PM
@enderland well that was fun, if OT for WC, but I don't think all the other room members will mind. Good night!
 
@AaronHall ther'es a topic here?
sorry, was away
 

« first day (1321 days earlier)      last day (3081 days later) »