Re: To whoever hacked into my Database

2013-11-09 Thread Chris Angelico
On Sat, Nov 9, 2013 at 6:44 PM, Νίκος Αλεξόπουλος nikos.gr...@gmail.com wrote: You are right. You could have servers anywhere in the world. But i will assume the following hostnames are yours: mail14.ess.barracuda.com mail0.ess.barracuda.com I'm quite sure this time because i notice that

Re: chunking a long string?

2013-11-09 Thread wxjmfauth
Le samedi 9 novembre 2013 01:46:32 UTC+1, Steven D'Aprano a écrit : On Fri, 08 Nov 2013 12:43:43 -0800, wxjmfauth wrote: (say, 1 kbyte each): one kilo of characters or bytes? Glad to read some users are still living in an ascii world, at the Unicode time where an encoded code

Re: chunking a long string?

2013-11-09 Thread Chris Angelico
On Sat, Nov 9, 2013 at 7:14 PM, wxjmfa...@gmail.com wrote: If you wish to count the the frequency of chars in a text and store the results in a dict, {char: number_of_that_char, ...}, do not forget to save the key in utf-XXX, it saves memory. Oh, if you're that concerned about memory usage of

Re: To whoever hacked into my Database

2013-11-09 Thread Νίκος Αλεξόπουλος
Στις 9/11/2013 9:54 πμ, ο/η Νίκος Αλεξόπουλος έγραψε: Στις 9/11/2013 9:05 πμ, ο/η Νίκος Αλεξόπουλος έγραψε: Στις 9/11/2013 8:37 πμ, ο/η Chris Angelico έγραψε: On Sat, Nov 9, 2013 at 5:32 PM, Νίκος Αλεξόπουλος nikos.gr...@gmail.com wrote: I'am not saying out of arrogance but i was really under

Re: To whoever hacked into my Database

2013-11-09 Thread Chris Angelico
On Sat, Nov 9, 2013 at 7:31 PM, Νίκος Αλεξόπουλος nikos.gr...@gmail.com wrote: if page and os.path.isfile( cgi_path + page ) in os.listdir( cgi_path ): Try pass bogus values again into my database! Well done! *slow clap* In the interests of security, you have just locked everything out,

Re: Adding 'download' column to existing 'visitors' table (as requested)

2013-11-09 Thread Robert Kern
On 2013-11-09 04:27, Piet van Oostrum wrote: Sibylle Koczian nulla.epist...@web.de writes: Am 07.11.2013 14:14, schrieb Piet van Oostrum: Nick the Gr33knikos.gr...@gmail.com writes: I have decided to take your advice. I wasn't able to fit those 'lists' of mine into MySQL's varchar()

Re: To whoever hacked into my Database

2013-11-09 Thread Νίκος Αλεξόπουλος
Στις 9/11/2013 10:39 πμ, ο/η Chris Angelico έγραψε: On Sat, Nov 9, 2013 at 7:31 PM, Νίκος Αλεξόπουλος nikos.gr...@gmail.com wrote: if page and os.path.isfile( cgi_path + page ) in os.listdir( cgi_path ): Try pass bogus values again into my database! Well done! *slow clap* In the interests of

Re: To whoever hacked into my Database

2013-11-09 Thread Νίκος Αλεξόπουλος
Στις 9/11/2013 10:39 πμ, ο/η Chris Angelico έγραψε: On Sat, Nov 9, 2013 at 7:31 PM, Νίκος Αλεξόπουλος nikos.gr...@gmail.com wrote: if page and os.path.isfile( cgi_path + page ) in os.listdir( cgi_path ): Try pass bogus values again into my database! Well done! *slow clap* In the interests of

Re: my favorite line of py code so far

2013-11-09 Thread Peter Cacioppi
Peter Otten said: _ = lambda c: lambda x: c(*x) list(map(_(P), zip([1,2,3], [6, 5, 4]))) [Point(x=1, y=6), Point(x=2, y=5), Point(x=3, y=4)] ? While the obvious approach would be [P(*args) for args in zip([1,2,3], [6, 5, 4])] [Point(x=1, y=6), Point(x=2, y=5), Point(x=3, y=4)] I

Re: my favorite line of py code so far

2013-11-09 Thread Chris Angelico
On Sat, Nov 9, 2013 at 8:23 PM, Peter Cacioppi peter.cacio...@gmail.com wrote: I sometimes use map, sometimes comprehensions. I suspect other people do the same, that's why the language supports map and comprehensions. I think map is fine if you can use a named function, but if you can't come

Re: my favorite line of py code so far

2013-11-09 Thread Paul Rubin
Peter Cacioppi peter.cacio...@gmail.com writes: [P(*args) for args in zip([1,2,3], [6, 5, 4])] [P(x,y) for x,y in zip(...)] Are you saying it's always preferable to avoid map? Not always. Depends on context, partly subjective. I sometimes use map, sometimes comprehensions. I suspect other

Re: WHAT DOES ISLAM SAY ABOUT TERRORISM ?????????????????

2013-11-09 Thread Paul Pittlerson
If you want to convert pythoneers to Islam, you are gonna have to show them how importing Allah will make their scripts run faster, or something like that. Otherwise, I'm pretty sure you are out of luck. -- https://mail.python.org/mailman/listinfo/python-list

Re: chunking a long string?

2013-11-09 Thread Mark Lawrence
On 09/11/2013 08:14, wxjmfa...@gmail.com wrote: I'll ask again, please don't send us double spaced google crap. -- Python is the second best programming language in the world. But the best has yet to be invented. Christian Tismer Mark Lawrence --

Re: my favorite line of py code so far

2013-11-09 Thread Peter Otten
Peter Cacioppi wrote: Peter Otten said: _ = lambda c: lambda x: c(*x) list(map(_(P), zip([1,2,3], [6, 5, 4]))) [Point(x=1, y=6), Point(x=2, y=5), Point(x=3, y=4)] ? While the obvious approach would be [P(*args) for args in zip([1,2,3], [6, 5, 4])] [Point(x=1, y=6), Point(x=2,

Re: my favorite line of py code so far

2013-11-09 Thread Stefan Behnel
Peter Otten, 09.11.2013 12:49: There is no obvious meaning attached to _ -- so don't use it. Not quite true. Depending on the context, the obvious meanings of _ in Python are either 1) ignore me, e.g. in _, b = some_tuple or 2) this is a non-public thing, as in class Xyz:

The narcissism of small code differences

2013-11-09 Thread Steven D'Aprano
Uses an example written in Ruby, but don't let that put you off: http://raganwald.com/2008/05/narcissism-of-small-code-differences.html -- Steven -- https://mail.python.org/mailman/listinfo/python-list

Re: my favorite line of py code so far

2013-11-09 Thread Chris Angelico
On Sat, Nov 9, 2013 at 11:41 PM, Stefan Behnel stefan...@behnel.de wrote: 2) this is a non-public thing, as in class Xyz: _private = 1 Your three meanings all have the etymology of ignore me, but I would distinguish this one from the others. An underscore used on its own has

Re: datetime question

2013-11-09 Thread Mark Lawrence
On 08/11/2013 23:02, Νίκος Αλεξόπουλος wrote: Στις 9/11/2013 12:49 πμ, ο/η Denis McMahon έγραψε: On Sat, 09 Nov 2013 00:01:37 +0200, Νίκος Αλεξόπουλος wrote: I saw the link and i'm wondering if it can be written in 1-liner. Yes, but you have to rewrite all your code in perl to do this.

Re: datetime question

2013-11-09 Thread Chris Angelico
On Sat, Nov 9, 2013 at 11:45 PM, Mark Lawrence breamore...@yahoo.co.uk wrote: Why is Web Security for Dummies missing? Because a Dummy can host a web (all you have to do is invite a spider into your house and let it do the work), but he won't be able to make it secure. Or, more succinctly:

Re: The narcissism of small code differences

2013-11-09 Thread Mark Lawrence
On 09/11/2013 12:42, Steven D'Aprano wrote: Uses an example written in Ruby, but don't let that put you off: http://raganwald.com/2008/05/narcissism-of-small-code-differences.html Wonderful read, thanks very much for the link. -- Python is the second best programming language in the world.

New user's initial thoughts / criticisms of Python

2013-11-09 Thread John von Horn
Hi Everyone, I'm Mr. Noobie here, I've just started easing into Python (2.7.4) and am enjoying working along to some youtube tutorials. I've done a little programming in the past. I've just got a few thoughts I'd like to share and ask about: * Why not allow floater=float(int1/int2) - rather

Re: New user's initial thoughts / criticisms of Python

2013-11-09 Thread Ned Batchelder
On Saturday, November 9, 2013 8:08:25 AM UTC-5, John von Horn wrote: Hi Everyone, I'm Mr. Noobie here, I've just started easing into Python (2.7.4) and am enjoying working along to some youtube tutorials. I've done a little programming in the past. I've just got a few thoughts I'd like

Re: Conditional breakpoints in ceval.c

2013-11-09 Thread Ned Batchelder
On Friday, November 8, 2013 9:03:51 PM UTC-5, Demian Brecht wrote: Hi all, I have an .py file with a simple assignment in it: foo = 'bar' Now, I want to set a conditional breakpoint in gdb, breaking on that assignment (I'm guessing the top of the stack would be breaking on the LOAD_CONST

Re: New user's initial thoughts / criticisms of Python

2013-11-09 Thread Joshua Landau
On 9 November 2013 13:08, John von Horn j@btinternet.com wrote: I'm Mr. Noobie here, I've just started easing into Python (2.7.4) and am enjoying working along to some youtube tutorials. I've done a little programming in the past. I've just got a few thoughts I'd like to share and ask

Re: New user's initial thoughts / criticisms of Python

2013-11-09 Thread Mark Lawrence
On 09/11/2013 13:08, John von Horn wrote: Hi Everyone, I'm Mr. Noobie here, I've just started easing into Python (2.7.4) and am enjoying working along to some youtube tutorials. I've done a little programming in the past. If it's possible I'd strongly recommend Python 3.3, there's lots of

Re: datetime question

2013-11-09 Thread Νίκος Αλεξόπουλος
Στις 9/11/2013 2:45 μμ, ο/η Mark Lawrence έγραψε: On 08/11/2013 23:02, Νίκος Αλεξόπουλος wrote: Στις 9/11/2013 12:49 πμ, ο/η Denis McMahon έγραψε: On Sat, 09 Nov 2013 00:01:37 +0200, Νίκος Αλεξόπουλος wrote: I saw the link and i'm wondering if it can be written in 1-liner. Yes, but you

Re: my favorite line of py code so far

2013-11-09 Thread Peter Otten
Stefan Behnel wrote: Peter Otten, 09.11.2013 12:49: There is no obvious meaning attached to _ -- so don't use it. Not quite true. Depending on the context, the obvious meanings of _ in Python are either 1) ignore me, e.g. in _, b = some_tuple or 2) this is a non-public

Re: New user's initial thoughts / criticisms of Python

2013-11-09 Thread Jussi Piitulainen
John von Horn writes: Hi Everyone, I'm Mr. Noobie here, I've just started easing into Python (2.7.4) and am enjoying working along to some youtube tutorials. I've done a little programming in the past. I've just got a few thoughts I'd like to share and ask about: * Why not allow

Re: New user's initial thoughts / criticisms of Python

2013-11-09 Thread Chris Angelico
On Sun, Nov 10, 2013 at 12:08 AM, John von Horn j@btinternet.com wrote: Hi Everyone, I'm Mr. Noobie here, I've just started easing into Python (2.7.4) and am enjoying working along to some youtube tutorials. I've done a little programming in the past. Hi! For myself, I've come from a

Re: chunking a long string?

2013-11-09 Thread Roy Smith
In article mailman.2283.1383985583.18130.python-l...@python.org, Chris Angelico ros...@gmail.com wrote: Some languages [intern] automatically for all strings, others (like Python) only when you ask for it. What does only when you ask for it mean? --

Re: chunking a long string?

2013-11-09 Thread Chris Angelico
On Sun, Nov 10, 2013 at 1:37 AM, Roy Smith r...@panix.com wrote: In article mailman.2283.1383985583.18130.python-l...@python.org, Chris Angelico ros...@gmail.com wrote: Some languages [intern] automatically for all strings, others (like Python) only when you ask for it. What does only when

Re: datetime question

2013-11-09 Thread Chris Angelico
On Sat, Nov 9, 2013 at 9:29 AM, Grant Edwards invalid@invalid.invalid wrote: It's that global newline shortage again. Just because a few people get killed in a newline mine they all go on strike... It's a conspiracy! The government kills a few miners (with their contrail mind-control stuffo)

Re: To whoever hacked into my Database

2013-11-09 Thread Steven D'Aprano
On Sat, 09 Nov 2013 09:05:51 +0200, Νίκος Αλεξόπουλος wrote: Its probably unwise to post the following snippet of code that validates user input so an attacker wouldn't pass arbitrary values to my script but what the heck. On the contrary, it is wise to publicise your security code. It is

Re: chunking a long string?

2013-11-09 Thread Roy Smith
In article mailman.2298.1384009376.18130.python-l...@python.org, Chris Angelico ros...@gmail.com wrote: On Sun, Nov 10, 2013 at 1:37 AM, Roy Smith r...@panix.com wrote: In article mailman.2283.1383985583.18130.python-l...@python.org, Chris Angelico ros...@gmail.com wrote: Some

Sandboxing Python [was Re: New user's initial thoughts / criticisms of Python]

2013-11-09 Thread Steven D'Aprano
On Sun, 10 Nov 2013 01:27:11 +1100, Chris Angelico wrote: I was trying to sandbox CPython and run untrusted scripts while stopping them from accessing the OS or file system. It's basically impossible PyPy is supposed to come with a proper sandbox. Although even in that case, I think it is

Re: chunking a long string?

2013-11-09 Thread Chris Angelico
On Sun, Nov 10, 2013 at 2:21 AM, Roy Smith r...@panix.com wrote: But, you missed the point of my question. You said that Python does this only when you ask for it. That implies it never interns strings if you don't ask for it, which is clearly not true: $ python Python 2.7.1 (r271:86832,

Re: Sandboxing Python [was Re: New user's initial thoughts / criticisms of Python]

2013-11-09 Thread Chris Angelico
On Sun, Nov 10, 2013 at 2:25 AM, Steven D'Aprano steve+comp.lang.pyt...@pearwood.info wrote: On Sun, 10 Nov 2013 01:27:11 +1100, Chris Angelico wrote: I was trying to sandbox CPython and run untrusted scripts while stopping them from accessing the OS or file system. It's basically impossible

Re: datetime question

2013-11-09 Thread Roy Smith
In article mailman.2300.1384009442.18130.python-l...@python.org, Chris Angelico ros...@gmail.com wrote: On Sat, Nov 9, 2013 at 9:29 AM, Grant Edwards invalid@invalid.invalid wrote: It's that global newline shortage again. Just because a few people get killed in a newline mine they all go

Re: chunking a long string?

2013-11-09 Thread Roy Smith
In article mailman.2301.1384011026.18130.python-l...@python.org, Chris Angelico ros...@gmail.com wrote: Pike implements #2, I presume that was a typo. Duh. Yes. -- https://mail.python.org/mailman/listinfo/python-list

Re: chunking a long string?

2013-11-09 Thread Steven D'Aprano
On Sat, 09 Nov 2013 09:37:54 -0500, Roy Smith wrote: In article mailman.2283.1383985583.18130.python-l...@python.org, Chris Angelico ros...@gmail.com wrote: Some languages [intern] automatically for all strings, others (like Python) only when you ask for it. What does only when you ask

Re: New user's initial thoughts / criticisms of Python

2013-11-09 Thread rusi
On Saturday, November 9, 2013 6:38:25 PM UTC+5:30, John von Horn wrote: Another useful tool in the programmer's toolbox Select DayofWeek case mon ... end select You can typically write this in python as a dictionary cases = {mon: do_mon-action, tue, do_tue_action,

Re: New user's initial thoughts / criticisms of Python

2013-11-09 Thread Roy Smith
In article d15d9993-90f2-43bd-824f-a1df6b7a4...@googlegroups.com, rusi rustompm...@gmail.com wrote: On Saturday, November 9, 2013 6:38:25 PM UTC+5:30, John von Horn wrote: Another useful tool in the programmer's toolbox Select DayofWeek case mon ... end select You

Re: New user's initial thoughts / criticisms of Python

2013-11-09 Thread rusi
On Saturday, November 9, 2013 9:26:02 PM UTC+5:30, Roy Smith wrote: In article rusi wrote: On Saturday, November 9, 2013 6:38:25 PM UTC+5:30, John von Horn wrote: Another useful tool in the programmer's toolbox Select DayofWeek case mon ... end select You can typically

Re: To whoever hacked into my Database

2013-11-09 Thread Νίκος Αλεξόπουλος
Στις 9/11/2013 5:07 μμ, ο/η Steven D'Aprano έγραψε: On Sat, 09 Nov 2013 09:05:51 +0200, Νίκος Αλεξόπουλος wrote: Its probably unwise to post the following snippet of code that validates user input so an attacker wouldn't pass arbitrary values to my script but what the heck. On the

Re: To whoever hacked into my Database

2013-11-09 Thread Νίκος Αλεξόπουλος
Στις 9/11/2013 5:07 μμ, ο/η Steven D'Aprano έγραψε: On Sat, 09 Nov 2013 09:05:51 +0200, Νίκος Αλεξόπουλος wrote: Its probably unwise to post the following snippet of code that validates user input so an attacker wouldn't pass arbitrary values to my script but what the heck. On the

python operational semantics paper

2013-11-09 Thread Paul Rubin
This looks kind of interesting. http://cs.brown.edu/~sk/Publications/Papers/Published/pmmwplck-python-full-monty/ Abstract We present a small-step operational semantics for the Python programming language. We present both a core language for Python, suitable for tools and proofs, and a

Re: datetime question

2013-11-09 Thread Gene Heskett
On Saturday 09 November 2013 10:33:57 Chris Angelico did opine: On Sat, Nov 9, 2013 at 9:29 AM, Grant Edwards invalid@invalid.invalid wrote: It's that global newline shortage again. Just because a few people get killed in a newline mine they all go on strike... It's a conspiracy! The

Re: To whoever hacked into my Database

2013-11-09 Thread Antoon Pardon
Op 09-11-13 07:32, Νίκος Αλεξόπουλος schreef: Στις 9/11/2013 8:20 πμ, ο/η Chris Angelico έγραψε: On Sat, Nov 9, 2013 at 4:54 PM, Νίκος Αλεξόπουλος nikos.gr...@gmail.com wrote: Στις 6/11/2013 5:25 μμ, ο/η Νίκος Γκρ33κ έγραψε: Okey let the hacker try again to mess with my database!!! He is

Re: New user's initial thoughts / criticisms of Python

2013-11-09 Thread John von Horn
On Sat, 09 Nov 2013 07:08:25 -0600, John von Horn wrote: Thanks so much for the replies. I'll get my head down and keep on going. Sometimes it's great to be wrong. I have a good feeling about this language. It's also nice that I can tap into this pool of knowledge that is comp.lang.python -

Re: New user's initial thoughts / criticisms of Python

2013-11-09 Thread Tim Chase
On 2013-11-10 01:27, Chris Angelico wrote: Is everyone happy with the way things are? Could anyone recommend a good, high level language for CGI work? Not sure if I'm going to be happy with Perl (ahhh, get him, he's mentioned Perl and is a heretic!) or Python. I would very much value any

Re: New user's initial thoughts / criticisms of Python

2013-11-09 Thread Mark Janssen
A little late, but a couple of cents worth more data: I've just got a few thoughts I'd like to share and ask about: * Why not allow floater=float(int1/int2) - rather than floater=float (int1)/float(int2)? This has to do with evaluation order, the stuff inside the parens gets evaluated first,

Re: New user's initial thoughts / criticisms of Python

2013-11-09 Thread Ned Batchelder
On Saturday, November 9, 2013 3:33:30 PM UTC-5, zipher wrote: Personally, I wouldn't recommend Python for web scripts. But I'm biased and am speaking from where I see the field of computer languages heading. MarkJ Tacoma, Washington I'd be interested to hear your thoughts on where the

Re: New user's initial thoughts / criticisms of Python

2013-11-09 Thread Mark Lawrence
On 09/11/2013 20:33, Mark Janssen wrote: * Call me pedantic by why do we need a trailing comma for a list of one item? Keep it intuitive and allow lstShopping=[] or [Bread] or [Bread, Milk,Hot Chocolate] I don't like [Bread,]. It bugs me. This one got answered, it has to do with the parser

Re: New user's initial thoughts / criticisms of Python

2013-11-09 Thread Tim Chase
On 2013-11-09 21:01, Mark Lawrence wrote: no comma is needed but a comma will be accepted. I find the optional trailing comma particularly useful (and painful in languages that don't accept it) for doing inline lists to produce cleaner version-control diffs. I write most of my code like this

Re: New user's initial thoughts / criticisms of Python

2013-11-09 Thread Mark Janssen
I'd be interested to hear your thoughts on where the field of computer languages is heading, and how that affects the choice of languages for building web sites. Well, there aren't that many groupings towards which languages specialize for (not including embedded or other

Re: chunking a long string?

2013-11-09 Thread Chris Angelico
On Sun, Nov 10, 2013 at 2:37 AM, Steven D'Aprano steve+comp.lang.pyt...@pearwood.info wrote: I think that Chris is wrong about Python only interning strings if you explicitly ask for it. I recall that Python will (may?) automatically intern strings which look like identifiers (e.g. spam but

Re: To whoever hacked into my Database

2013-11-09 Thread Chris Angelico
On Sun, Nov 10, 2013 at 2:32 AM, Antoon Pardon antoon.par...@rece.vub.ac.be wrote: And i had until i made some new changes last night, which i think i have corrected now as we speak. Continuing the arrogance. Just to put that in perspective, by the way: *EVERYONE* writes vulnerable code.

Re: datetime question

2013-11-09 Thread Chris Angelico
On Sun, Nov 10, 2013 at 2:39 AM, Gene Heskett ghesk...@wdtv.com wrote: Ya know, folks like Nick would have me signing off. Fortunately there are kill files. But the backscatter he creates I am still forced to read, or more usually skip. Then one of you frustrated standup comics comes along,

Re: New user's initial thoughts / criticisms of Python

2013-11-09 Thread Jonathan
On Saturday, November 9, 2013 8:27:02 AM UTC-5, Joshua Landau wrote: `select` is quite an odd statement, in that in most cases it's just a weaker variant of `if`. By the time you're at the point where a `select` is actually more readable you're also at the point where a different control flow

Languages for different purposes (was Re: New user's initial thoughts / criticisms of Python)

2013-11-09 Thread Chris Angelico
On Sun, Nov 10, 2013 at 8:21 AM, Mark Janssen dreamingforw...@gmail.com wrote: I'd be interested to hear your thoughts on where the field of computer languages is heading, and how that affects the choice of languages for building web sites. Well, there aren't that many groupings towards

Re: Languages for different purposes (was Re: New user's initial thoughts / criticisms of Python)

2013-11-09 Thread Mark Lawrence
On 09/11/2013 22:58, Chris Angelico wrote: * Some languages are just fundamentally bad. I do not recommend ever writing production code in Whitespace, Ook, or Piet. In my last job I was forced into using Apple(42 not so obvious ways to do it)Script. Yuck. -- Python is the second best

Re: New user's initial thoughts / criticisms of Python

2013-11-09 Thread Chris Angelico
On Sun, Nov 10, 2013 at 9:44 AM, Jonathan jtc...@gmail.com wrote: In pythonic syntax: select expression0: case case expression,[case expression],: which is equivalent to: elif expression0 = expression1: which is equivalent to: elif expression0 binary-operator Small clarification: It's

Re: Languages for different purposes (was Re: New user's initial thoughts / criticisms of Python)

2013-11-09 Thread Roy Smith
On 09/11/2013 22:58, Chris Angelico wrote: * Some languages are just fundamentally bad. I do not recommend ever writing production code in Whitespace, Ook, or Piet. One of the worst coding experiences I ever had was trying to build an app for a Roku media player. They have a home-grown

Re: New user's initial thoughts / criticisms of Python

2013-11-09 Thread MRAB
On 09/11/2013 22:44, Jonathan wrote: On Saturday, November 9, 2013 8:27:02 AM UTC-5, Joshua Landau wrote: `select` is quite an odd statement, in that in most cases it's just a weaker variant of `if`. By the time you're at the point where a `select` is actually more readable you're also at the

Re: Languages for different purposes (was Re: New user's initial thoughts / criticisms of Python)

2013-11-09 Thread Chris Angelico
On Sun, Nov 10, 2013 at 11:41 AM, Roy Smith r...@panix.com wrote: On 09/11/2013 22:58, Chris Angelico wrote: * Some languages are just fundamentally bad. I do not recommend ever writing production code in Whitespace, Ook, or Piet. One of the worst coding experiences I ever had was trying

Re: New user's initial thoughts / criticisms of Python

2013-11-09 Thread Chris Angelico
On Sun, Nov 10, 2013 at 11:50 AM, MRAB pyt...@mrabarnett.plus.com wrote: On 09/11/2013 22:44, Jonathan wrote: In pythonic syntax: select expression0: case case expression,[case expression],: case else: [snip] It's more likely that the cases would be indented the

Re: Languages for different purposes (was Re: New user's initial thoughts / criticisms of Python)

2013-11-09 Thread Mark Lawrence
On 09/11/2013 23:24, Mark Lawrence wrote: On 09/11/2013 22:58, Chris Angelico wrote: * Some languages are just fundamentally bad. I do not recommend ever writing production code in Whitespace, Ook, or Piet. In my last job I was forced into using Apple(42 not so obvious ways to do it)Script.

Re: splitting file/content into lines based on regex termination

2013-11-09 Thread Piet van Oostrum
bruce badoug...@gmail.com writes: hi. thanks for the reply. tried what you suggested. what I see now, is that I print out the lines, but not the regex data at all. my initial try, gave me the line, and then the next items , followed by the next line, etc... exp =

Re: Languages for different purposes (was Re: New user's initial thoughts / criticisms of Python)

2013-11-09 Thread Chris Angelico
On Sun, Nov 10, 2013 at 12:05 PM, Mark Lawrence breamore...@yahoo.co.uk wrote: I'd forgotten I'd used Monk back around 1999/2000. I couldn't remember much about it so just looked it up here http://docs.oracle.com/cd/E18867_01/SRE/Monk_Reference_SRE.pdf, not sure if it's double or triple yuck.

Re: Languages for different purposes (was Re: New user's initial thoughts / criticisms of Python)

2013-11-09 Thread Mark Janssen
On Sat, Nov 9, 2013 at 2:58 PM, Chris Angelico ros...@gmail.com wrote: So, on what basis _would_ you choose a language for some purpose? Without speaking specifically of web development here, how do you choose a language? Most generally, you choose a language informed by the language

Re: When I send email as HTML, why do erroneous whitespaces get introduced to the HTML source and a few chars get converted to lt; and gt; ???

2013-11-09 Thread Walter Hurry
On Fri, 08 Nov 2013 14:06:38 -0800, richard.balbat wrote: I have the following script that reads in an HTML file containing a table then sends it out via email with a content type of text/html. For some reason a few erroneous whitespaces get introduced to the HTML source and a few chars

Re: pywin32 programming error on Win7 with shell.SHGetDesktopFolder, desktop.BindToObject, desktop.GetDisplayNameOf

2013-11-09 Thread iMath
thanks, I found out the reason: this question has no relationship with Win7 or WinXP,but related to the users' system setting . GetDisplayNameOf() only gives the DISPLAY name ,so the filename with or without extension acording to whether the user want to view files in the explorer with

Re: chunking a long string?

2013-11-09 Thread Steven D'Aprano
On Sun, 10 Nov 2013 09:14:28 +1100, Chris Angelico wrote: And as is typical of python-list, it's this extremely minor point that became the new course of the thread - You say that as if it were a bad thing :-P my main point was not whether all, some, or no strings get interned, but that

[issue19532] compileall -f doesn't force to write bytecode files

2013-11-09 Thread Ned Deily
Ned Deily added the comment: Looking at the compileall module, it appears that -f and options other than -b have never (or, at least, for a long time, not) been supported when directories or files are not supplied and it defaults to directories from sys.path. Note the call in main() to

[issue19534] normalize() in locale.py fails for sr_RS.UTF-8@latin

2013-11-09 Thread Mike FABIAN
New submission from Mike FABIAN: Originally reported here: https://bugzilla.redhat.com/show_bug.cgi?id=1024667 I found that Serbian translations in Latin do not work when the locale name is written as sr_RS.UTF-8@latin (one gets the cyrillic translations instead), but they *do* work when the

[issue19534] normalize() in locale.py fails for sr_RS.UTF-8@latin

2013-11-09 Thread Mike FABIAN
Mike FABIAN added the comment: The problem turns out to be caused by a problem in normalizing the locale name, see the output of this test program: mfabian@ari:~ $ cat ~/tmp/mike-test.py #!/usr/bin/python2 import sys import os import locale import encodings import encodings.aliases

[issue19534] normalize() in locale.py fails for sr_RS.UTF-8@latin

2013-11-09 Thread Mike FABIAN
Mike FABIAN added the comment: A simple fix for that problem could look like this: mfabian@ari:~ $ diff -u /usr/lib64/python2.7/locale.py.orig /usr/lib64/python2.7/locale.py --- /usr/lib64/python2.7/locale.py.orig 2013-11-09 09:08:24.807331535 +0100 +++ /usr/lib64/python2.7/locale.py

[issue19534] normalize() in locale.py fails for sr_RS.UTF-8@latin

2013-11-09 Thread Mike FABIAN
Mike FABIAN added the comment: in locale.py, the comment above “locale_alias = {” says: # Note that the normalize() function which uses this tables # removes '_' and '-' characters from the encoding part of the # locale name before doing the lookup. This saves a lot of # space in the table.

[issue19534] normalize() in locale.py fails for sr_RS.UTF-8@latin

2013-11-09 Thread Mike FABIAN
Mike FABIAN added the comment: I think the patch I attach here is a better fix than the patch in http://bugs.python.org/msg202469 because it makes the normalize() function behave more logical overall, with this patch, my test program prints: mfabian@ari:/local/mfabian/src/cpython (2.7-mike %) $

[issue19534] normalize() in locale.py fails for sr_RS.UTF-8@latin

2013-11-09 Thread Mike FABIAN
Mike FABIAN added the comment: The patch http://bugs.python.org/file32552/0001-Issue-19534-fix-normalize-in-locale.py-to-make-it-wo.patch is against the current HEAD of the 2.7 branch, but Python 3.3 has exactly the same problem, the same patch fixes it for python 3.3 as well. --

[issue19534] normalize() in locale.py fails for sr_RS.UTF-8@latin

2013-11-09 Thread Serhiy Storchaka
Serhiy Storchaka added the comment: Seems this is a duplicate of issue5815. -- nosy: +serhiy.storchaka superseder: - locale.getdefaultlocale() missing corner case ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue19534

[issue18907] urllib2.open FTP open times out at 20 secs despite timeout parameter

2013-11-09 Thread Charles-François Natali
Changes by Charles-François Natali cf.nat...@gmail.com: -- resolution: - wont fix stage: - committed/rejected status: open - closed ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue18907 ___

[issue19533] Unloading docstrings from memory if -OO is given

2013-11-09 Thread Serhiy Storchaka
Serhiy Storchaka added the comment: Some tests fail when ran with -OO and then with -O. Short example (there are more examples): $ rm -rf Lib/test/__pycache__ $ ./python -OO -m test.regrtest test_property [1/1] test_property 1 test OK. $ ./python -O -m test.regrtest test_property [1/1]

[issue19531] Loading -OO bytecode files if -O was requested can lead to problems

2013-11-09 Thread Serhiy Storchaka
Serhiy Storchaka added the comment: Some tests fail when ran with -OO and then with -O. Short example (there are more examples): $ rm -rf Lib/test/__pycache__ $ ./python -OO -m test.regrtest test_property [1/1] test_property 1 test OK. $ ./python -O -m test.regrtest test_property [1/1]

[issue19533] Unloading docstrings from memory if -OO is given

2013-11-09 Thread Serhiy Storchaka
Changes by Serhiy Storchaka storch...@gmail.com: -- Removed message: http://bugs.python.org/msg202474 ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue19533 ___

[issue19533] Unloading docstrings from memory if -OO is given

2013-11-09 Thread Serhiy Storchaka
Changes by Serhiy Storchaka storch...@gmail.com: -- components: -Tests type: behavior - enhancement versions: -Python 3.3, Python 3.4 ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue19533

[issue19533] Unloading docstrings from memory if -OO is given

2013-11-09 Thread Serhiy Storchaka
Changes by Serhiy Storchaka storch...@gmail.com: -- versions: +Python 3.3 -Python 2.7 ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue19533 ___ ___

[issue19535] Test failures with -OO

2013-11-09 Thread Serhiy Storchaka
New submission from Serhiy Storchaka: $ ./python -OO -m test.regrtest test_docxmlrpc test_functools test_inspect test_pkg [1/4] test_docxmlrpc test test_docxmlrpc failed -- Traceback (most recent call last): File /home/serhiy/py/cpython/Lib/test/test_docxmlrpc.py, line 210, in

[issue19535] Test failures with -OO

2013-11-09 Thread Serhiy Storchaka
Serhiy Storchaka added the comment: Failure of test_pkg is sporadic. $ ./python -OO -m test.regrtest test_pkg [1/1] test_pkg test test_pkg failed -- Traceback (most recent call last): File /home/serhiy/py/cpython/Lib/test/test_pkg.py, line 259, in test_7 '__name__', '__package__',

[issue11849] glibc allocator doesn't release all free()ed memory

2013-11-09 Thread STINNER Victor
STINNER Victor added the comment: Extract of the workaround section: You could also run your Python jobs using Jython, which uses the Java JVM and does not exhibit this behavior. Likewise, you could upgrade to Python 3.3 http://bugs.python.org/issue11849, Which contains a link to this issue.

[issue19504] Change customise to customize.

2013-11-09 Thread Tshepang Lekhonkhobe
Changes by Tshepang Lekhonkhobe tshep...@gmail.com: -- nosy: +tshepang ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue19504 ___ ___

[issue19532] compileall -f doesn't force to write bytecode files

2013-11-09 Thread Vajrasky Kok
Vajrasky Kok added the comment: Attached the patch to fix the problem. I did not modify the unit test because the bug was located in the __main__ part of Lib/compileall. -- keywords: +patch nosy: +vajrasky Added file: http://bugs.python.org/file32553/compileall_force.patch

[issue19536] MatchObject should offer __getitem__()

2013-11-09 Thread Brandon Rhodes
New submission from Brandon Rhodes: Regular expression re.MatchObject objects are sequences. They contain at least one “group” string, possibly more, which are integer-indexed starting at zero. Today, groups can be accessed in one of two ways. (1) You can call the method match.group(N). (2)

[issue19536] MatchObject should offer __getitem__()

2013-11-09 Thread Brandon Rhodes
Changes by Brandon Rhodes bran...@rhodesmill.org: -- versions: +Python 3.4 -Python 3.5 ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue19536 ___ ___

[issue19536] MatchObject should offer __getitem__()

2013-11-09 Thread Ezio Melotti
Ezio Melotti added the comment: This is something that the regex module already has, and since it is/was supposed to replace the re module in stdlib, I've been holding off to add to re for a long time. We also discussed this recently on #python-dev, and I think it's OK to add it, as long as

[issue18864] Implementation for PEP 451 (importlib.machinery.ModuleSpec)

2013-11-09 Thread Brett Cannon
Brett Cannon added the comment: I don't quite know what you mean by current functional changes in the clone. Is this changes to import to use exec_module() and such? Just a guess since step 3 suggests there are no loaders implementing the new API currently. As for the tests, I'm hoping that

[issue18864] Implementation for PEP 451 (importlib.machinery.ModuleSpec)

2013-11-09 Thread Brett Cannon
Brett Cannon added the comment: I should clarify why I want a clarification on step 1. On Friday my current plan (barring other bugs I need to squash for b1) is to just start working on the pep-451 repo and I want a TODO list to follow in this issue so I don't have to waste time trying to

[issue19531] Loading -OO bytecode files if -O was requested can lead to problems

2013-11-09 Thread Brett Cannon
Brett Cannon added the comment: This is a known problem and has been brought up over the years. Discussions have typically revolved around expanding the .pyc format to encode what optimizations were used so if the interpreter was using different optimizations it would not use the bytecode.

[issue19533] Unloading docstrings from memory if -OO is given

2013-11-09 Thread Brett Cannon
Brett Cannon added the comment: Do realize this is a one-time memory cost, though, because next execution will load from the .pyo and thus will never load the docstring into memory. If you pre-compile all bytecode with -OO this will never even occur. -- nosy: +brett.cannon

[issue19533] Unloading docstrings from memory if -OO is given

2013-11-09 Thread Sworddragon
Sworddragon added the comment: Do realize this is a one-time memory cost, though, because next execution will load from the .pyo and thus will never load the docstring into memory. Except in 2 cases: - The bytecode was previously generated with -O. - The bytecode couldn't be written (for

  1   2   >