Hacker Newsnew | past | comments | ask | show | jobs | submit | more task_queue's commentslogin

We are and have been.


If you found out your friend's spouse was cheating, you would understand if people were upset if your idea of telling them was to post their pictures, address, relationship status and credit card number on every street corner in the neighborhood.

Also, you do it to people who weren't cheating at all. You don't even know them.

Then you start buying billboards.


Your comment entirely hinges on the following statement:

"If you found out your friend's spouse was CHEATING"

Let me rephrase it, and let's see if your statement still holds...

"If you found out your friend was a member of a gardening forum"

Given this second scenario, if I were to purchase billboards exposing their personal information, including pictures, address, and - important - their registration on the gardening forum, then I certainly would be to blame for the deplorable act of exposing personal information. I agree on this point entirely.

It is NOT my fault however, if society believes gardening is morally reprehensible, and they then incur shame as a result of having chosen to associate with gardeners.

Replace gardeners, with liars, cheaters, etc, and you'll see (hopefully), why I don't appropriate the blame for this hypothetical "shame for family members" onto the hackers. Furthermore, let's not pretend like the hacker's suddenly caused family trauma that never would have happened. That's incredibly naïve. In all likelihood, if there was infidelity, these relationships weren't exactly headed in a good direction to begin with, and their exposure as liars, and cheaters, would happen for a good lot of them anyways! And just to underscore my point, if they were gardeners, there would be no shame in it all.

So for maybe the 3rd time now, just so that I am completely clear - NO, exposing personal information is NOT cool, and I do NOT think it's right to do. However, the fall out being incurred by family members, has more to due with the nature of the exposure, than the exposure itself. I really genuinely struggle to see why this point is so difficult for some.


You wouldn't care if people who are not at all involved are implied to be coke dealers because they had their identity stolen?

Public exposure of individuals' private information is irresponsible, period.

Vigilantism is against the social contract, upholding it implies you gave up that power to the institutions that have the responsibility to judge and prosecute.


> What about the scores of people to whom cheating is a dealbreaker

What about the scores of people who have a blue car?


How are 37 million private accounts, having nothing to do with you, your concern at all?

You brushed the consequences of this vigilante justice under the rug. Those Saudi Arabians will most likely suffer severe consequences, probably death, for being exposed.

The public is not a judge, jury or executioner, no matter how good it makes you feel to play morality police.

None of this excuses an irresponsible exposure of private information.


Life will last much longer for you if you accept that people will most likely act in what they perceive to be their self-interest.


Hackers publicly exposed personal information but it is not the their fault that the personal information was publicly exposed?

I'm not sure how this follows.

You seem to be very glad society hasn't moved on from the "Name and Shame" game. The one that ends in death, violence and shame for everyone close to and including the named.


I believe in consequences, and personal responsibility. Yes, hacker's publicly exposed personal information, but it wasn't the personal information of Mother Teresa.

I wonder if one's opinion on the ethical nature of this hack, hinges on your moral disposition on cheating/infidelity. I'll illuminate what I'm getting at, by asking you this hypothetical:

If Ashley Madison were a website for child sex trafficking, and the names of registrants were exposed, leading to arrests, and public shaming... How would you feel?

I'd be very surprised if you kept the same opinion, that publicly outing those individuals, was not a fit punishment for the crime. Given that, then this entire conversation is completely subjective, and based entirely on your opinion about cheating, lying, and infidelity.


> If Ashley Madison were a website for child sex trafficking, and the names of registrants were exposed, leading to arrests, and public shaming... How would you feel?

This is still an irresponsible exposure of personal information. This is still vigilante justice.

What happens to the people whose identities were stolen and used on that site? Their lives will be ruined.

It is not the public's responsibility to judge or prosecute/persecute. Give the database to the authorities.

> I'd be very surprised if you kept the same opinion, that publicly outing those individuals, was not a fit punishment for the crime. Given that, then this entire conversation is completely subjective, and based entirely on your opinion about cheating, lying, and infidelity.

This has nothing to do with what the people were doing and everything to do with mob justice and innocent people caught in the crossfire.

Public disclosure of personal information is irresponsible and hurts everyone associated with the exposed.

How is public shaming justice? Who are you to decide who and how to punish? What's an acceptable amount of innocent people to expose as cheaters/child traffickers? What about the amount of innocent family members and friends of the exposed that will get to experience this as well?

How many of the gay men in Saudi Arabia exposed by this hack are allowed to be stoned to death before the ends do not justify the public exposure?


Privacy for you and me, maybe. Do you think if you have any kind of real power you will be subject to that scrutiny?


> I am against it, because it allows arbitrary Python expressions inside format strings.

I was for this PEP until your post made this reality apparent. I'll take security over convenience.


This proposal doesn't affect security in any way. It's just syntactic sugar.

Instead of writing this:

    'My name is ' + format(name) + ' my age next year is ' + format(age+1)
or

    'My name is {name}, my age next year is {age}'.format(name=name, age=age+1)
You just write

    f'My name is {name}, my age next year is {age=1}'
It's shorter, it's more readable and more convenient. I can't wait for this PEP to be accepted.

Edit: Fixed small errors in the examples.


First of all, I don't think you can do {age+1} in a string right now.

But you can use string placeholders when used with format function. That should take take of this use case. So no need to add another syntactic sugar to make it more convenient.

It is already as simple as possible. Let us not try to simplify it further.

I will be horrified and very worried about the direction that the language has taken if this pep gets accepted.


This perspective is so interesting to me. You say the version using `.format` is "as simple as possible", but the interpolated version seems clearly simpler to me, because it eliminates the redundancy in the placeholders. What's the disconnect here?


> but the interpolated version seems clearly simpler to me. What's the disconnect here?

The disconnect is this. An explicit list of variables to use for interpolation is not redundancy. Because the placeholders does not, by themselves, refer to anything. Placeholders are just holes and only have a meaning in the context of formatting functions. And even in them, they does not refer to a local variables, even when they share a common name. So when you use .format() function, you are actually saying, "here is a string with some named holes. Fill the hole named 'A' with the value from variable 'A', the hole named 'B' with the value from variable 'B'.

So hole 'A' and variable 'A' are different things even if they share the same name.

Now, the simplicity argument.

Every thing should be made as simple as possible. But not simpler. Why not? Because when you simplify further, you are paying a cost (often not apparent initially), some times in clarity, sometimes in correctness and so on. The pigeonhole principle.

In our case, we can further simplify the process by adding an implicit mapping from named placeholders to local variables. When you do so, you are adding something implicit. The costs of which might not be apparent at this point..

So this pep is strapping on something to the whole language, to slightly simplify this one use case. Which is why I said that it is trying to simplify it further than it is possible.


edit: Deleted my response because this is a bikeshed. You prefer placeholders, I prefer interpolations, it's totally subjective and there's little point debating it!


You're right, you can't do {age+1} in a string right now. I just edited to fix it.


I don't think this is actually a security concern. The only place f-strings are evaluated is where they're directly included in the source; they can't be supplied by a user (unless you're using "eval," in which case the security concern applies with or without f-strings). As the PEP says:

"Because the f-strings are evaluated where the string appears in the source code, there is no additional expressiveness available with f-strings. There are also no additional security concerns: you could have also just written the same expression, not inside of an f-string."


Should have read the PEP in full. Thanks : )


I'd submit the security concern is more that specifying a string interpolation format without first-class thought about how to encode interpolated strings is a terrible idea in 2015, and people need to really stop doing this. See http://www.jerf.org/iri/post/2942 and the example library I use to demonstrate the point, https://github.com/thejerf/strinterp .

Of course all current methods of string interpolation in Python have that problem too.

And typing that sentence really, really makes we want to link http://xkcd.com/927/ . I'm unconvinced adding a fourth choice at this very late date can fix anything.


I will go further and say that I will even take readability over convenience.

This is a step in the reverse direction. Please don't do this. I am not sure why this is even considered. We already have ways to do this clearly. Let us not add another way to do this in a less readable way that is a lot more easier to write. That is a deadly combination.

Features in python are geared towards more readable code (I know about the stuff you can do with things like comprehensions, but hey I think their power justifies them enough). This will lead to people using this format due to initial convenience, but ends up regretting doing so.

Please remember that code is read more often than it is written. So a requiring a little verbosity if that can enhance readability even a little bit, is good. I hope these kinds of good things about python does not get removed.

I am coming from 9 years of experience with PHP. And I will say that this is not worth it. And this is actually one of the features I have come to like in Python now.

And that is not considering the implications of having expression evaluation inside strings...


I actually think the proposal would be more readable because you don't have to think about what it means. Compare:

"{} of very long text here...".format(value)

f"{value} of very long text here..."


This is a simple example that does seem more readable (though it also would be if you explicitly added the value=value), but I think the concerns people have are about more complex examples, and the fact that readability is also impacted if allowing arbitrary code within strings themselves.

If you don't like using the empty {} (which seems fair enough), you can already use a couple of slightly more verbose but more explicit options:

    "{value} of very long text here...".format(**locals)
or (more verbose with many keys)

    "{value} of very long text here...".format(value=value)
I tend to prefer the latter even with multiple keys, but also think the former is better as it makes it explicit that the string is populated with the locals rather than implicitly doing it to all strings.


.format(locals()) is a hack; locals() isn't supported on some python implementations.


The documentation at https://docs.python.org/3/library/functions.html#locals doesn't indicate that locals is not part of the language - where is it documented that using it is a hack and that python implementations need not support it?


It is on PyPy and CPython. Which ones don't? And when they don't support it, how do they behave? Return an empty dict or give an error?


I thinks this is where our difference in comes from.

When we are reading code, we are not usually reading the strings contained within.

We are reading variables names, we are looking at where they are used, where they are assigned, stuff like that.

I very rarely look inside the strings when we are actually reading code. When reading code, strings are just black boxes where nothing can happen. So we can completely ignore them.

With this pep, that will change. And readability takes a big hit. Strings are no longer black boxes.

And actually you can get the " {value} if very long text" format right now using the format function, but it right now requires an explicit list/dictionary of variables.

This explicit list of variables really helps in the context of reading code. And forcing users to write down that explicit list of variables to use, is good.


How do you know where the string ends? If your editor has syntax coloring and you look for the end of the string-color block, then the expressions inside the string will also have a different color and will pop right out. If you don't use syntax coloring you have to scan for " or ', and you'll learn to scan for { too.


>How do you know where the string ends?

I usually just go to the end of the line. or if that is not possible, I think I usually look at the next closest thing that obviously is not a string and scan backwards.

I mean, usually I didn't have to do anything consciously (or do a scan) to spot the end of a string.


When I'm reading code, I'm always reading string literals contained within it. Strings that aren't integral to the code should be external resources, and I'm not even convinced it's possible to black-box them at a below-conscious level; you can selectively actively ignore them, but that takes additional effort that is only generally a net win in particularly poorly structured code.)


Point taken!


You can have something like this today if you really want to :):

    def f(s):
        import sys
        return s.format(**sys._getframe(1).f_locals)
Used as

    a = 1
    b = 2
    f("{a} + {b}")


imakesnowflakes made a good point below.

Also compare the readability of this:

"very long text {value} another long text".\ format(value=value)

vs.

f"very long text {value} another long text"

^ now you have to go and visually search through the whole string to see what is being used in there


This isn't a bad point, but anecdotally, after using interpolated strings for many years, I've never come across this problem a single time.


Syntax highlighting will make the variables used in the string pop out. This is easier than scanning to the end of the line to find the format() call.


Also coming from a php background, I'll 100% agree with this. I always cringe when I see strings formatted like this for pretty much the same reasons. It makes it painful to figure out what the hell a string is actually going to look like when you have a bunch of code embedded inside it


Note that these format strings must exist in the source code -- you can't read them from the user then execute it.


The right to be forgotten flies in the face of capitalism. You cannot assume you act in perfect self-interest without total and perfect information. The first can be easy to acquire, the second harder.

The right to be forgotten impedes on total information awareness and the desire to make the perfect rational decision with your money.

This is a good thing. Total information is not perfect information because of bias and context. Someone seeking such information will process it through a biased lens and never attain perfection. In that case, the individual under the lens will lose out.


Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: