You are correct that is it bad to name variables with same name as builtins. We are planning work in Juno to significantly revamp plugins and this is one of the items to fix.
** Changed in: neutron Status: New => Won't Fix -- You received this bug notification because you are a member of Yahoo! Engineering Team, which is subscribed to neutron. https://bugs.launchpad.net/bugs/1269246 Title: some ariables name is not friendly Status in OpenStack Neutron (virtual network service): Won't Fix Bug description: in neutron/db/db_base_plugin_v2.py, the code is: def _generate_ip(context, subnets): """Generate an IP address. The IP address will be generated from one of the subnets defined on the network. """ range_qry = context.session.query( models_v2.IPAvailabilityRange).join( models_v2.IPAllocationPool).with_lockmode('update') for subnet in subnets: range = range_qry.filter_by(subnet_id=subnet['id']).first() if not range: LOG.debug(_("All IPs from subnet %(subnet_id)s (%(cidr)s) " "allocated"), {'subnet_id': subnet['id'], 'cidr': subnet['cidr']}) continue ip_address = range['first_ip'] LOG.debug(_("Allocated IP - %(ip_address)s from %(first_ip)s " "to %(last_ip)s"), {'ip_address': ip_address, 'first_ip': range['first_ip'], 'last_ip': range['last_ip']}) if range['first_ip'] == range['last_ip']: # No more free indices on subnet => delete LOG.debug(_("No more free IP's in slice. Deleting allocation " "pool.")) context.session.delete(range) else: # increment the first free range['first_ip'] = str(netaddr.IPAddress(ip_address) + 1) return {'ip_address': ip_address, 'subnet_id': subnet['id']} raise q_exc.IpAddressGenerationFailure(net_id=subnets[0]['network_id']) @staticmethod def _allocate_specific_ip(context, subnet_id, ip_address): """Allocate a specific IP address on the subnet.""" ip = int(netaddr.IPAddress(ip_address)) range_qry = context.session.query( models_v2.IPAvailabilityRange).join( models_v2.IPAllocationPool).with_lockmode('update') results = range_qry.filter_by(subnet_id=subnet_id) for range in results: first = int(netaddr.IPAddress(range['first_ip'])) last = int(netaddr.IPAddress(range['last_ip'])) if first <= ip <= last: if first == last: context.session.delete(range) return elif first == ip: range['first_ip'] = str(netaddr.IPAddress(ip_address) + 1) return elif last == ip: range['last_ip'] = str(netaddr.IPAddress(ip_address) - 1) return else: # Split into two ranges new_first = str(netaddr.IPAddress(ip_address) + 1) new_last = range['last_ip'] range['last_ip'] = str(netaddr.IPAddress(ip_address) - 1) ip_range = models_v2.IPAvailabilityRange( allocation_pool_id=range['allocation_pool_id'], first_ip=new_first, last_ip=new_last) context.session.add(ip_range) return func use range as ariables name, I think it is not friendly, the name is same as range(), it can replace by ip_range or othername. To manage notifications about this bug go to: https://bugs.launchpad.net/neutron/+bug/1269246/+subscriptions -- Mailing list: https://launchpad.net/~yahoo-eng-team Post to : yahoo-eng-team@lists.launchpad.net Unsubscribe : https://launchpad.net/~yahoo-eng-team More help : https://help.launchpad.net/ListHelp