Register a SA Forums Account here!
JOINING THE SA FORUMS WILL REMOVE THIS BIG AD, THE ANNOYING UNDERLINED ADS, AND STUPID INTERSTITIAL ADS!!!

You can: log in, read the tech support FAQ, or request your lost password. This dumb message (and those ads) will appear on every screen until you register! Get rid of this crap by registering your own SA Forums Account and joining roughly 150,000 Goons, for the one-time price of $9.95! We charge money because it costs us money per month for bills, and since we don't believe in showing ads to our users, we try to make the money back through forum registrations.
 
  • Post
  • Reply
QuarkJets
Sep 8, 2008

duck monster posted:

Oh and fun fact. Eve Online's wire format for its Machonet was pretty much just pickled objects. Thats where all those python injection hacks came from. It blew my mind we where messing with that poo poo for *years* before they caught on (I think I can mention this now. I havent played Eve in 5-6 years)

Tell me more about these antics

Adbot
ADBOT LOVES YOU

a dingus
Mar 22, 2008

Rhetorical questions only
Fun Shoe
Going to have to 2nd that request for Eve stories. Was it something goons were doing?

And I can't learn from videos alone, but I think they're good supplements for well written articles. I am a newbie but find tutorials or written lessons with "challenges" that make you implement small portions on your own the best for learning.

That said I snagged the humble bundle and can't wait to dig into some of the books.

shrike82
Jun 11, 2005

QuarkJets posted:

Tell me more about these antics

:same:

Wallet
Jun 19, 2006

shrike82 posted:

As an aside, do you guys learn mainly from written stuff (books, articles etc.)?
I was just musing with some colleagues that younger developers tend to be more comfortable with watching videos to learn about technical stuff. I've seen some of the stuff they watch are deep dives and not just 101 stuff. The flip-side is they don't touch (O'Reilly or whatever) books at all - sticking to online stuff.

I find the push towards all kinds of reference information being transformed into video content completely insufferable. Not only do people talk way, way slower than you can read, it also makes it impossible to skim for the bit of information you actually want. For other kinds of content I prefer video—I'd rather watch conference talks than read them (there have been some awesome ones posted in this thread)—but if I want technical information video can gently caress right off. As far as actual books, I find them much more useful for learning about theory/architecture/etc rather than highly specific detail simply because of how quickly that stuff goes out of date.

To be fair, I don't think I've ever actually followed an online tutorial all the way through in my life no matter what form it was provided in.

Wallet fucked around with this message at 13:33 on May 3, 2019

larper
Apr 9, 2019
Most video info about programming related things is utterly miserable, but it can be useful to pick up the more complex projects out there like Django

a dingus
Mar 22, 2008

Rhetorical questions only
Fun Shoe
Do any python message board exist where people post threads with their own tutorials? Or have these all moved in to blogs or lovely website? I miss that about the old web... the discussions around the tutorials always had good info.

Thermopyle
Jul 1, 2003

...the stupid are cocksure while the intelligent are full of doubt. —Bertrand Russell

Videos are bad and good.

Where I find them good is kind of like an entrance into a subject area I'm not familiar with.

Like...3blue1brown's videos. They can help me get an overview of a subject. Then I can drill down into some more specific websites of some sort. Then, if I really want to understand a subject I'll crack open some textbooks.

That example is more applicable to math rather than learning, say, Tensorflow or whatever specific technology, but I still find the same general idea works for me.

But, the idea of learning, say, Django, from videos makes me want to cry a little bit.

edit: Oh I wanted to say that 3blue1brown makes all their videos with python.

Thermopyle fucked around with this message at 17:06 on May 3, 2019

Tayter Swift
Nov 18, 2002

Pillbug
Oh boy, anecdotes!

I taught myself Python basics in maybe 2011 with some Euler Project exercises. Started using it for work in 2013 with some data science-y tasks because the alternatives were Matlab and SAS and neither appealed to me. My 'IDE' has always been SublimeText 2 and its interpereter, so I never bothered with things outside the standard library. I wrote up a class that in hindsight feels like a stripped-down pandas because I didn't know any better.

Last fall work got some of us a subscription to DataCamp and frankly it's been great. I'm more or less okay with learning from video and they include lots of exercises. Started using Jupyter, pandas and other extensions in the past month and I'm excited to transform a lot of my work products with it all.

larper
Apr 9, 2019

Thermopyle posted:

But, the idea of learning, say, Django, from videos makes me want to cry a little bit.

Django is actually the first programming thing I have found myself watching videos on. My background is in the arts and I don't have a lot of experience as a programmer. Watching someone tab through all the moving parts while explaining the relationship between them was far more useful than the textual documentation. I think if I had some actual hard study of computer science my threshold of when that applies would be higher as it seems to be in your case.

Likewise, I want to cry when I see videos about how to compose your photographs

Dominoes
Sep 20, 2007

Thermopyle posted:

Like...3blue1brown's videos. They can help me get an overview of a subject. Then I can drill down into some more specific websites of some sort. Then, if I really want to understand a subject I'll crack open some textbooks.
edit: Oh I wanted to say that 3blue1brown makes all their videos with python.
My fav youtube channel.

Videos for learning programming tend to be about as useful as Medium articles. Too much chaff.

I'm with you on your comparison, and when programming videos can be useful. If the programming vid is mainly a guy typing code and talking over it, which as far as I've seen, many are, skip it. 3B1Br vids work so well because Grant teachs high-level concepts in a way that works well with our visual intuition. Much like Feynman's lectures, he has a deep, intuitive understanding of the subject: You can take formal classes in Lin algebra, or physics, come out with a decent understanding, then watch a 3B1Br vid (or skim the Feynman lecture) on the topic, and come away with a new understanding absent from the traditional material.

Dominoes fucked around with this message at 22:45 on May 3, 2019

QuarkJets
Sep 8, 2008

Coding videos are the worst, it's all downsides relative to websites or even a physical book

Thermopyle
Jul 1, 2003

...the stupid are cocksure while the intelligent are full of doubt. —Bertrand Russell

I've advocated for pipenv in this thread in the past (though I've said I really don't care if its poetry or pipenv or whatever that wins out in this quest for better packaging...as long as we get to a standard of some sort), but I think I'm to the point where I'm going to withdraw my support for pipenv.

My main problem with it is that the issue tracker can be a cesspool when Kenneth Reitz, the founder of the project, gets involved and that the project just seems to lack focus. Both of these can be traced back to Reitz.

On top of that it's so loving slow!

So, those are not exactly new issues, but now there's this blog post by Nathaniel Smith (the guy behind Trio) talking about how bad Reitz has been and I'm just to the point where I'm not going to continue using pipenv since there's a good alternative out there.

Unfortunately, I do not know of a good alternative to Requests, but luckily Reitz is hardly involved in Requests anymore.


theblogpost posted:

He chose a fundraiser structure that avoids standard accountability mechanisms he was familiar with. He never had any plan or capability to deliver what he promised. And when I offered a way for him to do it anyway, he gave me some bafflegab about how expensive it is to write docs. Effectively, his public promises about how he would use the Requests 3 money were lies from start to finish, and he hasn't shown any remorse or even understanding that this is a problem.

KICK BAMA KICK
Mar 2, 2009

Well-worn question I'm sure but hard to Google: is there a style consensus on the cases of:
Python code:
foo = bar if bar else baz
vs
Python code:
foo = bar or baz
and the similar but I can imagine a different answer:
Python code:
foo = search_cache(bar) or expensive_calculation(bar)

NinpoEspiritoSanto
Oct 22, 2013




Thermopyle posted:

I've advocated for pipenv in this thread in the past (though I've said I really don't care if its poetry or pipenv or whatever that wins out in this quest for better packaging...as long as we get to a standard of some sort), but I think I'm to the point where I'm going to withdraw my support for pipenv.

My main problem with it is that the issue tracker can be a cesspool when Kenneth Reitz, the founder of the project, gets involved and that the project just seems to lack focus. Both of these can be traced back to Reitz.

On top of that it's so loving slow!

So, those are not exactly new issues, but now there's this blog post by Nathaniel Smith (the guy behind Trio) talking about how bad Reitz has been and I'm just to the point where I'm not going to continue using pipenv since there's a good alternative out there.

Unfortunately, I do not know of a good alternative to Requests, but luckily Reitz is hardly involved in Requests anymore.

Yes, pipenv is terrible, although Reitz being terrible is sad news. Chris Warrick did a good critique of pipenv on his blog. https://chriswarrick.com/blog/2018/07/17/pipenv-promises-a-lot-delivers-very-little/

I still use setuptools, though long for the python distribution issues to just gently caress off already before I stop being lazy and learn something else, because that aside I do really like the language and community.

QuarkJets
Sep 8, 2008

KICK BAMA KICK posted:

Well-worn question I'm sure but hard to Google: is there a style consensus on the cases of:
Python code:
foo = bar if bar else baz
vs
Python code:
foo = bar or baz

The second one is better

Data Graham
Dec 28, 2009

📈📊🍪😋



QuarkJets posted:

The second one is better

But you gotta do the first if your condition is anything other than "bar is truthy".

Thermopyle
Jul 1, 2003

...the stupid are cocksure while the intelligent are full of doubt. —Bertrand Russell

Bundy posted:

Yes, pipenv is terrible, although Reitz being terrible is sad news. Chris Warrick did a good critique of pipenv on his blog. https://chriswarrick.com/blog/2018/07/17/pipenv-promises-a-lot-delivers-very-little/

I still use setuptools, though long for the python distribution issues to just gently caress off already before I stop being lazy and learn something else, because that aside I do really like the language and community.

Chris has a few errors in that blog post, but anyway thats old news that doesn't need rehashed.

The thing with pipenv is that it's not terrible, it's just not as good as the alternatives. Or, rather, they're all terrible in their own ways, pipenv is just somewhat more terrible.

On the other hand, it has/had a good chance of becoming The One True Thingamajig. When it comes to packaging, there being The One True Thingamajig is way more important than whether we end up with a tool that has a rating of 4/10 Terribleness or a tool that is a 6/10 Terribleness. It's much easier to fix a tool than to fix fragmentation.

In other words the world where we have fragmentation on packaging tools is worse than the world where pipenv is the packaging tool.

However, for me, the advantages that pipenv has in its head start at becoming The One True Thingamajig have just become outweighed by Reitz and how he handles the project.

QuarkJets
Sep 8, 2008

Data Graham posted:

But you gotta do the first if your condition is anything other than "bar is truthy".

for sure, in fact only do the second one if bar and baz are boolean variables, I didn't state that assumption

larper
Apr 9, 2019

Data Graham posted:

But you gotta do the first if your condition is anything other than "bar is truthy".

So you give it a function that returns True or False, like this?

something =
bar if cheap_true_false() else expensive_function_that_returns_something()

QuarkJets
Sep 8, 2008

The Xkdc Larper posted:

So you give it a function that returns True or False, like this?

something =
bar if cheap_true_false() else expensive_function_that_returns_something()

Yeah that's cool and good

Master_Odin
Apr 15, 2010

My spear never misses its mark...

ladies

Thermopyle posted:

Chris has a few errors in that blog post, but anyway thats old news that doesn't need rehashed.

The thing with pipenv is that it's not terrible, it's just not as good as the alternatives. Or, rather, they're all terrible in their own ways, pipenv is just somewhat more terrible.

On the other hand, it has/had a good chance of becoming The One True Thingamajig. When it comes to packaging, there being The One True Thingamajig is way more important than whether we end up with a tool that has a rating of 4/10 Terribleness or a tool that is a 6/10 Terribleness. It's much easier to fix a tool than to fix fragmentation.

In other words the world where we have fragmentation on packaging tools is worse than the world where pipenv is the packaging tool.

However, for me, the advantages that pipenv has in its head start at becoming The One True Thingamajig have just become outweighed by Reitz and how he handles the project.
Yeah, the PSF really needs to stop letting the PyPA be its own thing that takes a laissez-faire approach to "the one true thing" and just mandate everyone use tool foo, that uses format bar (like pyproject.toml which has an actual accepted PEP), and that we stop dealing with the absolute nightmare that is python packaging and dependency resolution. Hopefully with PEP-582 coming in python 3.8, we might finally get a point where the tooling isn't an absolute mess for people, especially when coming from other languages.

KICK BAMA KICK
Mar 2, 2009

Data Graham posted:

But you gotta do the first if your condition is anything other than "bar is truthy".

QuarkJets posted:

for sure, in fact only do the second one if bar and baz are boolean variables, I didn't state that assumption

The Xkdc Larper posted:

So you give it a function that returns True or False, like this?

something =
bar if cheap_true_false() else expensive_function_that_returns_something()
Yeah sorry I was talking about, in my first example, a case where bar and (I guess it doesn't matter for purposes of the conditional but also) baz are non-boolean but truthy in a way that makes sense -- where if bar is an empty string or 0 or None you want the value of baz instead. The second example is just does your answer change if we're inlining function calls instead of evaluating values that have already been calculated and given names.

QuarkJets
Sep 8, 2008

I don't like relying on the truthiness of something but that may just be me

larper
Apr 9, 2019

QuarkJets posted:

I don't like relying on the truthiness of something but that may just be me

If it's a method that is explicitly written to only return bools, or a lambda defined right before the variable assignment, it seems OK

KICK BAMA KICK
Mar 2, 2009

I either miscommunicated the question or am misunderstanding y'all cause I didn't think relying on truthiness was at issue, I was just asking about style/readability between functionally equivalent uses of the explicit ternary construction vs a shorter or.

Boris Galerkin
Dec 17, 2011

I don't understand why I can't harass people online. Seriously, somebody please explain why I shouldn't be allowed to stalk others on social media!

Thermopyle posted:

I've advocated for pipenv in this thread in the past (though I've said I really don't care if its poetry or pipenv or whatever that wins out in this quest for better packaging...as long as we get to a standard of some sort), but I think I'm to the point where I'm going to withdraw my support for pipenv.

My main problem with it is that the issue tracker can be a cesspool when Kenneth Reitz, the founder of the project, gets involved and that the project just seems to lack focus. Both of these can be traced back to Reitz.

On top of that it's so loving slow!

So, those are not exactly new issues, but now there's this blog post by Nathaniel Smith (the guy behind Trio) talking about how bad Reitz has been and I'm just to the point where I'm not going to continue using pipenv since there's a good alternative out there.

Unfortunately, I do not know of a good alternative to Requests, but luckily Reitz is hardly involved in Requests anymore.

I saw this posted on r/python this weekend and while I’m sure some (or most, I don’t know, don’t care) of the criticism is warranted, Jesus Christ there is just so much vitriol and hate directed at him that 100% isn’t warranted at all. Beyond that, accusing someone of embezzling $30k is a pretty serious charge (without proof that I saw, and it seems like without a chance for comments from the accused before going public) and has the potential to ruin your career even if it turned out to be false. I have no idea what the right way to do this would have been, but everything about the way this was done was definitely the wrong way to go about it.

shrike82
Jun 11, 2005

The guy who "outed" him was fairly thoughtful in explaining why a public blog post was his last step in a bunch of things he had tried to resolve the situation.

In any case, Reitz scrubbing all details about the fundraiser from his website seems pretty dirty.

QuarkJets
Sep 8, 2008

KICK BAMA KICK posted:

I either miscommunicated the question or am misunderstanding y'all cause I didn't think relying on truthiness was at issue, I was just asking about style/readability between functionally equivalent uses of the explicit ternary construction vs a shorter or.

I think everyone understood, the answer just has conditions related to truthiness. If all of the variables are bools (and not non-bools that happen to have truthiness), then the second style is nicer. Otherwise, use the first style, and if your input variables aren't already bools then modify the first style to use actual condition checking instead of truthiness checking

QuarkJets fucked around with this message at 08:46 on May 6, 2019

NinpoEspiritoSanto
Oct 22, 2013




Boris Galerkin posted:

I saw this posted on r/python this weekend and while I’m sure some (or most, I don’t know, don’t care) of the criticism is warranted, Jesus Christ there is just so much vitriol and hate directed at him that 100% isn’t warranted at all. Beyond that, accusing someone of embezzling $30k is a pretty serious charge (without proof that I saw, and it seems like without a chance for comments from the accused before going public) and has the potential to ruin your career even if it turned out to be false. I have no idea what the right way to do this would have been, but everything about the way this was done was definitely the wrong way to go about it.

This seems a weird take if you actually read NJS's blog post.

I can at least vouch for NJS from the point of view of interactions when working with or on Trio. In hindsight, some odd evasive non responses regarding http and Trio now make a bit more sense in this context.

Dominoes
Sep 20, 2007

Thermopyle posted:

On the other hand, [Pipenv] has/had a good chance of becoming The One True Thingamajig.
If they ever fix the lock slowness.

Chakan
Mar 30, 2011
I (re)started learning the basics of python a few months ago, just spending a few hours each week on it. I'm at the point where I'd like to learn the basics of GUIs, and so I'm thinking of going through "Foundations of PyGTK Development: GUI Creation with Python, Second Edition" which is a book I've got through work. I'm guessing PyGTK is pretty much the standard library for GUI stuff? Are there other resources I should look into? other libraries?

NinpoEspiritoSanto
Oct 22, 2013




PyQT5 and Kivy are popular too.

mbt
Aug 13, 2012

The standard library for ui is tkinter, which is great if you dont really care for ui stuff and dont want to use anything else. Qt5 is the serious ui program people use. Wxpython isnt as common anymore but is Another Ui Program you'll see sometimes

Thermopyle
Jul 1, 2003

...the stupid are cocksure while the intelligent are full of doubt. —Bertrand Russell

Boris Galerkin posted:

I saw this posted on r/python this weekend and while I’m sure some (or most, I don’t know, don’t care) of the criticism is warranted, Jesus Christ there is just so much vitriol and hate directed at him that 100% isn’t warranted at all. Beyond that, accusing someone of embezzling $30k is a pretty serious charge (without proof that I saw, and it seems like without a chance for comments from the accused before going public) and has the potential to ruin your career even if it turned out to be false. I have no idea what the right way to do this would have been, but everything about the way this was done was definitely the wrong way to go about it.

If you're an alien just arriving from another planet this might be a good take, but we have a long track record of Reitz treating people badly and being poor at managing his projects. Hell, they took away his commit access to Requests, his own project because he was so bad at the job of being a project leader.

Also, Reitz made a blog post (which he deleted) where he basically admits that he took all of that $30 grand for himself. Supposedly it all went towards paying himself to work on Requests III...of which there is no code available to look at. And it will all be available in "one year"...the programmers equivalent to "someday or probably never". This is not how OSS funding or PSF funding is done, and he knows that.

But yes, vitriol and hate directed towards him is just dumb, but also to be expected when you treat people badly.

QuarkJets
Sep 8, 2008

Chakan posted:

I (re)started learning the basics of python a few months ago, just spending a few hours each week on it. I'm at the point where I'd like to learn the basics of GUIs, and so I'm thinking of going through "Foundations of PyGTK Development: GUI Creation with Python, Second Edition" which is a book I've got through work. I'm guessing PyGTK is pretty much the standard library for GUI stuff? Are there other resources I should look into? other libraries?

I don't think PyGTK is standard but the lessons learned are probably going to translate to other types of GUI APIs.

Personally I'd suggest going straight to Qt5

Furism
Feb 21, 2006

Live long and headbang
Python really is driving me nuts. Half of the time I don't know what it wants, and when I think I figured it out, I don't know how to communicate it to it.

I'm building a package. I've installed it locally (pip install -e). It's setup like this:

code:
setup.py
\cyberfloodClient.py
\__init__.py
\models\
\models\__init__py
\models\Profile.py
I want to be able to say "from cyberfloodClient.Models import Profile

In my setup I used the findPackages() (because this needs to be a package right, not a module?), on the top-level init I used "from .cyberfloodClient import CfClient" and in the one under "models" i used "from cyberfloodClient.Models import Profile"

code:
from cyberfloodClient.Models import Profile
...
ModuleNotFoundError: No module named 'cyberfloodClient.Models'
E: Riiiight, in the __init__.py you have to import from the relative path it seems? Ie: "from .Profile import *"
But now when I use this from another script, the interpreter can't find any of these classes. What the hell am I doing wrong?

Furism fucked around with this message at 12:53 on May 7, 2019

faddypaddy
Sep 3, 2011


End of the fiscal year, bitch.
Everyone gets a title or we lose it next year


SKILCRAFT KREW Reppin' Quality Blind Made Prod
It's hard to tell without seeing what's actually in the files, but from what you mentioned shouldn't it be from cyberfloodClient.models import x with a lower case m. The imports are in fact case sensitive. For the imports to be seen from any program you have to add them to Pythons library folder so the interpreter knows where to look for them as well. You can add other directories to the interpreters search path as well. Hope that makes sense.

faddypaddy fucked around with this message at 13:05 on May 7, 2019

Boris Galerkin
Dec 17, 2011

I don't understand why I can't harass people online. Seriously, somebody please explain why I shouldn't be allowed to stalk others on social media!
This is a stylistic choice but I'm curious what others think. Do you place your comments describing an if/else block inside the block, or above it?

code:
# This would be a long comment describing the first condition.
if foo is bar:
    ...

# This would be a long comment describing the next condition.
elif foo is baz:
    ...
vs

code:
if foo is bar:
    # This would be a long comment describing the first condition.
    ...

elif foo is baz:
    # This would be a long comment describing the next condition.
    ...
.

quote:

E: Riiiight, in the __init__.py you have to import from the relative path it seems? Ie: "from .Profile import *"
But now when I use this from another script, the interpreter can't find any of these classes. What the hell am I doing wrong?

Have you read through this tutorial? Python packaging is incredibly confusing to be fair so you're not doing anything wrong.

Thermopyle
Jul 1, 2003

...the stupid are cocksure while the intelligent are full of doubt. —Bertrand Russell

I prefer the comment before the if block.

However, this does not make any sense and I do not know why I prefer it.

I mean, you don't put a docstring before the function or class definition starts.

This bothers me because every time I write such a comment, it's weighing on me to choose between what I prefer and what seems technically correct.

Adbot
ADBOT LOVES YOU

fourwood
Sep 9, 2001

Damn I'll bring them to their knees.
I think I prefer a comment before the if but then after the else.... I’m a monster.

  • 1
  • 2
  • 3
  • 4
  • 5
  • Post
  • Reply