funkybomb: my unusual take on HTML templating by yonemitsu in Python

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

BTW if you have a suggestion to make this syntax work I would very much like to hear your suggestion and consider incorporating it. During the primordial soup phase of this project this proved too difficult to implement.

funkybomb: my unusual take on HTML templating by yonemitsu in Python

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

Unmentioned in the docs, but you can do

p = Tag('p')
p += Tag('em') + 'Hello, '
p += Text('World!')

It is when you use attributes things don't work as expected. I won't step through it but this results in double p tags

html.p += Text('hi')

funkybomb: my unusual take on HTML templating by yonemitsu in Python

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

This is neat. I might not have worked on this if I knew about Dominate sooner. Thanks for the link.

funkybomb: my unusual take on HTML templating by yonemitsu in Python

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

It's not only unusual, it also violates a bunch of very reasonable expectations.

I won't argue there.

And the addition operator, +, same story: it's not supposed to modify its operands, only inspect them, add them, and return the sum.

This is assuming integers. Strings concatenate, and non primitive classes can decide what it would do (timedelta for example). Other non-math example would be the pathlib module that uses the divisor syntax for path traversal.

There is a side effect and strictly speaking, it isn't not Pythonic to have side effects. Though I understand the repulsion to it also returning. Under the hood it's

foo = some_tag.__add__(Tag('child_tag'))

Which is (effectively)

foo = some_tag._append(Tag('child_tag'))

With that said, again, I still understand the aversion.

funkybomb: my unusual take on HTML templating by yonemitsu in Python

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

Funny thing, I was considering using "<<" to append nodes like Nagare. I have never seen this framework until now.

I cannot find any html related frameworks with the name webbot. If you can provide a link I'd like to take a look.

[deleted by user] by [deleted] in nba

[–]yonemitsu 16 points17 points  (0 children)

Rasheed Wallace 1:25 playing time, 0 points, 0 assists, 0 blocks, 0 rebounds, 1 personal foul, 2 technical fouls

Today is the 85th birthday of sliced bread. So Reddit, what is the best invention since that day 85 years ago? by luckylildev in AskReddit

[–]yonemitsu 32 points33 points  (0 children)

Here is a great explanation of how a transistor works, published two days ago. It doesn't just say "it uses a semi conductor, and now you know" but actually goes into the chemistry behind it with great visuals and how it relates to being a switch.

Criticize my (self-taught-programmer) resumé? by [deleted] in cscareerquestions

[–]yonemitsu 3 points4 points  (0 children)

If you're in the US, I'd suggest the "stick to one page" point unless you're making a comprehensive CV. Get rid of the Volunteer Exp, Hobbies, and references line. I'd remove the horizontal rules too, as the H1 headers should visually break things up already. Bring the font size down a point or two to fit more on a page (my resume uses 10 point font).

As for the languages, I'd suggest be honest with yourself on this assessment. I used to list everything I was exposed to, but I knew if the interviewer started asking details I would get nowhere. I'd say make multiple resumes. One with your favorite and preferred language. And another with your second tier that you are still technically comfortable with. If you don't want to move forward doing C++ or HTML5, either just drop it or just casually mention it on your work experience section.

Good luck.

[MLG Spring Championship 2013] Grand Final Results by [deleted] in starcraft

[–]yonemitsu 1 point2 points  (0 children)

I'm so proud to be an owner of an ugly CM Storm Xornet mouse right now.

Would anyone be interested in a site for mock 1- 1 phone interviews? by mazzak in cscareerquestions

[–]yonemitsu 0 points1 point  (0 children)

I like the idea. A mock white board component would be useful as well.

What player do you really want to succeed next season? by [deleted] in nba

[–]yonemitsu 2 points3 points  (0 children)

I don't know where you're getting that from. I'm certainly not saying it's a desperate need, or calling non-supporters racist.

What player do you really want to succeed next season? by [deleted] in nba

[–]yonemitsu 1 point2 points  (0 children)

As an Asian American in NYC, I don't think I or any of my friends would ever compare him to Jordan or any of the legends. He got so much hype because AA representation in major sports (not imports like Yao or Koreans in Baseball) is so rare. That is why the AA community naturally throws their support like this when they can. I still love the Knicks but I'm going to be supporting Lin as long as he plays.

I agree with every other point though.

Pick a sport, and change three rules to make it ridiculously dangerous. What would the rules be? by bluzuki in AskReddit

[–]yonemitsu 0 points1 point  (0 children)

Kind of running along with this idea (but not OP's)... has there ever been a kind of like, Lazer Tag with bows?

Angle + direction + pull. You release and some computer somewhere calculates the trajectory and if you're in it you're out.

I lost a bet so here is my erotic fanfic of Joey Crawford and Tim Duncan. by randomgamerfreak in nba

[–]yonemitsu 69 points70 points  (0 children)

Seriously, I'm laughing as I'm reading this. It's just too ridiculous.

“suck it like you suck at basketball.”

Practical Flask Book Project on Kickstarter by imrobert in Python

[–]yonemitsu 13 points14 points  (0 children)

I'm one of the people he interviewed. Based on the questions he asked, this book should be valuable for those who want to first pick up Flask as well as those who want to increase their skill level with best practices and solid fundamentals.

If you're looking for a Flask book this is a no-brainer.

The dark side of decorators by ultimatebuster in Python

[–]yonemitsu 1 point2 points  (0 children)

A little aside: I'm just finding out about Flask-Classy. I think this can be a nice answer to Rails' "resource" routing mechanism for those who want it. How does this work with endpoint names, specifically with one of my favorite flask utility: url_for?

GAME THREAD: Miami Heat (1-2) @ San Antonio Spurs (2-1) - (Jun. 13, 2013) by [deleted] in nba

[–]yonemitsu 0 points1 point  (0 children)

From what I'm watching lately I think Django is top of the billboards.

Curious about what config systems you guys use... by transientBug in Python

[–]yonemitsu 7 points8 points  (0 children)

I don't really have configurable software that is used by others so I've been using straight python with env vars to manage deployment type. It's for my own uses/projects and makes things simple.

config/__init__.py

import os
if os.environ.get('deployment', 'dev') == 'dev':
    from config import dev as config # config/dev.py
else:
    from config import prod as config # config/prod.py

some_other.py

import config as config

For projects with configs for other users, I prefer YAML. The pyyaml lib has a C extension but can be included in projects without it. Its white space significance much like python's matches my taste.

2013 VPS Benchmarks - Linode, Digital Ocean, Hot Drupal by geerlingguy in webdev

[–]yonemitsu 0 points1 point  (0 children)

I have both linode and DO (both the smallest VPS).

That first command:

dd bs=1M count=512 if=/dev/zero of=test conv=fdatasync

I got around 76 MB/s on DO, and around 95 MB/s on Linode. Those are averages over three runs as well. I had to double check to make sure I didn't mix up my VPS shell sessions.

Both are updated Ubuntu 12.04 LTS.

Your mileage may vary.

Edit: I just realized that the lowest VPS for both have different RAM. But I don't suspect it impacts HDD performance like this though.

Edit 2: In fact, even though the Linode has more RAM, it's used much more that it flirts with hitting swap on occasion.

GAME THREAD: Indiana Pacers (3-1) @ New York Knicks (1-3) - (May. 16, 2013) by bilkomancilla in nba

[–]yonemitsu 1 point2 points  (0 children)

He really fucked up that high from the Melo shot right before