« first day (2817 days earlier)      last day (2134 days later) » 
00:00 - 18:0018:00 - 00:00

6:00 PM
heh, yeah, if you get suspended you won't be able to run for mod for a year or two
whatever it is, I'm sure it's going to be huge
 
New to this room. Cabbage to everyone!
 
cabbage, and welcome :)
 
A beginner question: Is there a way to save/tag this chat room, so that I can access it easily from my SO profile?
 
What do you mean by access it easily from your SO profile? Meaning you want to link this url from your SO profile?
 
There's a "toggle as favorite room" button up in the top right corner, but I don't know if that makes it easier to get here from one's profile
 
6:09 PM
why not just bookmark this page to your browser.... or you know just leave this tab open forever :D
 
that's it
Melon!
I'm starting to dig the salad language!
 
Welp, I guess I'll have to take more frequent breaks from SO now, in order to prevent the snark from leaking out
 
DSM
That's probably healthy for all of us, to be honest.
 
Hmm, what shell/IDE is the OP of Unable to create a tensor using torch.Tensor using? I have a suspicion that it's performing some sly introspection on the object which is somehow messing up its state
I'm thinking of asking them to run their code from a no-frills command line, but I don't want to get the reply "I am using a no-frills command line, you fool, this is what no-frills command lines look like in Linux (version Obsequious Octopus)"
Meh I'll ask anyway
 
6:22 PM
that IDE looks like Spyder
 
DSM
ipythony LHS.
Oh, wait, it even shows the IPython formatter in the traceback.
 
Yes, IPython sorry
 
DSM
pytorch 0.4.0 is a 530 MB download. :-/
 
How badly do we want to help this person :>
project: define a class that causes a crash if you instantiate it in IPython, but not in regular Python.
Bonus underhanded points if it looks like you're not doing it intentionally
 
if IS_IPYTHON:
   crash() # oops
 
DSM
6:28 PM
@Kevin: too easy, just raise in _ipython_display_.
 
That's a thing? :-I
 
DSM
Well, I guess that doesn't crash on instantiation, only on showing in the console -- I was thinking too much about the OP's example.
 
Well if IPython displays the object after you instantiate it and before the next input prompt shows up, I'll allow it
 
DSM
You can be the judge.
 
I'm watching the last okeanos dive from Sunday, and there's a seastar called pythonaster <3
 
6:33 PM
Ok, you win the general category. The underhanded category is still up for grabs.
Pythonaster, 2nd evolution of the Pythonasty - Pythonaster - Pythonastest Pokemon lineage
 
DSM
Awww, cute.
 
Poison/Dark type, good battle stats but surprisingly popular as a housepet
 
6:49 PM
boom doesn't boom for me
 
DSM
I knew something was off about you.
 
I hear they have pills for that these days -- [a giant hook extends from stage left and yanks me out of sight]
 
I tested my ipythons for 3.5, 3.6 and 3.7, and none boom, so either I can't copy-paste, or I can't run a single line of code, or shenanigans
 
DSM
Depends on which console you're using, terminal or QT or whatever.
 
It amuses me that, during a demonstration of IPython's potential unreliability, we can't reliably show how unreliable it is. I think that proves it's unreliable, and try not to worry about the paradox.
 
6:56 PM
But I still love IPython Jupyter. Gotta go, so much to learn here! Rhubarb everyone!
 
DSM
I can't even work with the standard repl for long anymore..
 
wim
wow, how that evaded the hammer
This looks exponential....
$ python2.7 -c "import sys; print(sys.getrefcount(None))"
1020
$ python3.6 -c "import sys; print(sys.getrefcount(None))"
2050
$ python3.7 -c "import sys; print(sys.getrefcount(None))"
4334
much ado about nothing :)
 
7:17 PM
@DSM it helped me a lot when I realized that reverse search worked in the repl
but yeah, it's annoying how bad multiline stuff are in the standard repl
I rarely use any other fancy features of ipython, except for %timeit
_, __, ___ : previous, next previous, next next previous output
WHAT
so many features I don't know of :D
 
wim
my favourite is the bang escapes
e.g. x = !ls
x is now a list of the filenames in the cwd
 
MATLAB has that so I'm aware of that one
well, it's not assignable in MATLAB, so I wouldn't have thought to do that actually
 
wim
stuff like first, *rest = !ls works too.
splitting on newlines. of course, the command can be any bash-fu.
 
well once you can do x = !ls it's only natural to be able to unpack
also cue "don't parse ls"
 
wim
the assignment is the good stuff
if matlab don't do that, it's more like mehtlab
garbage = !head /dev/urandom
 
7:34 PM
It only prints the output to stdout, but MATLAB has a very different type system, none of the useful stuff like lists or dicts. Everything* is a numeric array
you can do a proper system() call if you want the return value as a char array
 
 
1 hour later…
8:46 PM
Chat's quiet I wonder like my office everyone is watching the Fifa game.
 
you mean the ludicrous display?
 
yes and I have dinner riding on this game. I need England to win
 
9:12 PM
@raymondh I am very upset. This feature looks violating design principles of Python (simplicity, explicitness, readability for casual users), it makes Python syntax more complex, but doesn't solve any problem.
Interesting
 
only to be expected
inb4 subtweeting tweets
 
Very polarizing feature, even among core devs
 
at least there are grains of sanity left ;)
if it were unanimously embraced by the core devs we wouldn't have to hate it this much
 
afternoon cabbage
 
9:54 PM
@vaultah The real problem are fellow devs who do things slightly different than what you yourself would do.
 
I don't understand what you're saying
 
I'm trying to make a point for assignment expressions
once again =/
 
then do better
 
my typing speed is getting in the way
 
there's no rush
Extrapolating from what I think you're trying to say: the problem is not fellow devs who do things slightly different; the problem is a language feature that offers little value at the cost of making it very easy to write unreadable code. Python's been notorious for making it easy to write readable code, especially when following best practices.
once it's on the devs to not use a feature to write unreadable code there's a problem
one could say that list comps can be similarly abused to force one-liners, but there's a huge benefit from having list comps which outweighs this risk
anyway, I'll let you elaborate
 
9:58 PM
while that's true as well, and a valid counterpoint to having this new thing, it acutally wasn't what i am getting at
In short, people do weird things in python all the time, like short circuiting functions with exceptions simply because handling optional return statements is cumbersome and looks ugly
 
let me know when you're finished
 
other languages offer things like the elvis operator, which gives a certain credibility to their claim that it should be doable/is a good idea
scoped assignments allows writing 'only use the output of that function in case this condition is met' without temp vars or calling the function multiple times
which gives me leverage to banish things like short circuiting from codereviews
and here is where I lead back to my initial statement of 'assignment expressions solve the problem of other devs than me existing'
did i manage to make a point?
 
wim
from the PEP:
 
No, I don't think I understand any better. We have a ternary if, why is that different than "?:"? And why are people writing bad code relevant?
 
wim
> Second, it allows a compact way of updating mutable state from a comprehension
I propose we call these "mutant list comprehensions"
 
10:11 PM
And are you saying you have a single use case for it with that "return conditionally" thing? Because I'm not even sure what you mean by that. Could you show me what you mean, please?
@wim list incomprehensions
 
wim
nay, that's already been taken by the nested list comprehensions
 
too bad
 
@AndrasDeak ternary requires calling the function twice
 
what function?
 
10:12 PM
wouldn't cond()?fun1():fun2() lead to 3 function calls anyway?
 
the functions whose value we store with the assignment expression
 
which part would be redundant in fun1() if cond() else fun2()?
this is why I'm asking for a specific example
 
wim
^ that only calls two functions
 
yeah, I know
 
>>> def foo(): return 'foo'
>>> tmp + 'bar' if (tmp := foo()) == 'foo' else tmp
foobar
foo called only once
 
10:15 PM
I meant working code :P
 
D=
 
wim
I'm scared to think of the atrocities that ajax4321 will spew out using this feature
 
my weakness
 
tmp  = foo()
tmp + 'bar' if tmp == 'foo' else tmp
is that where you want to spare the temp variable with this new feature?
 
bingo
.. it really isn't much else
 
wim
10:17 PM
I prefer the two-line version
 
Now weigh the utility of that very specific single use case to all the abusive use cases :/
 
i would if i could scope it in any other way
 
but thanks, at least I understand your use case
if this feature gets widespread use I wonder how long it'll take for python to become the new infamously write-only language
 
Ahh, it wont be that bad =)
 
I especially fear for the tag on SO considering the usual quality of answerers
 
10:20 PM
It probably wont be used much
 
heck, someone was already referring to this syntax a month ago or so
 
that answer earned me the 'tenacious' badge
 
nah, I'd remember that joker
 
once it got back down to 0
alright, little 572 will have to survive on its own for a while, I need to sleep
rbrb
 
rbrb
 
10:28 PM
quick question that I don't think warrents a posted question. Why can python classes, initialized as a super class, call functions from there children? Also, is it bad practice to do so?
 
"initialized as a super class"?
 
btw I'm using the superClass.__init__(self) way of forming inheritance
So I'm guessing that it has to do with self's being combined. So I guess I just want to know if it is an antipattern
 
I don't really understand what you're asking. You only ever have an instance of your child class, I believe. Do you have an example of what you have in mind?
 
@AndrasDeak Yeah, in python's form of inheritance it is initialized and not declared as part of the class definition like in java extends, correct?
yessir
 
I have no idea about how java works and only a limited understanding of how python works, hence the request for a specific example :)
 
10:32 PM
class interface:
    def __init__(self):
        print("initialized interfacing component \n ALWAYS END QUESTIONS WITH A QUESTION MARK!!")
        print(self)
        self.test()
        self.inputLoop()
        pass
 
Parent classes can call methods of child classes in every programming language. It's just that in some languages you have to write a corresponding abstract method in the parent class, but in python you don't
 
class core(interface):

    def __init__(self):
        print("initialized core processing")
        self.inter = interface.__init__(self)
        pass
    def test(self):
        print("test success")
that... from what I know about inheritance, generally doesn't work in other languages
 
self.inter = interface.__init__(self) # <- this is None
 
yeah
 
You typically don't store the return value of __init__ since that's None, you just call the parent's __init__
 
10:34 PM
doesn't matter. Javascript habit, but doesn't matter for my question. I was actually like "wait, that doesn't make sense" before I found this weird thing lik 10 minutes ago
 
and no need to put pass at the end of a function that doesn't return anything (i.e. the default None)
 
class core(interface):

    def __init__(self):
        print("initialized core processing")
        interface.__init__(self)
        pass
    def test(self):
        print("test success")
 
So...which part do you find surprising exactly?
 
@AndrasDeak ok, but makes it easier to read for me latter
the fact that it prints "test success"
I know what it is doing, I just feel like it is a no no to design it that way. Am I right?
 
@DavidKamer Yes, because self is the instance of the child class, that's being passed around.
 
10:37 PM
Yep, so it's really just an icky goo of the self ref between the two classes, correct?
but is it bad practice to have me super class call functions in my subclass?
 
@DavidKamer If I understand correctly then no, in python self is just a common name for the first argument of instance methods, which always refers to the class instance
 
Calling child methods is perfectly fine if your parent class is properly documented to be an abstract class that requires a test method to work
 
@AndrasDeak I mean, that class will be garbo once I call it on it's own though, correct?
 
@DavidKamer I have no idea what you're saying there
but Aran knows much more about inheritance than me so I'll let him answer your actual design question
 
@Aran-Fey Does it need to be definitively an abstract class like in C++ or Java for the design pattern to be acceptable (in common practice)?
 
10:39 PM
@DavidKamer if you're saying that this makes your parent class abstract in a way since instances of the parent class don't have an instance method called test then yes.
 
I'm not an authority on what's acceptable and what isn't. I'm sure wim can offer a strong opinion on the topic though :)
 
@AndrasDeak pretty much. It just feels and seems wrong because now the class doesn't even really need to be it's own class considering it isn't reusable unless I have multiple implementations of the subclass planned. It feels like an OOP and functional nono all in one
 
import abc

class interface(abc.ABC):
    def __init__(self):
        self.test()

    @abc.abstractmethod
    def test(self):
        raise NotImplementedError

class core(interface):
    def test(self):
        print("test success")
 
@DavidKamer you could def test(self): raise NotImplementedError('Implement me please in your child class') or something to make it obvious
or what Aran did properly
 
^^^ example of an implementation as an abstract class
 
10:42 PM
@AndrasDeak gotcha. That actually makes sense. Is there a way to check what the class implementing it is?
@Aran-Fey ok, that makes sense. I probably won't go that way though because it will cause extra work in the long run (imo)
 
how so?
 
There are ways to find out which class implemented the method, but none of them are very pretty
 
The only complication is the abstractmethod decorator and the dummy test in your parent. And you get the benefit of not just seeing an AttributeError when you forget to implement it in your child class, or when you try to instantiate the abstract class.
 
@AndrasDeak extra work? Because I'll have to review a file that basically just creates a template and also reimplement each function if I want to use the class
 
1) Parse the method's `__qualname__`
2) Traverse the class's MRO until you find an implementation of the method
 
10:45 PM
@Aran-Fey the first one is one I though might work after printing self. j
 
@DavidKamer you'd have to document your class anyway if you want it to be usable
I suspect that implementing these dummy methods in your parent would be fairly self-documenting
 
@AndrasDeak good point. I'm feeling reassured though that this isn't necessarily a plebeian mistake like doing something in JavaScript like this would be considered lol. Python people are really the nicest lol
 
wim
@Aran-Fey wat? instances of parent classes can not magically call children methods
 
@wim he means instance methods
self.test() where test is only defined on the child class, to which self happens to belong
 
(you have to mark them as virtual in some languages)
 
wim
10:47 PM
well that's a method on self, and self is an instance of the child class
 
David's question is basically whether it's OK to treat a parent class as abstract with just omitting its abstract methods
 
wim
oh, right. no, don't do that.
 
@AndrasDeak I think that is correct. I still want to maintain all application logic in the "parent" class so that I can handle IO through it.
@wim I figured as much lol. I couldn't believe it even worked
 
wim
unless you name it _MyClass in which case you can go buck wild
 
@wim To denote it as abstract?
 
10:49 PM
to denote it ""private""
 
got it, forgot about that
 
"if you use it you have only yourself to blame"
but you'll want to document it anyway at least for future maintainers :P
 
you guys are freaking sweet. I reiterate that python people are the best lol.
Planned to. Thanks for all the help
 
heh, wim and I will have that printed and framed
no problem
 
Man, gotta love working with ctypes and Windows functions. The Microsoft documentation for one of parameters of this function I just looked up is literally just "TBD" (to be determined?)
 
10:54 PM
to be documented?
 
to be defined? who knows
 
to be deprecated?
 
Aha! Some info!
> An error may occur if the hMod parameter is NULL and the dwThreadId parameter is zero or specifies the identifier of a thread created by another process.
I still don't know what value to pass, but at least I know what not to pass :D
 
11:07 PM
<Gandalf>you cannot pass</Gandalf>
 
11:28 PM
So where can I find documentation of all the methods supported by the Python bytes class? Google is not helping much.
For instance, I'd like to know everything about bytes.decode().
Oh, I finally found that particular one here docs.python.org/3.1/library/… but I guess I'm still interested in knowing if there is a comprehensive list somewhere. I'm far more used to the Ruby documentation.
 
I have to agree that the documentation for the standard types is terrible. A lot of the documentation is actually in the tutorial for some reason, and a lot of it doesn't even have link anchors
 
ok, thanks
Yeah, I guess they just listed the bytes and bytearray functions together because they are all the same. For some reason I kept finding some different section of the documentation that introduced those classes but didn't actually define the method.
 
the fact that google gave you docs for 3.1 is alarming in itself
 
duckduckgo did the same :(
 
11:47 PM
I get 3.6 docs as first hit for "python bytes.decode"
 
Try "python bytes"
 
why would I try that when I'm looking for bytes.decode? :P
 
@DavidGrayson those aside, you're correct, the builtin type docs are awful
fortunately rest of the docs aren't as much :D
 
I'm sure all that functionality is self-evident to the point of triviality
 
@AndrasDeak Because you want to see if "python bytes" brings up any news stories of people being bitten by snakes, obviously
"bytes.decode" is too unambiguous, that's no fun
 
11:51 PM
Oh, bounty stealer guy finally decided to serially downvote me
 
The methods are here: docs.python.org/3/library/… - mostly,
 
and then you need to read X different documents to find out what sequence behaviours there are
 
@AndrasDeak Why, what'd you do?
 
You can blame them for posting the answer. That's some sleazy behaviour right there. — Andras Deak Jun 30 at 19:28
 
11:53 PM
just spoke my mind concerning the most appalling crime committed in our little community
multiple times :D
 
@AndrasDeak I guess your comment is something that would be disallowed under the new CoC :D
 
I'm not sure about that. I'm criticizing the action, not the yambag
 
Attempting to rotate a cloud of points, each having x,y,z, around a center point. Trying to figure out the math for this. Can anyone point me in the right direction to accomplish this.
 
@user1740058 Rodrigues' rotation formula
 
@user1914034 "the bounty was about to finish in just few hours." Really? That's why you had to change your name to get that? I like this excuse. I wasn't in the favour of suspending your account but now I think that must be done after reading this comment and the comment + down-vote you left on the other answer, it looks like you have no remorse and I hope the mods apply proper punishment here. — Programmer 9 hours ago
@AndrasDeak this one would :d
 
11:56 PM
hmm?
oh, yeah, of course :D
@user1740058 of course it depends on how you want to rotate
Rodrigues is "rotate points around a given axis with a given angle" (i.e. not a completely general rotation)
if you're rotating around the vertical axis I can tell you the rotation matrix by heart
 
rotating around center point.
 
@user1740058 OK, that's underspecified
 
Sorry.
 
in general you have 3 Euler angles that define an arbitrary rotation around the origin en.wikipedia.org/wiki/Euler_angles (probably equivalent to using pitch/roll/yaw)
so first you need to think about how your rotation is defined, then think about representing that
if you only want to say "<this> vector should go into <that> vector" (for a given vector), you can use Rodrigues'
 
00:00 - 18:0018:00 - 00:00

« first day (2817 days earlier)      last day (2134 days later) »