Opened 9 years ago

Closed 8 years ago

#6485 enhancement closed fixed (fixed)

Replace usage of has_key() in examples

Reported by: Thijs Triemstra Owned by: Jean-Paul Calderone
Priority: normal Milestone: Python-3.x
Component: core Keywords: easy
Cc: Hynek Schlawack Branch:
Author:

Description

The following documentation example files contain calls to the deprecated x.has_key(y) method. They should be replaced with y in x instead.

./doc/core/howto/tutorial/listings/finger/finger_config.py:24:    if config.has_key('ircnick'):
./doc/core/howto/tutorial/listings/finger/finger_config.py:32:    if config.has_key('pbport'):
./doc/core/howto/tutorial/listings/finger/finger/finger.py:354:    if config.has_key('ircnick'):
./doc/core/howto/tutorial/listings/finger/finger/finger.py:362:    if config.has_key('pbport'):
./doc/core/howto/listings/servers/chat.py:16:        if self.users.has_key(self.name):
./doc/core/howto/listings/servers/chat.py:26:        if self.users.has_key(name):
./doc/core/howto/listings/pb/chatserver.py:17:        if not self.groups.has_key(groupname):

This is part of #4053.

Attachments (3)

ticket6485.patch (3.5 KB) - added by Can Ibanoglu 9 years ago.
Updated the dictionary key lookup syntax, not so sure about the top file though
ticket6485.2.patch (3.3 KB) - added by jackson15j 8 years ago.
Fixed up the top file from original patch
ticket6485.3.patch (3.1 KB) - added by jackson15j 8 years ago.
2nd attempt at fixing topfile. Now .misc and blank.

Download all attachments as: .zip

Change History (10)

comment:1 Changed 9 years ago by Can Ibanoglu

Owner: set to Can Ibanoglu

Changed 9 years ago by Can Ibanoglu

Attachment: ticket6485.patch added

Updated the dictionary key lookup syntax, not so sure about the top file though

comment:2 Changed 9 years ago by Can Ibanoglu

Keywords: review added
Owner: Can Ibanoglu deleted

comment:3 Changed 9 years ago by Hynek Schlawack

Cc: Hynek Schlawack added
Keywords: review removed

Hi canibanoglu,

the code LGTM, however your topfile needs indeed some love.

The word “syntax” is spelled wrong at the first occurrence and there’s no need to list all the files that have been changed. Make a general one-line statement about example Python files instead please. For further details have a look at http://twistedmatrix.com/trac/wiki/ReviewProcess#Newsfiles .

Thanks!

comment:4 Changed 9 years ago by Julian Berman

It also probably is just a misc (empty) topfile, I think doc topfiles are generally for whole new or large changes to documentation.

Changed 8 years ago by jackson15j

Attachment: ticket6485.2.patch added

Fixed up the top file from original patch

comment:5 Changed 8 years ago by jackson15j

Keywords: review added

Changed 8 years ago by jackson15j

Attachment: ticket6485.3.patch added

2nd attempt at fixing topfile. Now .misc and blank.

comment:6 Changed 8 years ago by Jean-Paul Calderone

Keywords: review removed
Owner: set to Jean-Paul Calderone

Looks good, thanks!

comment:7 Changed 8 years ago by Jean-Paul Calderone

Resolution: fixed
Status: newclosed

(In [39079]) Apply ticket6485.3.patch - replace dict.has_key(key) with key in dict in some core examples.

Author: canibanoglu, jackson15j Reviewer: hynek, Julian, exarkun Fixes: #6485

Note: See TracTickets for help on using tickets.