473,657 Members | 2,537 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Some notes

This is my first post here, I hope this is the right place to talk
about such things. I have few comments and notes on the Python
language. I've just started to learn it; this is negative because I'm
ignorant still, but it's also positive because I can still see details
that later probably I'll start to ignore.

Some of the functions of IPython seem good and simple, and I think
some of them can be integrated into the main Python line.

There are lots of different ways to make GUIs for Python programs, I
think that Gui4Cli (http://users.hol.gr/~dck/g4c/) is nice, and it can
be interesting to see it more integrated with Python. At the moment
there is only this interface, but it's not good:
http://users.hol.gr/~dck/g4c/dll/python.htm

Is Python3000 going to come eventually? It will break a lot of
compatibility, so it will be the right moment to change/fix other
things too. Here are some ideas (probably there are errors, but I hope
to learn from my mistakes):

- TABs can be accepted only inside comments.

- The optional static typing seems a quite nice thing (for compilers
too, they can produce faster code. It can probably allow faster and
smaller arrays, like those of numarray).

- The functional IF seems interesting, like:
if(cond, code1, code2)
(Or maybe a different syntax, that allows elseif too.)

- Functions containing yield can be defined in a different way, like:
generator name(params)
<code>
This idea comes from David Mertz:
http://www-106.ibm.com/developerwork....html?n-l-9271

- "mod" can substitute the % operator. This gives cleaner (but a bit
longer) code.

- The string Formatting like %(#)03d can be good for C programs, but
probably can be invented a much simpler and nicer syntax for a high
level language like Python (does string.Template from 2.4 solve
this?). (Python is "based" on C, but putting C syntax inside Python
sometimes seems a bad thing to me.)

Maybe the : at the end of some blocks can be removed or it can become
optional (but then the newline is probably necessary):
for i in <suite>: <code>

for i in <suite>
<code>

if <cond>
<code>
else
<code>

def name(params)
<code>

- Assigns and equal symbols seem wrong/misplaced. So:
== can become =
= can become <-
the <- is probably a more correct symbol, but it can produce problems:
b <- 6
b < -6
So maybe
== can become =
= can become :=
(This reminds me Pascal syntax.)
In time, Python seems to become more similar to the Mathematica (and
in IPython this is even explicit) ^_^

Bear hugs,
(Remove HUGS to mail me)
Jul 18 '05 #1
19 1668
ignorant still, but it's also positive because I can still see details
that later probably I'll start to ignore.
Or perhaps later you will understand why some of the things you stated
are not applicable.

Some of the functions of IPython seem good and simple, and I think
some of them can be integrated into the main Python line.
There is a standard way of doing this. One must submit a PEP for
language changes, and usually for modules.

There are lots of different ways to make GUIs for Python programs, I
think that Gui4Cli (http://users.hol.gr/~dck/g4c/) is nice, and it can
be interesting to see it more integrated with Python. At the moment
there is only this interface, but it's not good:
http://users.hol.gr/~dck/g4c/dll/python.htm
Python is, by accident, GUI ambiguous. You can use whatever GUI you
want that has a proper wrapper.

Python has been shipping with tk for quite a while now. If there were
going to be a change in toolkit, Guido has all but declared that
wxPython would be shipped with Python, not some Windows-only toolkit
that doesn't quite have critical mass.

Is Python3000 going to come eventually? It will break a lot of
compatibility, so it will be the right moment to change/fix other
things too. Here are some ideas (probably there are errors, but I hope
to learn from my mistakes):
Yeah, Py3k will eventually come, unless the world ends.
- TABs can be accepted only inside comments.
In Py3k, tabs are not going to be allowed as indentation to Python code.
Keeping them in strings and comments is a non-issue.

- The optional static typing seems a quite nice thing (for compilers
too, they can produce faster code. It can probably allow faster and
smaller arrays, like those of numarray).
Asking for static typing in Python is a pretty big request. It seems
from those responses to similar questions, the answer is simply "static
typing isn't coming to CPython any time soon, probably not even for Py3k".

Keep wishing, but unless you implement it, I wouldn't get my hopes up.

- The functional IF seems interesting, like:
if(cond, code1, code2)
(Or maybe a different syntax, that allows elseif too.)
Many variants have been proposed over the years, but none have ever made
it in.

Don't get your hopes up.

- Functions containing yield can be defined in a different way, like:
generator name(params)
<code>
This idea comes from David Mertz:
http://www-106.ibm.com/developerwork....html?n-l-9271
I don't see how that gains anything. The existance of a yield defines a
generator, and that article only mentions that perhaps 'generator' would
have been better. All of the discussion happened on another list, and
(from what I hear), Guido pronounced (before that article was ever
written), that a new name for 'def' didn't make sense.

- "mod" can substitute the % operator. This gives cleaner (but a bit
longer) code.
Don't get your hopes up. There does not exist a 'logical modulo'
operation, where as there does exist a 'binary modulo' operation. The
reason 'and' and '&', 'or' and '|' exist is because they have logical
and binary counterparts, with the ability to short-circuit execution
under certain circumstances.

A much better request would be for a logical xor, though it has the
unfortunate consequence of never being short-circuitable.

- The string Formatting like %(#)03d can be good for C programs, but
probably can be invented a much simpler and nicer syntax for a high
level language like Python (does string.Template from 2.4 solve
this?). (Python is "based" on C, but putting C syntax inside Python
sometimes seems a bad thing to me.)
Read the PEP for Template to find out if it fixes it. Generally, no
matter what kind of string formatting you do, someone is not going to
like it. Me, I like the way things are done, but then again, sometimes
I like C.

Maybe the : at the end of some blocks can be removed or it can become
optional (but then the newline is probably necessary):
Don't get your hopes up. Colons are a very important delimiter for
Python now, and removing them just makes the syntax more ambiguous for
both reading and for interpreting.

In time, Python seems to become more similar to the Mathematica (and
in IPython this is even explicit) ^_^


Becoming more like Mathematica is not something one should hope for.
- Josiah

(I can't believe I am replying to someone with the email address
'bearophile')

Jul 18 '05 #2
>>>>> "Josiah" == Josiah Carlson <jc******@uci.e du> writes:
- The optional static typing seems a quite nice thing (for
compilers too, they can produce faster code. It can probably
allow faster and smaller arrays, like those of numarray).


Josiah> Asking for static typing in Python is a pretty big
Josiah> request. It seems from those responses to similar
Josiah> questions, the answer is simply "static typing isn't
Josiah> coming to CPython any time soon, probably not even for
Josiah> Py3k".

Guido has repeatedly expressed that Python will probably get optional
type declarations in the future. I am not sure to what extent that
implies static typing, but it's definitely on the map.

Boo already has type declarations, and I imagine the CLR
implementations of python (IronPython, Boo) will benefit most from
type declarations, performancewise . The benefit to CPython might be
more indirect, simplifying the work done by things like Psycho. Still,
I see type declarations opening so many doors that they should be in
the language - even if the performance improvement is zero at the
first stage. Python is not just CPython these days.

Josiah> Keep wishing, but unless you implement it, I wouldn't get
Josiah> my hopes up.

Implementation can be trivial - the interpreter could just assert
isinstance when check_type_decl arations is true. The harder part is
coming up with all the semantics.
--
Ville Vainio http://tinyurl.com/2prnb
Jul 18 '05 #3
>>>>> "bearophile " == bearophile <be************ @lycos.com> writes:

bearophile> about such things. I have few comments and notes on
bearophile> the Python language. I've just started to learn it;
bearophile> this is negative because I'm ignorant still, but it's
bearophile> also positive because I can still see details that
bearophile> later probably I'll start to ignore.

It's highly typical for the newbies to suggest improvements to the
language. They will usually learn that they are wrong, but the
discussion that ensues can be fruitfull anyway :-).

bearophile> Some of the functions of IPython seem good and simple,
bearophile> and I think some of them can be integrated into the
bearophile> main Python line.

IPython will be going through a Grand Cleanup Real Soon Now (as
Fernando Perez' time permits). Before that, integration of the
functionality probably isn't the smart thing to do.

As it stands, I'd see IPython as a more likely candidate for some kind
of "extra batteries" edition of python.

--
Ville Vainio http://tinyurl.com/2prnb
Jul 18 '05 #4
Ville Vainio wrote:
>> "bearophile " == bearophile <be************ @lycos.com> writes:
bearophile> Some of the functions of IPython seem good and simple,
bearophile> and I think some of them can be integrated into the
bearophile> main Python line.

IPython will be going through a Grand Cleanup Real Soon Now (as
Fernando Perez' time permits). Before that, integration of the
functionality probably isn't the smart thing to do.


Coming, coming :) Seriously, 0.6.4 is ready, I'm just giving the 2 week break
for the BSD licensing I said I would. I consider 0.6.4 the 'end of the line',
and I've started already rejecting requests for more changes/improvements, so
the Grand Cleanup doesn't get delayed any longer.

As there seems to be interest from various projects in having ipython as a good
interactive shell (which is obviously the kind of use I want to see), the need
for such a cleanup is becoming more pressing. Given the unfortunate reality
that ipython only gets the scraps of my 'free' time, helping hands would be
quite welcome (though be ready to dive into a big code hairball if you sign up
for the job :)

Best,

f

Jul 18 '05 #5
Ville Vainio ha scritto:

Josiah> Keep wishing, but unless you implement it, I wouldn't get
Josiah> my hopes up.

Implementation can be trivial - the interpreter could just assert
isinstance when check_type_decl arations is true. The harder part is
coming up with all the semantics.


On a related note: What is supposed to be a type in python?
Is it a class? is it an interface? is it an implementation detail? is it
an algebraish definition?
I'd like to know what is the current 'mainstream' way of thinking about it.
Jul 18 '05 #6
Josiah Carlson wrote in message news:<ma******* *************** *************** *@python.org> :
Or perhaps later you will understand why some of the things you stated are not applicable.<

Sure, but sometimes outsiders can see some things better.

not some Windows-only toolkit that doesn't quite have critical mass.<
Maybe Gui4cli code will be released, etc. (wxPython is much more
powerful than Gui4cli-like solutions, so they don't compete, they can
be for different purposes).

In Py3k, tabs are not going to be allowed as indentation to Python code.<

Good.

Colons are a very important delimiter for Python now, and removing them just makes the syntax more ambiguous for both reading and for
interpreting.<

I've heard similar comments about the leading whitespace used to
determine the grouping of statements.
I keep forgetting those colons, I think they are useful mostly for one
liners, like:
if <cond>: <code>
for c in string: <code>

Becoming more like Mathematica is not something one should hope for.<
Mathematica is a good and powerful language, with a good design (older
maybe). I see many similarities between Python and Mathematica, and
such similarities seem to increase with time. (I know, Python is OO
and Mathematica usually isn't. But Mathematica can be used as a
functional language, etc.)

(I can't believe I am replying to someone with the email address

'bearophile')<

I am learning, like everybody else.

Thank you,
a bear hug,
bearophile
Jul 18 '05 #7
>>>>> "bearophile " == bearophile <be************ @lycos.com> writes:

(I can't believe I am replying to someone with the email
address bearophile 'bearophile')


bearophile> I am learning, like everybody else.

He probably just thought that your email address is amusing. Which it
is, it the internetish neo-juvenile fashion. Laughing at such a name
is probably not the most mature thing to do, but some of us just can't
help it...

--
Ville Vainio http://tinyurl.com/2prnb
Jul 18 '05 #8
> Sure, but sometimes outsiders can see some things better.

And sometimes outsiders haven't read the threads <wink>.

not some Windows-only toolkit that doesn't quite have critical mass.<


Maybe Gui4cli code will be released, etc. (wxPython is much more
powerful than Gui4cli-like solutions, so they don't compete, they can
be for different purposes).


Because Python already has a standard GUI toolkit (tk), including
Gui4cli would imply that it was a better fit as a replacement than other
GUI toolkits.

Both wxPython and PyGTK seem to be far better candidates for replacement
of tk than Gui4cli, both due to their much larger user base, and their
cross-platform capability.

There have been non-standard distributions of Python, sometimes with
more packages specifically for a particular set of platforms.
Activestate makes one that includes Pythonwin and MFC bindings for GUI
development (you can get Pythonwin and MFC bindings from pywin32 btw).
While I doubt that Gui4cli would make it into standard Python, its
inclusion by a 3rd party Python packager is really just a question of
whether someone is interested enough in doing so.
Colons are a very important delimiter for Python now, and removing

them just makes the syntax more ambiguous for both reading and for
interpreting.<

I've heard similar comments about the leading whitespace used to
determine the grouping of statements.
I keep forgetting those colons, I think they are useful mostly for one
liners, like:
if <cond>: <code>
for c in string: <code>


It turns out that those one-liners are not considered Pythonic.

While there has been some discussion regarding spacing in Python, I
believe for many/most that use Python, indentation as scope is a very
positive thing.

If you don't like indentation as scope, you are free to download the
source, change the parser for your scope delimiter of choice, and
recompile. Since you can pick up a free copy of Microsoft's compiler
(if you are on Windows), or GCC is freely available, making a working
Python interpreter for your desired syntax is certainly doable.

Becoming more like Mathematica is not something one should hope for.<


Mathematica is a good and powerful language, with a good design (older
maybe). I see many similarities between Python and Mathematica, and
such similarities seem to increase with time. (I know, Python is OO
and Mathematica usually isn't. But Mathematica can be used as a
functional language, etc.)


In my opinion, the structure, syntax, readability, etc. of programs
written in Mathematica leaves something to be desired. That is why I
use Python and not Mathematica (that and Mathematica isn't free).

- Josiah

Jul 18 '05 #9
>> (I can't believe I am replying to someone with the email
>> address bearophile 'bearophile')


bearophile> I am learning, like everybody else.

He probably just thought that your email address is amusing. Which it
is, it the internetish neo-juvenile fashion. Laughing at such a name
is probably not the most mature thing to do, but some of us just can't
help it...


I wasn't laughing at the name.

Perhaps the original poster is an animal conservationist , concerned
about humans encroaching on the environments of Black, Brown, Grizzly,
etc., bears. Perhaps it is something else.

I don't know, nor do I really want to know.
- Josiah

Jul 18 '05 #10

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

22
2309
by: bearophile | last post by:
Ville Vainio: >It's highly typical for the newbies to suggest improvements to the >language. They will usually learn that they are wrong, but the >discussion that ensues can be fruitfull anyway :-). Few more notes on the language. I don't know if I can really suggest improvements to the language... but I hope to learn something :-) I think some things are better in Delphi/Pascal (like the := for assignments instead of = and = for...
0
1404
by: Rick Brandt | last post by:
I send an XML character stream to a Java servlet with an HTTPRequest and get the following error on both of our web servers hosting the servlet. org.xml.sax.SAXParseException: The root element is required in a well-formed document. If I send the exact same request to my local instance of the servlet running in JBuilder's IDE it parses just fine which is making this a real bitch to troubleshoot. (JBuilder 7)
5
5005
by: NickBlooruk | last post by:
Hello, I have successfully linked a Lotus Notes server to our SQL Server database using an ODBC connection. This works fine when wanting to select records eg openquery(LOTUSNOTES2, 'select * from Person' ) The problem I have is when I try to update the record I get an error eg update openquery(LOTUSNOTES, 'select * from Person where
0
5605
by: PZ Fosbeck | last post by:
I'm not a Lotus Notes developer but thanks to this group's archives have successfully created a function for sending Lotus Notes emails from Access. The follow code works great except I want to remove my name from the 'Sent By' portion of the email. These messages are sent using my client session of Lotus Notes, using a database called 'Tech Team' The resulting email message headers contains (Bold, the From name) 'Tech Team'
9
2034
by: bojan.pikl | last post by:
Hi, I am making a simple calendar. I would like to have the ability of notes. I was thinking of using this kind of notes.xml file. I am not sure how to operate with nodes. I just need to access something like SelectNode("/NOTES/y"+Year+"/m"+Month+"/d"+Day); (I'd get /NOTES/y2006/m5/d18) and than I'd read what is in there. Can anyone help please? <NOTES> <y2006> <m4> <DAYS>1,2,13</DAYS>
2
11829
by: charliej2001 | last post by:
Hi all I'm trying to set up an Access database that will be able to import contact information from the lotus notes 6.5 Address book. The idea is that the code runs from access to import all of the contacts, using COM. I've written the following vba code so far to import the contacts
4
2294
by: MVSGuy | last post by:
Hello, I have a problem where a Notes field shows up in Access (via ODBC connection) but the value is either zero or blank in Access. I've verified the field is not zero or blank in Notes. Background - This is an existing ODBC connection from Access to Notes. For all other fields, it works fine. I've added a number field to the Notes database. It shows up in Access but never has the correct value. Is there something simple I'm...
4
9967
by: navyliu | last post by:
I want send Lotus Notes Email automatic in my Application.I googled this topic but I can't find the solution. Does anyone have ever use this function?Can you give me some advice? Thanks a lot!
7
2315
by: Matuag | last post by:
Hi All, I created 'Notes' table which is linked to the main 'Client' table (One-to-many). The form which shows client details has a tabbed page for tracking notes. I have created two subforms to enter new notes and to view previous notes. NewNotes - Continuous Form View, No additions allowed NotesHistory - Single Form View, Opens Default to New Record.
0
8385
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8303
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
8821
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
1
8502
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
1
6162
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5632
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
1
2726
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
1941
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
2
1601
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.