Re: Number of languages known [was Re: Python is readable] - somewhat OT

2012-03-29 Thread Nathan Rice
>> Here's a thought experiment.  Imagine that you have a project tree on >> your file system which includes files written in many different >> programming languages.  Imagine that the files can be assumed to be >> contiguous for our purposes, so you could view all the files in the >> project as one

Re: Python is readable

2012-03-29 Thread Nathan Rice
>>> He did no such thing. I challenge you to find me one place where Joel >>> has *ever* claimed that "the very notion of abstraction" is meaningless >>> or without use. > [snip quote] >> To me, this directly indicates he views higher order abstractions >> skeptically, > > Yes he does, and so we al

Re: Python is readable

2012-03-29 Thread Steven D'Aprano
On Thu, 29 Mar 2012 22:26:38 -0400, Nathan Rice wrote: >> He did no such thing. I challenge you to find me one place where Joel >> has *ever* claimed that "the very notion of abstraction" is meaningless >> or without use. [snip quote] > To me, this directly indicates he views higher order abstract

Re: unittest: assertRaises() with an instance instead of a type

2012-03-29 Thread Steven D'Aprano
On Thu, 29 Mar 2012 08:35:16 -0700, Ethan Furman wrote: > Steven D'Aprano wrote: >> On Wed, 28 Mar 2012 14:28:08 +0200, Ulrich Eckhardt wrote: >> >>> Hi! >>> >>> I'm currently writing some tests for the error handling of some code. >>> In this scenario, I must make sure that both the correct exce

Re: unittest: assertRaises() with an instance instead of a type

2012-03-29 Thread Steven D'Aprano
On Thu, 29 Mar 2012 09:08:30 +0200, Ulrich Eckhardt wrote: > Am 28.03.2012 20:07, schrieb Steven D'Aprano: >> Secondly, that is not the right way to do this unit test. You are >> testing two distinct things, so you should write it as two separate >> tests: > [..code..] >> If foo does *not* raise a

Re: Python is readable

2012-03-29 Thread Nathan Rice
> He did no such thing. I challenge you to find me one place where Joel has > *ever* claimed that "the very notion of abstraction" is meaningless or > without use. "When great thinkers think about problems, they start to see patterns. They look at the problem of people sending each other word-proc

Re: Number of languages known [was Re: Python is readable] - somewhat OT

2012-03-29 Thread Steven D'Aprano
On Thu, 29 Mar 2012 13:48:40 -0400, Nathan Rice wrote: > Here's a thought experiment. Imagine that you have a project tree on > your file system which includes files written in many different > programming languages. Imagine that the files can be assumed to be > contiguous for our purposes, so y

Re: Number of languages known [was Re: Python is readable] - somewhat OT

2012-03-29 Thread Nathan Rice
On Thu, Mar 29, 2012 at 7:37 PM, Devin Jeanpierre wrote: > On Thu, Mar 29, 2012 at 3:50 PM, Nathan Rice > wrote: >> Well, a lisp-like language.  I would also argue that if you are using >> macros to do anything, the thing you are trying to do should classify >> as "not natural in lisp" :) > > You

Re: Python is readable

2012-03-29 Thread Steven D'Aprano
On Thu, 29 Mar 2012 14:37:09 -0400, Nathan Rice wrote: > On Thu, Mar 29, 2012 at 9:44 AM, Albert van der Horst > wrote: >> In article , Nathan >> Rice   wrote: http://www.joelonsoftware.com/articles/fog18.html > Of course, I will give Joel one point: too many things related to

Re: "convert" string to bytes without changing data (encoding)

2012-03-29 Thread Steven D'Aprano
On Thu, 29 Mar 2012 11:30:19 -0400, Ross Ridge wrote: > Steven D'Aprano wrote: >>Your reaction is to make an equally unjustified estimate of Evan's >>mindset, namely that he is not just wrong about you, but *deliberately >>and maliciously* lying about you in the full knowledge that he is wrong.

Re: "convert" string to bytes without changing data (encoding)

2012-03-29 Thread Steven D'Aprano
On Thu, 29 Mar 2012 17:36:34 +, Prasad, Ramit wrote: >> > Technically, ASCII goes up to 256 but they are not A-z letters. >> > >> Technically, ASCII is 7-bit, so it goes up to 127. > >> No, ASCII only defines 0-127. Values >=128 are not ASCII. >> >> >From https://en.wikipedia.org/wiki/ASCII

Re: Number of languages known [was Re: Python is readable] - somewhat OT

2012-03-29 Thread Devin Jeanpierre
On Thu, Mar 29, 2012 at 3:50 PM, Nathan Rice wrote: > Well, a lisp-like language.  I would also argue that if you are using > macros to do anything, the thing you are trying to do should classify > as "not natural in lisp" :) You would run into disagreement. Some people feel that the lisp philoso

Re: Number of languages known [was Re: Python is readable] - somewhat OT

2012-03-29 Thread Devin Jeanpierre
On Thu, Mar 29, 2012 at 4:33 PM, Chris Angelico wrote: > Of course it's POSSIBLE. You can write everything in Ook if you want > to. But any attempt to merge all programming languages into one will > either: In that particular quote, I was saying that the reason that you claimed we can't merge lan

RE: Number of languages known [was Re: Python is readable] - somewhat OT

2012-03-29 Thread Prasad, Ramit
> >> You can't merge all of them without making a language that's > >> suboptimal at most of those tasks - probably, one that's woeful at all > >> of them. I mention SQL because, even if you were to unify all > >> programming languages, you'd still need other non-application > >> languages to get t

RE: Advise of programming one of my first programs

2012-03-29 Thread Prasad, Ramit
>>From the Zen of Python, "Simple is better than complex." It is a good >>programming mentality. >Complex is better than complicated. :p Absolutely! Too bad your version would be considered the more “complicated” version ;) >With the main navigation menu I will only have the option to select a

Re: Python is readable

2012-03-29 Thread Nathan Rice
On Thu, Mar 29, 2012 at 9:44 AM, Albert van der Horst wrote: > In article , > Nathan Rice   wrote: >>> >>> http://www.joelonsoftware.com/articles/fog18.html >> >>I read that article a long time ago, it was bullshit then, it is >>bullshit now.  The only thing he gets right is that the Shann

Re: "convert" string to bytes without changing data (encoding)

2012-03-29 Thread Chris Angelico
On Fri, Mar 30, 2012 at 5:00 AM, Ross Ridge wrote: > Sorry, it would've been more accurate to label the flavour of kool-aid > Chris Angelico was trying to push as "it's impossible ... without > encoding": > >        What is a string? It's not a series of bytes. You can't convert >        it withou

Re: Number of languages known [was Re: Python is readable] - somewhat OT

2012-03-29 Thread Chris Angelico
On Fri, Mar 30, 2012 at 3:42 AM, Devin Jeanpierre wrote: > On Thu, Mar 29, 2012 at 10:03 AM, Chris Angelico wrote: >> You can't merge all of them without making a language that's >> suboptimal at most of those tasks - probably, one that's woeful at all >> of them. I mention SQL because, even if y

Re: Number of languages known [was Re: Python is readable] - somewhat OT

2012-03-29 Thread Nathan Rice
On Thu, Mar 29, 2012 at 2:53 PM, Devin Jeanpierre wrote: > Agreed with your entire first chunk 100%. Woohoo! High five. :) Damn, then I'm not trolling hard enough ಠ_ಠ > On Thu, Mar 29, 2012 at 1:48 PM, Nathan Rice > wrote: >> transformations on lists of data are natural in Lisp, but graph >> tr

Re: Number of languages known [was Re: Python is readable] - somewhat OT

2012-03-29 Thread Devin Jeanpierre
Agreed with your entire first chunk 100%. Woohoo! High five. :) On Thu, Mar 29, 2012 at 1:48 PM, Nathan Rice wrote: > transformations on lists of data are natural in Lisp, but graph > transformations are not, making some things awkward. Eh, earlier you make some argument towards lisp being a uni

Re: Number of languages known [was Re: Python is readable] - somewhat OT

2012-03-29 Thread Tim Chase
On 03/29/12 12:48, Nathan Rice wrote: Of course, this describes Lisp to some degree, so I still need to provide some answers. What is wrong with Lisp? I would say that the base syntax being horrible is probably the biggest issue. Do you mean something like: ((so (describes Lisp (to degree so

Re: errors building python 2.7.3

2012-03-29 Thread David Robinow
On Thu, Mar 29, 2012 at 6:55 AM, Alexey Luchko wrote: > On 28.03.2012 18:42, David Robinow wrote: >> On Wed, Mar 28, 2012 at 7:50 AM, Alexey Luchko  wrote: >>> I've tried to build Python 2.7.3rc2 on cygwin and got the following >>> errors: >>> >>> $ CFLAGS=-I/usr/include/ncursesw/ CPPFLAGS=-I/usr/

Re: "convert" string to bytes without changing data (encoding)

2012-03-29 Thread Ross Ridge
Ross Ridge wrote: > Just because I refuse to drink the > "it's impossible to represent strings as a series of bytes" kool-aid Terry Reedy wrote: >I do not believe *anyone* has made that claim. Is this meant to be a >wild exaggeration? As wild as Evan's? Sorry, it would've been more accurate to

Re: Number of languages known [was Re: Python is readable] - somewhat OT

2012-03-29 Thread Nathan Rice
On Thu, Mar 29, 2012 at 10:03 AM, Chris Angelico wrote: > On Fri, Mar 30, 2012 at 12:44 AM, Nathan Rice > wrote: >> We would be better off if all the time that was spent on learning >> syntax, memorizing library organization and becoming proficient with >> new tools was spent learning the mathema

RE: "convert" string to bytes without changing data (encoding)

2012-03-29 Thread Prasad, Ramit
> > Technically, ASCII goes up to 256 but they are not A-z letters. > > > Technically, ASCII is 7-bit, so it goes up to 127. > No, ASCII only defines 0-127. Values >=128 are not ASCII. > > >From https://en.wikipedia.org/wiki/ASCII: > > ASCII includes definitions for 128 characters: 33 are non

RE: RE: Advise of programming one of my first programs

2012-03-29 Thread Prasad, Ramit
From: Anatoli Hristov [mailto:toli...@gmail.com] Sent: Wednesday, March 28, 2012 5:36 PM To: Prasad, Ramit Cc: python-list@python.org Subject: Re: RE: Advise of programming one of my first programs >>> > Um, at least by my understanding, the use of Pickle is also dangerous if you >>> > are n

Re: "convert" string to bytes without changing data (encoding)

2012-03-29 Thread Terry Reedy
On 3/29/2012 11:30 AM, Ross Ridge wrote: No, Evan in his own words admitted that his post was ment to be harsh, I agree that he should have restrained and censored his writing. Just because I refuse to drink the > "it's impossible to represent strings as a series of bytes" kool-aid I do no

Re: Number of languages known [was Re: Python is readable] - somewhat OT

2012-03-29 Thread Devin Jeanpierre
On Thu, Mar 29, 2012 at 10:03 AM, Chris Angelico wrote: > You can't merge all of them without making a language that's > suboptimal at most of those tasks - probably, one that's woeful at all > of them. I mention SQL because, even if you were to unify all > programming languages, you'd still need

Re: Re: Re: Re: "convert" string to bytes without changing data (encoding)

2012-03-29 Thread Evan Driscoll
On 01/-10/-28163 01:59 PM, Ross Ridge wrote: Evan Driscoll wrote: People like you -- who write to assumptions which are not even remotely guaranteed by the spec -- are part of the reason software sucks. ... This email is a bit harsher than it deserves -- but I feel not by much. I don't see

Re: question about file handling with "with"

2012-03-29 Thread Nobody
On Wed, 28 Mar 2012 11:31:21 +0200, Jabba Laci wrote: > Is the following function correct? Is the input file closed in order? > > def read_data_file(self): > with open(self.data_file) as f: > return json.loads(f.read()) Yes. The whole point of being able to use a file as a context m

Re: unittest: assertRaises() with an instance instead of a type

2012-03-29 Thread Ethan Furman
Steven D'Aprano wrote: On Wed, 28 Mar 2012 14:28:08 +0200, Ulrich Eckhardt wrote: Hi! I'm currently writing some tests for the error handling of some code. In this scenario, I must make sure that both the correct exception is raised and that the contained error code is correct: try:

Re: "convert" string to bytes without changing data (encoding)

2012-03-29 Thread Ross Ridge
Steven D'Aprano wrote: >Your reaction is to make an equally unjustified estimate of Evan's >mindset, namely that he is not just wrong about you, but *deliberately >and maliciously* lying about you in the full knowledge that he is wrong. No, Evan in his own words admitted that his post was men

Re: tabs/spaces

2012-03-29 Thread Terry Reedy
On 3/29/2012 3:18 AM, Ulrich Eckhardt wrote: Am 28.03.2012 20:26, schrieb Terry Reedy: On 3/28/2012 8:28 AM, Ulrich Eckhardt wrote: [...] # call testee and verify results try: ...call function here... except exception_type as e: if not exception is None: self.assertEqual(e, exception) Did yo

Re: tabs/spaces

2012-03-29 Thread Dave Angel
On 03/29/2012 03:18 AM, Ulrich Eckhardt wrote: Am 28.03.2012 20:26, schrieb Terry Reedy: On 3/28/2012 8:28 AM, Ulrich Eckhardt wrote: [...] # call testee and verify results try: ...call function here... except exception_type as e: if not exception is None: self.assertEqual(e, exception) Did

Re: unittest: assertRaises() with an instance instead of a type

2012-03-29 Thread Terry Reedy
On 3/29/2012 3:28 AM, Ulrich Eckhardt wrote: Equality comparison is by id. So this code will not do what you want. >>> Exception('foo') == Exception('foo') False Yikes! That was unexpected and completely changes my idea. Any clue whether this is intentional? Is identity the fallback when no

Re: "convert" string to bytes without changing data (encoding)

2012-03-29 Thread Peter Daum
On 2012-03-28 23:37, Terry Reedy wrote: > 2. Decode as if the text were latin-1 and ignore the non-ascii 'latin-1' > chars. When done, encode back to 'latin-1' and the non-ascii chars will > be as they originally were. ... actually, in the beginning of my quest, I ran into an decoding exception tr

Re: Number of languages known [was Re: Python is readable] - somewhat OT

2012-03-29 Thread Chris Angelico
On Fri, Mar 30, 2012 at 12:44 AM, Nathan Rice wrote: > We would be better off if all the time that was spent on learning > syntax, memorizing library organization and becoming proficient with > new tools was spent learning the mathematics, logic and engineering > sciences.  Those solve problems, l

Re: Python is readable

2012-03-29 Thread Albert van der Horst
In article , Nathan Rice wrote: >> >> http://www.joelonsoftware.com/articles/fog18.html > >I read that article a long time ago, it was bullshit then, it is >bullshit now. The only thing he gets right is that the Shannon >information of a uniquely specified program is proportional to the

Re: Number of languages known [was Re: Python is readable] - somewhat OT

2012-03-29 Thread Nathan Rice
On Wed, Mar 28, 2012 at 9:33 PM, Chris Angelico wrote: > On Thu, Mar 29, 2012 at 11:59 AM, Rodrick Brown > wrote: >> The best skill any developer can have is the ability to pickup languages >> very quickly and know what tools work well for which task. > > Definitely. Not just languages but all

Re: tabs/spaces (was: Re: unittest: assertRaises() with an instance instead of a type)

2012-03-29 Thread Roy Smith
In article <0ved49-hie@satorlaser.homedns.org>, Ulrich Eckhardt wrote: > I didn't consciously use tabs, actually I would rather avoid them. That > said, my posting looks correctly indented in my "sent" folder and also > in the copy received from my newsserver. What could also have an > in

Re: errors building python 2.7.3

2012-03-29 Thread Alexey Luchko
On 28.03.2012 18:42, David Robinow wrote: > On Wed, Mar 28, 2012 at 7:50 AM, Alexey Luchko wrote: >> I've tried to build Python 2.7.3rc2 on cygwin and got the following errors: >> >> $ CFLAGS=-I/usr/include/ncursesw/ CPPFLAGS=-I/usr/include/ncursesw/ >> ./configure > I haven't tried 2.7.3 yet,

Re: errors building python 2.7.3

2012-03-29 Thread Alexey Luchko
JFI Reported as http://bugs.python.org/issue14437 http://bugs.python.org/issue14438 -- Regars, Alex -- http://mail.python.org/mailman/listinfo/python-list

Nhung dieu ban can biet

2012-03-29 Thread Nguyen Van Hung
thanks, -- http://mail.python.org/mailman/listinfo/python-list

tabs/spaces (was: Re: unittest: assertRaises() with an instance instead of a type)

2012-03-29 Thread Ulrich Eckhardt
Am 28.03.2012 20:26, schrieb Terry Reedy: On 3/28/2012 8:28 AM, Ulrich Eckhardt wrote: [...] # call testee and verify results try: ...call function here... except exception_type as e: if not exception is None: self.assertEqual(e, exception) Did you use tabs? They do not get preserved indefini

Re: unittest: assertRaises() with an instance instead of a type

2012-03-29 Thread Ulrich Eckhardt
Am 28.03.2012 20:26, schrieb Terry Reedy: On 3/28/2012 8:28 AM, Ulrich Eckhardt wrote: with self.assertRaises(MyException(SOME_FOO_ERROR)): foo() I presume that if this worked the way you want, all attributes would have to match. The message part of builtin exceptions is allowed to change,

Re: unittest: assertRaises() with an instance instead of a type

2012-03-29 Thread Peter Otten
Ulrich Eckhardt wrote: > True. Normally. I'd adapting to a legacy system though, similar to > OSError, and that system simply emits error codes which the easiest way > to handle is by wrapping them. If you have err = some_func() if err: raise MyException(err) the effort to convert it to e

Re: unittest: assertRaises() with an instance instead of a type

2012-03-29 Thread Ulrich Eckhardt
Am 28.03.2012 20:07, schrieb Steven D'Aprano: First off, that is not Python code. "catch Exception" gives a syntax error. Old C++ habits... :| Secondly, that is not the right way to do this unit test. You are testing two distinct things, so you should write it as two separate tests: [..code

Re: unittest: assertRaises() with an instance instead of a type

2012-03-29 Thread Peter Otten
Ben Finney wrote: > Steven D'Aprano writes: > >> (By the way, I have to question the design of an exception with error >> codes. That seems pretty poor design to me. Normally the exception *type* >> acts as equivalent to an error code.) > > Have a look at Python's built-in OSError. The various