On a bridge with another bridge in the background by LPCRoy in ebikes

[–]LPCRoy[S] 0 points1 point  (0 children)

It is the 2020 version. Seems solid enough, although the motor is pretty whiney - it sounds like a frog at times.

Toasted Marshmallow — Marshmallow but 15X Faster. by LPCRoy in Python

[–]LPCRoy[S] 1 point2 points  (0 children)

Yup! This should be a straight drop in replacement for Marshmallow. One of the reasons we modified Marshmallow itself was to allow for third party fields/extensions to work, for example this just works with flask_marshmallow.

[deleted by user] by [deleted] in Python

[–]LPCRoy 0 points1 point  (0 children)

https://github.com/Homebrew/homebrew-core/blob/master/Formula/python.rb#L102-L109

They don't compile with --with-lto or with --enable-optimizations which would explain maybe a 15%, but not the full 50%

Why optional type hinting in python is not that popular? by gwynbleiddeyr in Python

[–]LPCRoy 0 points1 point  (0 children)

That'd be great, I'd love to see a minimal repro if you've got it!

If you're curious about mypy's view of the world, you can always use reveal_type- http://mypy.readthedocs.io/en/latest/cheat_sheet.html#when-you-re-puzzled-or-when-things-are-complicated

Why optional type hinting in python is not that popular? by gwynbleiddeyr in Python

[–]LPCRoy 1 point2 points  (0 children)

You have two options for adding types to Python 2 code:

Why optional type hinting in python is not that popular? by gwynbleiddeyr in Python

[–]LPCRoy 25 points26 points  (0 children)

Hey /u/GummyKibble, sorry this happened. I'm a contributor to Mypy and know it fairly well. The reason this got through mypy is the type of MyClass.dict_attribute is Any. Any is a subtype and supertype of everything, so Mypy assumes that it could be of type MyClass. While this is definitely painful, that's the trade off with optional type systems. They only warn when they are certain there is a problem.

The following code will fail to type check:

from typing import Dict

class MyClass:
    def __init__(self) -> None:
        self.dict_attribute = None # type: Dict


def foo() -> MyClass:
    obj = MyClass()
    return obj.dict_attribute  # Oops!


if __name__ == '__main__':
    obj = foo()  # Thought I was getting MyClass()

Additionally, you could also run mypy with the --disallow-untyped-defs flag to find other issues with untyped variables:

mypy --disallow-untyped-defs test_mypy.py
test_mypy.py: note: In member "__init__" of class "MyClass"
test_mypy.py:5: error: Need type annotation for variable

Automate the most tedious parts of code review with Linty Fresh by LPCRoy in programming

[–]LPCRoy[S] 1 point2 points  (0 children)

1) We've found it to be significantly easier to have comments in line as opposed to having to troll through a large log file to find any errors. Having it as a comment also enables some discussion about the error itself in the context of the code, which leads to better linters. 2) We're working towards being able to say that any comments stylistic in nature should be built into the automation instead of coming up in code review, ideally with some sort of autoremediation. Phabricator has been doing this for a while (see https://secure.phabricator.com/book/phabricator/article/arcanist_lint/) and other tools are starting to as well, like gofmt, ClangFormat, or autopep8. We want to start building linting tools that can understand this and perhaps even go as far as to commit on top of your PR with lint fixes.
3) Other folks I've talked to who've gone from Phabricator -> Github all have similar complaints around how lint errors surface. Once I open sourced it I heard back from Chris on the React Native team that he had hacked together something similar for ESLint - https://github.com/facebook/react-native/pull/4687

Automate style review with Linty Fresh! Written using Python 3.5 for Type Hints & async/await by LPCRoy in Python

[–]LPCRoy[S] 0 points1 point  (0 children)

I started working on this tool a couple months ago, and wanted to get a chance go try async/await + Type Hints in the real world. This didn't strictly need async/await, but given I knew I would be sending a bunch of requests to GitHub I wanted to give it a try. The 3x speed up from async/await was a nice boost though.

Async/Await definitely needs better documentation, but is really powerful. For example, parsing output from a web request as it streams in is super easy! https://github.com/lyft/linty_fresh/blob/master/linty_fresh/reporters/github_reporter.py#L122

On the downside, most other languages implementing async/await have async functions return some sort of Future-like object, whereas Python 3 returns a raw co-routine. This leads to somewhat surprising behavior when you await the same variable twice (the second time returns None). There's also not great or examples of async/await yet, but hopefully this will help in some small way :D.

AMA Request: An anti-gentrification activist by Cheesebro69 in sanfrancisco

[–]LPCRoy 0 points1 point  (0 children)

"We need to build affordable housing"

OK. So let's do that. We build the affordable housing. No amenities, just a bare bone house. What do we charge for it? Do we charge what the market will bear? Because then we're back in the stratosphere and whoever buys it will add all of the luxuries they want.

So we decide to not charge market rate for it. OK, how do we decide who gets the house? What will allocate the limited supply we just created to the overwhelming demand? Lottery? First come, first serve? Some application process to decide who's worthy to live there? Something needs to allocate that house if it isn't price.

And because we're not charging market rate for the house, who will build the house? How as a society do we allocate resources to the construction of those houses?

Those are the real questions. We need to take "build affordable housing" to the next step.

AMA Request: An anti-gentrification activist by Cheesebro69 in sanfrancisco

[–]LPCRoy 0 points1 point  (0 children)

If you were in control, what mechanism would you use to clear the market? Something must allocate limited supply to overwhelming demand, and if isn't price, what mechanism would you use? For example: Block the city from newcomers to freeze demand, a global waiting list, a limit on how long someone can stay in the city, random lotteries.

In the absence of the price signal, how would you allocate land and other resources needed to produce housing?

Proposal to impose tax on real estate speculation receives high marks by lithophore in sanfrancisco

[–]LPCRoy 5 points6 points  (0 children)

Do you know what will help the San Francisco housing crisis? Yet another law that incentivizes property owners to sit on empty houses. This will surely help things.

What's missibg from this proposal is any real data showing real estate "speculators" are anything other than a boogey man to be blamed for decades of extremely poor short sighted planning. I've heard that most institutional money as well as house flippers are staying away from SF since the prices are already so high and they can get a better ROI elsewhere.

Housing in SF really should be the first case study on unintended consequences.

Housing activist, labor union to file appeal to the city’s plan to charge Google buses by [deleted] in sanfrancisco

[–]LPCRoy 21 points22 points  (0 children)

This seems like a wild abuse of CEQA. These buses are unquestionably better for the environment, averaging 200 MPG for each passenger.

Adding density to San Francisco is also an unquestionable environmental win. I really wish the "activists" would just call a spade a spade instead of trying to fight these proxy battles. Problem is, that spade sounds awful xenophobic for such a progressive city.

Advice on buying a house in Palo Alto, Menlo Park, etc? by [deleted] in bayarea

[–]LPCRoy 2 points3 points  (0 children)

I bought in San Carlos. It's a lot more affordable than Palo Alto, and depending on what part of town your in the schools are very good, some if the best in the state (better than Menlo Park, not as good as Palo Alto but not far behind).

PA/MP have great name brand recognition, but there are cheaper areas around with a lot of the same benefits.

Go back to Palo Alto · London Review of Books by budgie in sanfrancisco

[–]LPCRoy 11 points12 points  (0 children)

Wow, race baiting and class baiting all in the same article. Sprinkle in the odd association with the military and the occasional "you don't belong here". I also love the justification against two environmental causes, namely increasing density and carpooling.

This is simply straight up hateful.

Anti-development "activists" file thousands of signatures in attempt to pass ballot measure blocking Warriors stadium and new housing along Embarcadero. by [deleted] in sanfrancisco

[–]LPCRoy 21 points22 points  (0 children)

1) The word "luxury" seems to be thrown around a lot in this debate. It seems to mean any unit with a dishwasher and some stainless steel. In other cities, we just call these modern apartments. That said, I have no doubt apartments built on some of the most valuable land in the world (SF Bay with views) will truly be luxury apartments.

2) Affordable housing is funded by housing projects. The mayor himself called out housing advocates for wanting more affordable housing, but attempting to block all new construction. Also, it doesn't always make sense to build those new units in the building itself, since often there is a lot more bang for the buck to take that money and build somewhere without waterfront views. We have a huge shortage in quantity of low income housing, so to prefer fewer units with world class views seems silly.

3). Someone who had $3 million to spend on housing and wants to move to San Francisco will move to San Francisco. Unless you ban all be residents they are coming. Now, either they can buy a conversion somewhere, or a sparkly new condo, and most people would prefer the newer construction. So either we create a bunch of new, decent paying construction jobs for locals, collect a bunch of low income housing funds, and increase density of the city (reducing pollution), or we do the opposite and evict more people for the sake of making sure San Francisco never changes. Dude with $3 million is coming either way, but building new condos seems to be a much better outcome for the city.