RE: Java versus Python

  • From: "Sina Bahram" <sbahram@xxxxxxxxx>
  • To: <programmingblind@xxxxxxxxxxxxx>
  • Date: Mon, 20 Jun 2011 15:09:08 -0400

Uhm, no, you don't get function overloading at all, what-so-ever, in any way 
shape or form.

You get a holy mess because, exactly as he pointed out, you then have to have 
if statements inside of your method to figure out
whether the value is the default value or not.

Sorry, but this isn't overloading at all. It's simply default parameters.

Take care,
Sina


-----Original Message-----
From: programmingblind-bounce@xxxxxxxxxxxxx 
[mailto:programmingblind-bounce@xxxxxxxxxxxxx] On Behalf Of Ken Perry
Sent: Monday, June 20, 2011 1:53 PM
To: programmingblind@xxxxxxxxxxxxx
Subject: RE: Java versus Python


No not dictionaries named  variables.  For example

Def myfunc (stringArg="my string",intArg=1):
  Print "%d %s" % (intArg,StringArg)

Then you can do 

myFunc(stringArg="blah")
myFunc(intArg=5)
myfunc("blah",9)

So you get kind of a function overloading 

Ken

-----Original Message-----
From: programmingblind-bounce@xxxxxxxxxxxxx
[mailto:programmingblind-bounce@xxxxxxxxxxxxx] On Behalf Of Homme, James
Sent: Monday, June 20, 2011 1:25 PM
To: programmingblind@xxxxxxxxxxxxx
Subject: RE: Java versus Python

Hi Ken,
Are you talking about dictionaries or something else? I tried to google this
and I'm unsure if I'm reading the right stuff.

Thanks.

Jim

-----Original Message-----
From: programmingblind-bounce@xxxxxxxxxxxxx
[mailto:programmingblind-bounce@xxxxxxxxxxxxx] On Behalf Of Ken Perry
Sent: Monday, June 20, 2011 12:27 PM
To: programmingblind@xxxxxxxxxxxxx
Subject: RE: Java versus Python

This is not true with python and named variables.

Ken

-----Original Message-----
From: programmingblind-bounce@xxxxxxxxxxxxx
[mailto:programmingblind-bounce@xxxxxxxxxxxxx] On Behalf Of black ares
Sent: Monday, June 20, 2011 12:21 PM
To: programmingblind@xxxxxxxxxxxxx
Subject: Re: Java versus Python

Another problem I've meet with weak typing is polymorphism.
If I want a behavior for a int value and other behavior for a string value,
I can not write same method with diferent arguments and different behaviors.
I am left only with the optionto write two different methods and to do ugly 
if else statements.

----- Original Message ----- 
From: "Sina Bahram" <sbahram@xxxxxxxxx>
To: <programmingblind@xxxxxxxxxxxxx>
Sent: Monday, June 20, 2011 2:51 PM
Subject: RE: Java versus Python


> There are two issues, just so we don't' conflate them.
>
> One is the issue of the grammar in question, and the second is the parser 
> for this grammar.
>
> So, the grammar for java uses left/right brace for block level scoping, 
> and the grammar for python uses indention level.
>
> Short humorous aside, everyone says indentation instead of indention, but 
> isn't indentation what you actually do to someone's head
> in a fight, not to your code? Sorry, I love grammars, regardless of 
> context, *smile*, pun intended.
>
> Ok, so if one were to simply say that missing a space is like forgetting a

> brace, then, everything else being equal, it would be a
> similar error; however, it isn't exactly the same thing. Spacing for 
> indention purposes happens on a line by line basis, as opposed
> to the one time operation that is putting, or not putting, an 
> opening/closing brace.
>
> Also, forgetting a closing brace leaves a block of code open, and 
> forgetting a space instead closes a block.
>
> Ok, so now if we have some code, if I forget a closing brace, that's not 
> fun, but it's at least pretty easy to detect because
> chances are that I'll open a method declaration or do something else that 
> doesn't happen inside of a block.
>
> If I forget a space, i simply close the block, so a bug can stay there 
> forever, because all that's happened is that I've simply
> closed it one line too soon, or maybe a few lines too soon ... so that 
> code still runs, but maybe just not on the conditional I
> want, or maybe it overrides a value.
>
> In other words, I'm putting forth that forgetting a closing brace is 
> actually more destructive than forgetting a space, but because
> of this, the parser quickly ends up finding something that is an illegal 
> syntax error or just something at the semantic level that
> doesn't make sense, and so there's a much higher chance of you finding out

> about it before you ever come to run your program even
> once.
>
> That, I hope, addresses the issue of grammars.
>
> Now, moving onto parsers.
>
> The parser for Python, I feel, and this is subjective, doesn't give as 
> good feedback to the programmer as the java one does. The
> reason for this really isn't the python guys' fault, at least not always, 
> and that's because of a lack of typing. Because of this,
> sometimes error messages are perceived as vague and not useful.
>
> In java, alternatively, the compiler knows exactly what its expecting, 
> what would even make the code syntactically correct, and so
> not only can it give you feedback along the lines of an argument being of 
> a wrong type, but tell you what it was thinking should go
> there instead.
>
> Anyways, just some thoughts.
>
>
> Take care,
> Sina
>
>
>
>
>
>
>
> -----Original Message-----
> From: programmingblind-bounce@xxxxxxxxxxxxx 
> [mailto:programmingblind-bounce@xxxxxxxxxxxxx] On Behalf Of Homme, James
> Sent: Monday, June 20, 2011 7:25 AM
> To: programmingblind@xxxxxxxxxxxxx
> Subject: RE: Java versus Python
>
> Hi,
> What would Java have done in a case like this? According to me, this would

> be a logic error whether or not it had anything to do
> with indentation. I would think that it would be very easy to miss a right

> brace at the end of a code block. This would especially
> be true since Java allows you to have a single statement without using a 
> right brace. It could be that I am missing something here
> in my thinking.
>
> Jim
>
> -----Original Message-----
> From: programmingblind-bounce@xxxxxxxxxxxxx 
> [mailto:programmingblind-bounce@xxxxxxxxxxxxx] On Behalf Of Ken Perry
> Sent: Saturday, June 18, 2011 12:22 AM
> To: programmingblind@xxxxxxxxxxxxx
> Subject: RE: Java versus Python
>
> This is true while I won't get into the what language is better since I
> write in too many in my job to even want to have an opinion people need to
> realize that miss placed spaces are nothing like context problems in other
> languages.  If you miss place a block of spaced lines you don't just cause
> an error in the code.  In fact the code might run along happily with no
> errors but the code won't do what you want.  This is one of the down falls
> of python.  There was actually a bug in the Icon and Braille+ that has 
> been
> out for years that we only just recently found because of this very fact.
> One of the sighted guys that works on the project even missed it because 
> the
> block of 10 lines of code just looked like it was supposed to be out there
> on its own.
>
> Ken
>
>
>
> -----Original Message-----
> From: programmingblind-bounce@xxxxxxxxxxxxx
> [mailto:programmingblind-bounce@xxxxxxxxxxxxx] On Behalf Of John J. Boyer
> Sent: Friday, June 17, 2011 11:38 PM
> To: programmingblind@xxxxxxxxxxxxx
> Subject: Re: Java versus Python
>
> The mandatory indentation in Python means that a single misplaced 
> whitespace
> can entirely destroy a program. This is not very robust. C programmers
> usually make sure their code is nicely indented by using a utility like 
> the
> Gnu indent. I'm still looking for something similar for Java. Manual
> indentation is too error-prone.
>
> John
>
> On Fri, Jun 17, 2011 at 08:32:55PM -0600, Littlefield, Tyler wrote:
>> Java uses it's indentation much like braces are used. It's not where
>> things have to be in specific columns, but indentation sort of solves
>> a couple problems.
>> 1) It means that all blocks of code are denoted by a deeper
>> indentation level than the block that branched it.
>> 2) It also means that people usually stick to a nice style. I've seen
>> a lot of different code, for example:
>> while (bla)
>> do_something();
>> while (bla) {
>> do_something
>> }
>> while (bla)
>> {
>> do_something();
>> }
>>
>> Indentation can be a bit hard to get used to, but I personally like it
>> quite a lot.
>> On 6/17/2011 8:30 PM, John J. Boyer wrote:
>> >The thing I dislike about Python is mandatory indentation. This seems
>> >to me a throwback to the old days of assembly language and Cobol,
>> >where things had to be in certain columns. I like the free-form
>> >syntax of Java and C.
>> >
>> >John
>> >
>> >On Fri, Jun 17, 2011 at 07:15:55PM -0700, David Tseng wrote:
>> >>I personally find arguments about programming languages much
>> >>analogous to those seen in politics.  Both sides have great points
>> >>but tend to drive one another towards opposite extremes.  Some camps
>> >>are die hard dynamic language practitioners while others stick to
>> >>strongly typed code.
>> >>
>> >>I will say that strongly typed languages have kind of won the battle
>> >>historically.  Most of the industry writes in C-styled languages
>> >>like C/C++, java, etc.  Lisp, still beloved by many, kind of lost.
>> >>Python, as many have shown, works wonderfully and frees up coders to
>> >>actually code, is still largely a wrapper on C.  For those who want
>> >>absolute performance, it's considered still an extra level of
>> >>indirection that's not worth the productivity gain.
>> >>
>> >>I love python and its free-form style and the amount of progress you
>> >>can make using it.  Python excels at the rinse and repeat (compile,
>> >>run, fix) style of coding.  The few seconds you need to compile a
>> >>C-styled language and run, you're already fixing the bug in python.
>> >>You're not babied into writing object-oriented code ala java, but
>> >>can independently mix in functional aspects if you wish.  You can
>> >>just as easily go OO if you want as well.
>> >>
>> >>
>> >>
>> >>On 6/17/11, Alex Hall<mehgcap@xxxxxxxxx>  wrote:
>> >>>Programming is certainly a matter of preference in most situations.
>> >>>I would probably give up if the only option were php, since I
>> >>>really hate that language (no offense to anyone). Java is easy
>> >>>enough, but I agree that it feels bulky at times. I like Python's
>> >>>ease of use and readability, plus you can create executables with
>> >>>it, something that is difficult in java. Some people don't like
>> >>>that python is loosely typed, but I prefer saying:
>> >>>name=raw_input("Enter your name: ") to, if memory serves:
>> >>>name=new String();
>> >>>in=new InputReader();
>> >>>name=in.readLine();
>> >>>or something along those lines.
>> >>>
>> >>>On 6/17/11, Littlefield, Tyler<tyler@xxxxxxxxxxxxx>  wrote:
>> >>>>I've used both. I really like python because it comes on most *nix
>> >>>>systems. I also like Python because of it's flexability and
> versatility.
>> >>>>Java is nice enough, but it feels big bulky and clunky to me. That
>> >>>>and they seem to have some serious naming convention issues.
>> >>>>Sometimes things are capitalized, sometimes they're not--.net makes
> more sense.
>> >>>>On 6/17/2011 6:49 PM, John J. Boyer wrote:
>> >>>>>There has been a lot of discussion on the list lately about
>> >>>>>Python. Why is that?Personally i much prefer Java. Its syntx
>> >>>>>makes a lot more sense and it is just as powerful, if not more. A
>> >>>>>command-line build system like ant can take most of the hassle out 
>> >>>>>of
> working with Java classes.
>> >>>>>personally, I prefer this to Eclipse.
>> >>>>>
>> >>>>>BrailleBlaster is written in Java. I am using openjdk-1.6,
>> >>>>>Eclipse SWT and Apache Ant.
>> >>>>>
>> >>>>>John
>> >>>>>
>> >>>>
>> >>>>--
>> >>>>
>> >>>>Take care,
>> >>>>Ty
>> >>>>my website:
>> >>>>http://tds-solutions.net
>> >>>>my blog:
>> >>>>http://tds-solutions.net/blog
>> >>>>skype: st8amnd127
>> >>>>My programs don't have bugs; they're randomly added features!
>> >>>>
>> >>>>__________
>> >>>>View the list's information and change your settings at
>> >>>>//www.freelists.org/list/programmingblind
>> >>>>
>> >>>>
>> >>>
>> >>>--
>> >>>Have a great day,
>> >>>Alex (msg sent from GMail website)
>> >>>mehgcap@xxxxxxxxx; http://www.facebook.com/mehgcap __________ View
>> >>>the list's information and change your settings at
>> >>>//www.freelists.org/list/programmingblind
>> >>>
>> >>>
>> >>__________
>> >>View the list's information and change your settings at
>> >>//www.freelists.org/list/programmingblind
>>
>>
>> --
>>
>> Take care,
>> Ty
>> my website:
>> http://tds-solutions.net
>> my blog:
>> http://tds-solutions.net/blog
>> skype: st8amnd127
>> My programs don't have bugs; they're randomly added features!
>>
>> __________
>> View the list's information and change your settings at
>> //www.freelists.org/list/programmingblind
>
> --
> John J. Boyer; President, Chief Software Developer Abilitiessoft, Inc.
> http://www.abilitiessoft.com
> Madison, Wisconsin USA
> Developing software for people with disabilities
>
> __________
> View the list's information and change your settings at
> //www.freelists.org/list/programmingblind
>
> __________
> View the list's information and change your settings at
> //www.freelists.org/list/programmingblind
>
>
> This e-mail and any attachments to it are confidential and are intended 
> solely for use of the individual or entity to whom they are
> addressed.  If you have received this e-mail in error, please notify the 
> sender immediately and then delete it.  If you are not the
> intended recipient, you must not keep, use, disclose, copy or distribute 
> this e-mail without the author's prior permission.  The
> views expressed in this e-mail message do not necessarily represent the 
> views of Highmark Inc., its subsidiaries, or affiliates.
> __________
> View the list's information and change your settings at
> //www.freelists.org/list/programmingblind
>
> __________
> View the list's information and change your settings at
> //www.freelists.org/list/programmingblind
> 

__________
View the list's information and change your settings at 
//www.freelists.org/list/programmingblind

__________
View the list's information and change your settings at 
//www.freelists.org/list/programmingblind

__________
View the list's information and change your settings at 
//www.freelists.org/list/programmingblind

__________
View the list's information and change your settings at 
//www.freelists.org/list/programmingblind

__________
View the list's information and change your settings at 
//www.freelists.org/list/programmingblind

Other related posts: