473,795 Members | 3,428 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Py 2.6 changes

I have just re-read the list of changes in Python 2.6, it's huge,
there are tons of changes and improvements, I'm really impressed:
http://docs.python.org/dev/whatsnew/2.6.html

I'll need many days to learn all those changes! I can see it fixes
several of the missing things/problems I have found in Python in the
past, like the lack of information regarding the floating point it
uses, etc.
I have seen that many (smart) updates are from Hettinger.

You can see a language gets better when you can remove often-used
commodity functions/classes from your own 'bag of tricks' :-) (Like
the permutations() function, etc).
>Python now must be compiled with C89 compilers (after 19 years!). This means that the Python source tree has dropped its own implementations of memmove and strerror, which are in the C89 standard library.<
I presume it's better for me to not hold my breath while I wait
CPython to be written in C99 :-)
Now math has factorial:
http://docs.python.org/dev/library/m...math.factorial
Seen how reduce() is removed from Python 3 (I know it's in itertools),
and seeing that for me to write a productory() function was the first
usage I have had for reduce, years ago, I think the math module can
gain a productory() function too.
For Python 2.7/3.1 I'd now like to write a PEP regarding the
underscores into the number literals, like: 0b_0101_1111, 268_435_456
etc. I use such underscores all the time in the D language, and I
think they can be a tiny but significant improvement for Python (and
underscore is much better than just a space, because the underscore
helps the person that reads the code to understand that's a single
number).

Bye,
bearophile
Sep 1 '08
33 2092
Ben Finney wrote:
I would argue that the precedent, already within Python, for using a
space to separate pieces of a string literal, is more important than
precedents from other programming languages.
that precedent also tells us that the whitespace approach is a common
source of errors. taking an approach that's known to be error-prone and
applying it to more cases isn't necessarily a great way to build a
better language.

</F>

Sep 2 '08 #11
On Tue, 02 Sep 2008 11:13:27 +1000, Ben Finney wrote:
be************@ lycos.com writes:
>For Python 2.7/3.1 I'd now like to write a PEP regarding the
underscores into the number literals, like: 0b_0101_1111, 268_435_456
etc.

+1 on such a capability.

-1 on underscore as the separator.

When you proposed this last year, the counter-proposal was made
<URL:http://groups.google.com/group/comp.lang.python/
msg/18123d100bba63b 8?dmode=source>
to instead use white space for the separator, exactly as one can now do
with string literals.

I don't see any good reason (other than your familiarity with the D
language) to use underscores for this purpose, and much more reason
(readability, consistency, fewer arbitrary differences in syntax,
perhaps simpler implementation) to use whitespace just as with string
literals.
At the risk of bike-shedding, I think that allowing arbitrary whitespace
between string literals is fine, because it aids readability to write
this:

do_something(
"first part of the string"
"another part of the string"
"yet more of the string"
"and a bit more"
"and so on..."
)

but I'm not sure that it is desirable to allow this:

do_something(
142325
93.8012
7113
)
-1/2 on arbitrary whitespace, +1/2 on a single space, and +0 on
underscores. If semi-colons didn't already have a use, I'd propose using
them to break up numeric literals:

14;232;593.801; 271;13

--
Steven
Sep 2 '08 #12
On Mon, 01 Sep 2008 22:11:13 -0700, Dennis Lee Bieber wrote:
On Tue, 02 Sep 2008 13:51:16 +1000, Ben Finney
<bi************ ****@benfinney. id.audeclaimed the following in
comp.lang.pytho n:
>This is no more the case than for literal strings:

a = "spam" "eggs" "ham"

a = "spam", "eggs", "ham"
But... Literal string still have the " (or ') delimiters around the
components. Such does not exist for you example with integers.

Consider

a = "spam, eggs", "ham"
vs
a = "spam, eggs" "ham"

Quite frankly, I think that it's a stretch to say that leaving out a
tuple delimiter is a problem with whitespace inside numeric literals.
That's hardly unique to whitespace:

atuple = 5,6,7,8
vs
atuple = 5,67,8

Look Ma, no whitespace!
But even if allowing whitespace inside numeric literals did create a new
avenue for errors which never existed before, it is a mistake to only
consider the downside without the upside. In my opinion, that would be
rather like declaring that the syntax for attribute access is a mistake
because you might do this:

x = MyClass()
xy = 4

instead of this:

x = MyClass()
x.y = 4

At some point the programmer has to take responsibility for typos instead
of blaming the syntax of the language. I agree that we should avoid
syntax that *encourages* typos, but I don't believe that allowing
whitespace inside numeric literals does that.

--
Steven
Sep 2 '08 #13
be************@ lycos.com <be************ @lycos.comwrote :
Ben Finney:
I don't see any good reason (other than your familiarity with the D
language) to use underscores for this purpose, and much more reason
(readability, consistency, fewer arbitrary differences in syntax,
perhaps simpler implementation) to use whitespace just as with string
literals.

It's not just my familiarity, Ada language too uses underscore for
that purpose, I think, so there's a precedent, and Ada is a language
designed to always minimize programming errors, simple code mistakes
too.
And perl also

*ducks*
--
Nick Craig-Wood <ni**@craig-wood.com-- http://www.craig-wood.com/nick
Sep 2 '08 #14
On 02 Sep 2008 06:10:51 GMT, Steven D'Aprano wrote:
At the risk of bike-shedding,
[snip]

(startled noises) It is a delight to find a reference to
that half-century-old essay (High Finance) by the wonderful
C. Northcote Parkinson, but how many readers will catch the
allusion?

--
To email me, substitute nowhere->spamcop, invalid->net.
Sep 2 '08 #15
On 02 Sep 2008 06:10:51 GMT, Steven D'Aprano wrote:
>At the risk of bike-shedding,
[snip]

Peter Pearson wrote:
(startled noises) It is a delight to find a reference to
that half-century-old essay (High Finance) by the wonderful
C. Northcote Parkinson, but how many readers will catch the
allusion?

It is pretty common geek speek:
http://en.wikipedia.org/wiki/Color_of_the_bikeshed

Cheers,
Alan Isaac
Sep 2 '08 #16
Peter Pearson wrote:
(startled noises) It is a delight to find a reference to
that half-century-old essay (High Finance) by the wonderful
C. Northcote Parkinson, but how many readers will catch the
allusion?
anyone that's been involved in open source on the development side for
more than, say, ten minutes.

http://www.bikeshed.com/

</F>

Sep 2 '08 #17
On Tue, 02 Sep 2008 17:18:58 GMT, Alan G Isaac <al********@gma il.comwrote:
>On 02 Sep 2008 06:10:51 GMT, Steven D'Aprano wrote:
>>At the risk of bike-shedding,
[snip]

Peter Pearson wrote:
>(startled noises) It is a delight to find a reference to
that half-century-old essay (High Finance) by the wonderful
C. Northcote Parkinson, but how many readers will catch the
allusion?

It is pretty common geek speek:
http://en.wikipedia.org/wiki/Color_of_the_bikeshed
Ah, the wondrous Wiki.

I thought I was a geek, for the past 40 years; but maybe its
time for me to be demoted to the dad on whose bookshelf
you'll find that old book.

--
To email me, substitute nowhere->spamcop, invalid->net.
Sep 2 '08 #18
Fredrik Lundh wrote:
Peter Pearson wrote:
>(startled noises) It is a delight to find a reference to
that half-century-old essay (High Finance) by the wonderful
C. Northcote Parkinson, but how many readers will catch the
allusion?

anyone that's been involved in open source on the development side for
more than, say, ten minutes.
Indeed! Thus speaks the experienced developer -- effbot :)

On some mailing lists the bikeshed issue comes hand in hand with the
Dunning-Kruger-effect. [1] *sigh*

Christian

[1] http://en.wikipedia.org/wiki/Dunning-Kruger_effect

Sep 2 '08 #19
Peter Pearson <pp******@nowhe re.invalidwrite s:
I thought I was a geek, for the past 40 years; but maybe its time
for me to be demoted to the dad on whose bookshelf you'll find that
old book.
Once a geek, always a geek. You either stay sharp or get sloppy, but
you never stop being a geek :-)

--
\ “The best ad-libs are rehearsed.” —Graham Kennedy |
`\ |
_o__) |
Ben Finney
Sep 2 '08 #20

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

Similar topics

0
1494
by: robmcdan | last post by:
Hi, I'm using RegNotifyChangeKeyValue() (via DllImport) to detect changes to registry keys and subkeys. However, in addition to catching changes, I would like to know what the changes were. Any tips? I think that RegNotifyChangeKeyValue is not going to help me. Can I do this (detect changes and enumerate the changes) with WMI? I was able to catch changes to the registry via WQL event queries, but again, I was unable to determine what...
4
5357
by: Glenn Owens | last post by:
I have a DataGrid web control which I've dynamically populated with template columns to be used for bulk-editting. Generally, all of the columns are textbox and/or dropdownlist child controls. Currently everything is working. I can find the updated rows/columns by parsing the posted data collection against the DataGrid DataSource. However, when there is a large amount of DataGridItems (rows) the update processing can take a while. ...
0
2095
by: Jeff Reed | last post by:
I am experiencing the the problem outlined the below. Unfortunately, I am using WinXP and I not sure if I can apply the solution due to lack of security control Any feed back would be apreciated http://support.microsoft.com/default.aspx?scid=kb;EN-US;31795 FIX: "Failed to Start Monitoring Directory Changes" Error Message When You Browse to an ASP.NET Pag View products that this article applies to This article was previously...
9
3216
by: Tim D | last post by:
Hi, I originally posted this as a reply to a rather old thread in dotnet.framework.general and didn't get any response. I thought it might be more relevant here; anyone got any ideas? My questions are below... "David Good" wrote: > We have a network running both Win2k and Win2k3 webservers and our web sites > reside on a UNC network share that happens to be a Network Appliance NAS.
6
1749
by: lanem | last post by:
I have a page that shows some data in a datagrid. All rows are updateable and then the changes are saved by hitting the "Save Changes" button. It is not a row by row save. All edits are made and then all altered rows are saved at once. It can be big, so I only want to save the ones that have changed. I'm keeping track of the changed rows in ViewState with this code: Protected Sub RowChanged(ByVal sender As System.Object, ByVal e As...
16
1794
by: Richard | last post by:
Hi, I am passing a structure to a subroutine where the passed parameter has been declared as ByVal. However, changes made to the passed variable inside the subroutine flow through to the actual variable that has been passed over, even though with ByVal this should not happen. Has anybody else discovered this or am I doing completely wrong /
30
3406
by: Charles Law | last post by:
Here's one that should probably have the sub-heading "I'm sure I asked this once before, but ...". Two users are both looking at the same data, from a database. One user changes the data and commits it. How does the other user get the updated view without polling for changes? Is there some sort of callback mechanism that can be set up on the dataset or connection? TIA
5
5182
by: vovan | last post by:
I have set of controls (Textboxes, checkboxes etc) along with the Grid on Windows Form. I use BindingSource to populate both Grid and the set of Controls. User selects the record in the grid and all controls are populated with data from the selected row. The grid is going to be read only. Textboxes, checkboxes are going to be read/write. What event and how do I need to use to catch any change in any of the textboxes? I tried to use...
11
4143
by: gyap88 | last post by:
Hello i m using vb 2005 express to do my project. I m suppose to create a datagrid to allow user to make changes to the database. The program display the database in a datagrid where users can juz make changes there. I encountered a problem when user are trying save changes. The following code is executed when the save button is click: Private Sub Save_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Save.Click ...
0
9672
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, well explore What is ONU, What Is Router, ONU & Routers main usage, and What is the difference between ONU and Router. Lets take a closer look ! Part I. Meaning of...
0
9519
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
10214
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
10001
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
1
7538
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
6780
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();...
0
5437
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5563
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4113
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

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.