ipaddress (was: Re: for a 'good python')

2023-04-21 Thread Simon Ward

On Thu, Apr 13, 2023 at 04:00:59PM +0100, Barry wrote:
Ipaddress was developed outside of the std lib and later added i 
recall.


I used it prior to it being in the standard library:
https://pypi.org/project/ipaddr/

Simon

--
A complex system that works is invariably found to have evolved from a
simple system that works.—John Gall
--
https://mail.python.org/mailman/listinfo/python-list


Re: for a 'good python'

2023-04-13 Thread Dennis Lee Bieber
On Thu, 13 Apr 2023 00:21:58 +0200, jak  declaimed the
following:


>Thank you too. I had seen this library but I always try not to use
>libraries outside the standard ones. Now I don't remember why I was
>convinced that this wasn't part of it, perhaps because it was like that
>at the time or because I got confused. Only now I realized that it is
>not necessary to install it. Now I'm considering whether to use
>'ipaddress' or 'socket'. What is certain is that this one you have
>suggested is really comfortable. Thanks again for the report.

It is useful to skim the contents of the standard library documentation
every couple of releases. ipaddress came in with Python 3.3

https://docs.python.org/3.10/library/index.html (I dropped down to 3.10
just as that is the version I have installed; some 3rd party modules
weren't ready when I tried to install on 3.11)
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: for a 'good python'

2023-04-13 Thread jak

Dennis Lee Bieber ha scritto:

On Thu, 13 Apr 2023 00:21:58 +0200, jak  declaimed the
following:



Thank you too. I had seen this library but I always try not to use
libraries outside the standard ones. Now I don't remember why I was
convinced that this wasn't part of it, perhaps because it was like that
at the time or because I got confused. Only now I realized that it is
not necessary to install it. Now I'm considering whether to use
'ipaddress' or 'socket'. What is certain is that this one you have
suggested is really comfortable. Thanks again for the report.


It is useful to skim the contents of the standard library documentation
every couple of releases. ipaddress came in with Python 3.3

https://docs.python.org/3.10/library/index.html (I dropped down to 3.10
just as that is the version I have installed; some 3rd party modules
weren't ready when I tried to install on 3.11)



Then it was my fault. The version was 3.8.6
--
https://mail.python.org/mailman/listinfo/python-list


Re: for a 'good python'

2023-04-13 Thread Barry


> On 13 Apr 2023, at 00:19, jak  wrote:
> 
> Barry ha scritto:
>> 
 On 12 Apr 2023, at 18:10, jak  wrote:
>>> Hi everyone,
>>> some time ago I wrote a class to determine if an ipv4 address belonged
>>> to a subnet. Seldom using python I'm pretty sure it's not written in
>>> 'good python' nor too portable. Could you give me some advice to make it
>>> better?
>>> class calcip:
>>>   def __init__(self, psubnet: str):
>>>   ssubnet, scidr = psubnet.replace(' ', '').split('/')
>>>   subnet = int.from_bytes(tuple(
>>> map(lambda n: (int(n)), 
>>> ssubnet.split('.'))),
>>>   'big')
>>>   cidr = int(scidr)
>>>   mask = ((2 ** cidr) - 1) << (32 - cidr)
>>>   self.__network = subnet & mask
>>>   self.__wildcard = ~mask & 0x
>>>   self.__broadcast = (subnet | self.__wildcard) & 0x
>>>   self.__tsubnet = tuple(subnet.to_bytes(4, 'big'))
>>>   self.__tnetwork = tuple(self.__network.to_bytes(4, 'big'))
>>>   self.__tbroadcast = tuple(self.__broadcast.to_bytes(4, 'big'))
>>>   self.__tmask = tuple(mask.to_bytes(4, 'big'))
>>>   self.__twildcard = tuple(self.__wildcard.to_bytes(4, 'big'))
>>>   self.__host_min = tuple((self.__network + 1).to_bytes(4, 'big'))
>>>   self.__host_max = tuple((self.__broadcast - 1).to_bytes(4, 'big'))
>>>   @staticmethod
>>>   def __to_str(val: tuple):
>>>   return '.'.join(str(v) for v in val)
>>>   @property
>>>   def subnet(self):
>>>   return self.__to_str(self.__tsubnet)
>>>   @property
>>>   def network(self):
>>>   return self.__to_str(self.__tnetwork)
>>>   @property
>>>   def broadcast(self):
>>>   return self.__to_str(self.__tbroadcast)
>>>   @property
>>>   def mask(self):
>>>   return self.__to_str(self.__tmask)
>>>   @property
>>>   def wildcard(self):
>>>   return self.__to_str(self.__twildcard)
>>>   @property
>>>   def host_min(self):
>>>   return self.__to_str(self.__host_min)
>>>   @property
>>>   def host_max(self):
>>>   return self.__to_str(self.__host_max)
>>>   @property
>>>   def hosts_num(self):
>>>   return self.__wildcard - 1
>>>   @property
>>>   def net_class(self):
>>>   tst = (self.__tnetwork[0] & 0xf0) >> 4
>>>   if (tst & 0x8) == 0:
>>>   clx = 'A'
>>>   elif (tst & 0xc) == 0x8:
>>>   clx = 'B'
>>>   elif (tst & 0xe) == 0xc:
>>>   clx = 'C'
>>>   elif (tst & 0xf) == 0xe:
>>>   clx = 'D'
>>>   elif (tst & 0xf) == 0xf:
>>>   clx = 'E'
>>>   return clx
>>>   def __contains__(self, item):
>>>   ret = True
>>>   row_hdr = None
>>>   try:
>>>   row_hdr = int.from_bytes(tuple(map(lambda n: (int(n)), 
>>> item.split('.'))), 'big')
>>>   except:
>>>   ret = False
>>>   if ret:
>>>   if not self.__network < row_hdr < self.__broadcast:
>>>   ret = False
>>>   return ret
>>> def main():
>>>   sn = calcip('10.0.0.0/26')
>>>   print(f"subnet: {sn.subnet}")
>>>   print(f"network: {sn.network}")
>>>   print(f"broadcast: {sn.broadcast}")
>>>   print(f"mask: {sn.mask}")
>>>   print(f"wildcard: {sn.wildcard}")
>>>   print(f"host_min: {sn.host_min}")
>>>   print(f"host_max: {sn.host_max}")
>>>   print(f"Avaible hosts: {sn.hosts_num}")
>>>   print(f"Class: {sn.net_class}")
>>>   tst_hdr = '10.0.0.31'
>>>   is_not = 'is '
>>>   if not tst_hdr in sn:
>>>   is_not = 'is NOT '
>>>   print("hdr %s %sin range %s - %s" %
>>> (tst_hdr, is_not, sn.host_min, sn.host_max))
>>> if __name__ == '__main__':
>>>   main()
>> There is this https://docs.python.org/3/howto/ipaddress.html if you just 
>> want a solution.
>> Or are you after code review feedback?
>> Barry
>>> --
>>> https://mail.python.org/mailman/listinfo/python-list
> 
> 
> Thank you too. I had seen this library but I always try not to use
> libraries outside the standard ones. Now I don't remember why I was
> convinced that this wasn't part of it, perhaps because it was like that
> at the time or because I got confused. Only now I realized that it is
> not necessary to install it. Now I'm considering whether to use
> 'ipaddress' or 'socket'. What is certain is that this one you have
> suggested is really comfortable. Thanks again for the report.

Ipaddress was developed outside of the std lib and later added i recall.

Barry
> 
> -- 
> https://mail.python.org/mailman/listinfo/python-list

-- 
https://mail.python.org/mailman/listinfo/python-list


Re: for a 'good python'

2023-04-13 Thread Lars Liedtke




Lars Liedtke
Software Entwickler

[Tel.]  +49 721 98993-
[Fax]   +49 721 98993-
[E-Mail]l...@solute.de


solute GmbH
Zeppelinstraße 15
76185 Karlsruhe
Germany


[Logo Solute]


Marken der solute GmbH | brands of solute GmbH
[Marken]
[Advertising Partner]

Geschäftsführer | Managing Director: Dr. Thilo Gans, Bernd Vermaaten
Webseite | www.solute.de 
Sitz | Registered Office: Karlsruhe
Registergericht | Register Court: Amtsgericht Mannheim
Registernummer | Register No.: HRB 110579
USt-ID | VAT ID: DE234663798



Informationen zum Datenschutz | Information about privacy policy
https://www.solute.de/ger/datenschutz/grundsaetze-der-datenverarbeitung.php




Am 13.04.23 um 00:21 schrieb jak:
Barry ha scritto:



On 12 Apr 2023, at 18:10, jak  wrote:
Hi everyone,
some time ago I wrote a class to determine if an ipv4 address belonged
to a subnet. Seldom using python I'm pretty sure it's not written in
'good python' nor too portable. Could you give me some advice to make it
better?

class calcip:
   def __init__(self, psubnet: str):
   ssubnet, scidr = psubnet.replace(' ', '').split('/')
   subnet = int.from_bytes(tuple(
 map(lambda n: (int(n)), ssubnet.split('.'))),
   'big')
   cidr = int(scidr)
   mask = ((2 ** cidr) - 1) << (32 - cidr)
   self.__network = subnet & mask
   self.__wildcard = ~mask & 0x
   self.__broadcast = (subnet | self.__wildcard) & 0x
   self.__tsubnet = tuple(subnet.to_bytes(4, 'big'))
   self.__tnetwork = tuple(self.__network.to_bytes(4, 'big'))
   self.__tbroadcast = tuple(self.__broadcast.to_bytes(4, 'big'))
   self.__tmask = tuple(mask.to_bytes(4, 'big'))
   self.__twildcard = tuple(self.__wildcard.to_bytes(4, 'big'))
   self.__host_min = tuple((self.__network + 1).to_bytes(4, 'big'))
   self.__host_max = tuple((self.__broadcast - 1).to_bytes(4, 'big'))

   @staticmethod
   def __to_str(val: tuple):
   return '.'.join(str(v) for v in val)

   @property
   def subnet(self):
   return self.__to_str(self.__tsubnet)

   @property
   def network(self):
   return self.__to_str(self.__tnetwork)

   @property
   def broadcast(self):
   return self.__to_str(self.__tbroadcast)

   @property
   def mask(self):
   return self.__to_str(self.__tmask)

   @property
   def wildcard(self):
   return self.__to_str(self.__twildcard)

   @property
   def host_min(self):
   return self.__to_str(self.__host_min)

   @property
   def host_max(self):
   return self.__to_str(self.__host_max)

   @property
   def hosts_num(self):
   return self.__wildcard - 1

   @property
   def net_class(self):
   tst = (self.__tnetwork[0] & 0xf0) >> 4
   if (tst & 0x8) == 0:
   clx = 'A'
   elif (tst & 0xc) == 0x8:
   clx = 'B'
   elif (tst & 0xe) == 0xc:
   clx = 'C'
   elif (tst & 0xf) == 0xe:
   clx = 'D'
   elif (tst & 0xf) == 0xf:
   clx = 'E'
   return clx

   def __contains__(self, item):
   ret = True
   row_hdr = None
   try:
   row_hdr = int.from_bytes(tuple(map(lambda n: (int(n)), 
item.split('.'))), 'big')
   except:
   ret = False
   if ret:
   if not self.__network < row_hdr < self.__broadcast:
   ret = False
   return ret


def main():
   sn = calcip('10.0.0.0/26')

   print(f"subnet: {sn.subnet}")
   print(f"network: {sn.network}")
   print(f"broadcast: {sn.broadcast}")
   print(f"mask: {sn.mask}")
   print(f"wildcard: {sn.wildcard}")
   print(f"host_min: {sn.host_min}")
   print(f"host_max: {sn.host_max}")
   print(f"Avaible hosts: {sn.hosts_num}")
   print(f"Class: {sn.net_class}")

   tst_hdr = '10.0.0.31'
   is_not = 'is '
   if not tst_hdr in sn:
   is_not = 'is NOT '
   print("hdr %s %sin range %s - %s" %
 (tst_hdr, is_not, sn.host_min, sn.host_max))

if __name__ == '__main__':
   main()

There is this https://docs.python.org/3/howto/ipaddress.html if you just want a 
solution.

Or are you after code review feedback?

Barry

--
https://mail.python.org/mailman/listinfo/python-list


Thank you too. I had seen this library but I always try not to use
libraries outside the standard ones. Now I don't remember why I was
convinced that this wasn't part of it, perhaps because it was like that
at the time or because I got confused. Only now I realized that it is
not necessary to install it. Now I'm considering whether to use
'ipaddress' or 'socket'. What is certain is that this one you have
suggested is really comfortable. Thanks again for the report.

Unless I am not mistakes, ipadress is "standard" because it is in the standard 
library
--
https://mail.python.org/mailman/listinfo/python-list


Re: for a 'good python'

2023-04-12 Thread jak

Barry ha scritto:





On 12 Apr 2023, at 18:10, jak  wrote:
Hi everyone,
some time ago I wrote a class to determine if an ipv4 address belonged
to a subnet. Seldom using python I'm pretty sure it's not written in
'good python' nor too portable. Could you give me some advice to make it
better?

class calcip:
def __init__(self, psubnet: str):
ssubnet, scidr = psubnet.replace(' ', '').split('/')
subnet = int.from_bytes(tuple(
  map(lambda n: (int(n)), ssubnet.split('.'))),
'big')
cidr = int(scidr)
mask = ((2 ** cidr) - 1) << (32 - cidr)
self.__network = subnet & mask
self.__wildcard = ~mask & 0x
self.__broadcast = (subnet | self.__wildcard) & 0x
self.__tsubnet = tuple(subnet.to_bytes(4, 'big'))
self.__tnetwork = tuple(self.__network.to_bytes(4, 'big'))
self.__tbroadcast = tuple(self.__broadcast.to_bytes(4, 'big'))
self.__tmask = tuple(mask.to_bytes(4, 'big'))
self.__twildcard = tuple(self.__wildcard.to_bytes(4, 'big'))
self.__host_min = tuple((self.__network + 1).to_bytes(4, 'big'))
self.__host_max = tuple((self.__broadcast - 1).to_bytes(4, 'big'))

@staticmethod
def __to_str(val: tuple):
return '.'.join(str(v) for v in val)

@property
def subnet(self):
return self.__to_str(self.__tsubnet)

@property
def network(self):
return self.__to_str(self.__tnetwork)

@property
def broadcast(self):
return self.__to_str(self.__tbroadcast)

@property
def mask(self):
return self.__to_str(self.__tmask)

@property
def wildcard(self):
return self.__to_str(self.__twildcard)

@property
def host_min(self):
return self.__to_str(self.__host_min)

@property
def host_max(self):
return self.__to_str(self.__host_max)

@property
def hosts_num(self):
return self.__wildcard - 1

@property
def net_class(self):
tst = (self.__tnetwork[0] & 0xf0) >> 4
if (tst & 0x8) == 0:
clx = 'A'
elif (tst & 0xc) == 0x8:
clx = 'B'
elif (tst & 0xe) == 0xc:
clx = 'C'
elif (tst & 0xf) == 0xe:
clx = 'D'
elif (tst & 0xf) == 0xf:
clx = 'E'
return clx

def __contains__(self, item):
ret = True
row_hdr = None
try:
row_hdr = int.from_bytes(tuple(map(lambda n: (int(n)), 
item.split('.'))), 'big')
except:
ret = False
if ret:
if not self.__network < row_hdr < self.__broadcast:
ret = False
return ret


def main():
sn = calcip('10.0.0.0/26')

print(f"subnet: {sn.subnet}")
print(f"network: {sn.network}")
print(f"broadcast: {sn.broadcast}")
print(f"mask: {sn.mask}")
print(f"wildcard: {sn.wildcard}")
print(f"host_min: {sn.host_min}")
print(f"host_max: {sn.host_max}")
print(f"Avaible hosts: {sn.hosts_num}")
print(f"Class: {sn.net_class}")

tst_hdr = '10.0.0.31'
is_not = 'is '
if not tst_hdr in sn:
is_not = 'is NOT '
print("hdr %s %sin range %s - %s" %
  (tst_hdr, is_not, sn.host_min, sn.host_max))

if __name__ == '__main__':
main()


There is this https://docs.python.org/3/howto/ipaddress.html if you just want a 
solution.

Or are you after code review feedback?

Barry


--
https://mail.python.org/mailman/listinfo/python-list



Thank you too. I had seen this library but I always try not to use
libraries outside the standard ones. Now I don't remember why I was
convinced that this wasn't part of it, perhaps because it was like that
at the time or because I got confused. Only now I realized that it is
not necessary to install it. Now I'm considering whether to use
'ipaddress' or 'socket'. What is certain is that this one you have
suggested is really comfortable. Thanks again for the report.

--
https://mail.python.org/mailman/listinfo/python-list


Re: for a 'good python'

2023-04-12 Thread Barry



> On 12 Apr 2023, at 18:10, jak  wrote:
> Hi everyone,
> some time ago I wrote a class to determine if an ipv4 address belonged
> to a subnet. Seldom using python I'm pretty sure it's not written in
> 'good python' nor too portable. Could you give me some advice to make it
> better?
> 
> class calcip:
>def __init__(self, psubnet: str):
>ssubnet, scidr = psubnet.replace(' ', '').split('/')
>subnet = int.from_bytes(tuple(
>  map(lambda n: (int(n)), ssubnet.split('.'))),
>'big')
>cidr = int(scidr)
>mask = ((2 ** cidr) - 1) << (32 - cidr)
>self.__network = subnet & mask
>self.__wildcard = ~mask & 0x
>self.__broadcast = (subnet | self.__wildcard) & 0x
>self.__tsubnet = tuple(subnet.to_bytes(4, 'big'))
>self.__tnetwork = tuple(self.__network.to_bytes(4, 'big'))
>self.__tbroadcast = tuple(self.__broadcast.to_bytes(4, 'big'))
>self.__tmask = tuple(mask.to_bytes(4, 'big'))
>self.__twildcard = tuple(self.__wildcard.to_bytes(4, 'big'))
>self.__host_min = tuple((self.__network + 1).to_bytes(4, 'big'))
>self.__host_max = tuple((self.__broadcast - 1).to_bytes(4, 'big'))
> 
>@staticmethod
>def __to_str(val: tuple):
>return '.'.join(str(v) for v in val)
> 
>@property
>def subnet(self):
>return self.__to_str(self.__tsubnet)
> 
>@property
>def network(self):
>return self.__to_str(self.__tnetwork)
> 
>@property
>def broadcast(self):
>return self.__to_str(self.__tbroadcast)
> 
>@property
>def mask(self):
>return self.__to_str(self.__tmask)
> 
>@property
>def wildcard(self):
>return self.__to_str(self.__twildcard)
> 
>@property
>def host_min(self):
>return self.__to_str(self.__host_min)
> 
>@property
>def host_max(self):
>return self.__to_str(self.__host_max)
> 
>@property
>def hosts_num(self):
>return self.__wildcard - 1
> 
>@property
>def net_class(self):
>tst = (self.__tnetwork[0] & 0xf0) >> 4
>if (tst & 0x8) == 0:
>clx = 'A'
>elif (tst & 0xc) == 0x8:
>clx = 'B'
>elif (tst & 0xe) == 0xc:
>clx = 'C'
>elif (tst & 0xf) == 0xe:
>clx = 'D'
>elif (tst & 0xf) == 0xf:
>clx = 'E'
>return clx
> 
>def __contains__(self, item):
>ret = True
>row_hdr = None
>try:
>row_hdr = int.from_bytes(tuple(map(lambda n: (int(n)), 
> item.split('.'))), 'big')
>except:
>ret = False
>if ret:
>if not self.__network < row_hdr < self.__broadcast:
>ret = False
>return ret
> 
> 
> def main():
>sn = calcip('10.0.0.0/26')
> 
>print(f"subnet: {sn.subnet}")
>print(f"network: {sn.network}")
>print(f"broadcast: {sn.broadcast}")
>print(f"mask: {sn.mask}")
>print(f"wildcard: {sn.wildcard}")
>print(f"host_min: {sn.host_min}")
>print(f"host_max: {sn.host_max}")
>print(f"Avaible hosts: {sn.hosts_num}")
>print(f"Class: {sn.net_class}")
> 
>tst_hdr = '10.0.0.31'
>is_not = 'is '
>if not tst_hdr in sn:
>is_not = 'is NOT '
>print("hdr %s %sin range %s - %s" %
>  (tst_hdr, is_not, sn.host_min, sn.host_max))
> 
> if __name__ == '__main__':
>main()

There is this https://docs.python.org/3/howto/ipaddress.html if you just want a 
solution.

Or are you after code review feedback?

Barry

> -- 
> https://mail.python.org/mailman/listinfo/python-list
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: for a 'good python'

2023-04-12 Thread jak

Stefan Ram ha scritto:

jak  writes:

@property
def subnet(self):
return self.__to_str(self.__tsubnet)


   Maybe each of those attributes should be an object of a
   special class where your "__to_str" is "__str__"? E.g.,

# code in "calcip.__init__"
self.tsubnet = ip_address_class.from_int( subnet )

   where "ip_address_class" is as in:

import collections
import random

class ip_address_class( collections.UserList ):
 def __init__( self, bytes_address ):
 super().__init__( bytes_address )
 @classmethod
 def from_int( cls, int_address ):
 return cls( int_address.to_bytes( 4, 'big' ))
 def __str__( self ):
 return '.'.join( str( byte_ )for byte_ in self.data )

if __name__ == '__main__':
 ip_address = \
 ip_address_class.from_int( random.randint( 0, 4294967295 ))
 print( ip_address[ 0 ])
 print( ip_address )

   . Now the client can access each byte individually and also
   get a "nice" string representation.

   (You may add more "from_..." methods for all the various
   formats you create addresses from.)

   But you should also research the standard library to see
   if something like this doesn't already exist ready-made
   specifically for IP addresses in the standard library.



ok. thanks a lot. now i try to do that.


--
https://mail.python.org/mailman/listinfo/python-list


for a 'good python'

2023-04-12 Thread jak

Hi everyone,
some time ago I wrote a class to determine if an ipv4 address belonged
to a subnet. Seldom using python I'm pretty sure it's not written in
'good python' nor too portable. Could you give me some advice to make it
better?

class calcip:
def __init__(self, psubnet: str):
ssubnet, scidr = psubnet.replace(' ', '').split('/')
subnet = int.from_bytes(tuple(
  map(lambda n: (int(n)), 
ssubnet.split('.'))),

'big')
cidr = int(scidr)
mask = ((2 ** cidr) - 1) << (32 - cidr)
self.__network = subnet & mask
self.__wildcard = ~mask & 0x
self.__broadcast = (subnet | self.__wildcard) & 0x
self.__tsubnet = tuple(subnet.to_bytes(4, 'big'))
self.__tnetwork = tuple(self.__network.to_bytes(4, 'big'))
self.__tbroadcast = tuple(self.__broadcast.to_bytes(4, 'big'))
self.__tmask = tuple(mask.to_bytes(4, 'big'))
self.__twildcard = tuple(self.__wildcard.to_bytes(4, 'big'))
self.__host_min = tuple((self.__network + 1).to_bytes(4, 'big'))
self.__host_max = tuple((self.__broadcast - 1).to_bytes(4, 'big'))

@staticmethod
def __to_str(val: tuple):
return '.'.join(str(v) for v in val)

@property
def subnet(self):
return self.__to_str(self.__tsubnet)

@property
def network(self):
return self.__to_str(self.__tnetwork)

@property
def broadcast(self):
return self.__to_str(self.__tbroadcast)

@property
def mask(self):
return self.__to_str(self.__tmask)

@property
def wildcard(self):
return self.__to_str(self.__twildcard)

@property
def host_min(self):
return self.__to_str(self.__host_min)

@property
def host_max(self):
return self.__to_str(self.__host_max)

@property
def hosts_num(self):
return self.__wildcard - 1

@property
def net_class(self):
tst = (self.__tnetwork[0] & 0xf0) >> 4
if (tst & 0x8) == 0:
clx = 'A'
elif (tst & 0xc) == 0x8:
clx = 'B'
elif (tst & 0xe) == 0xc:
clx = 'C'
elif (tst & 0xf) == 0xe:
clx = 'D'
elif (tst & 0xf) == 0xf:
clx = 'E'
return clx

def __contains__(self, item):
ret = True
row_hdr = None
try:
row_hdr = int.from_bytes(tuple(map(lambda n: (int(n)), 
item.split('.'))), 'big')

except:
ret = False
if ret:
if not self.__network < row_hdr < self.__broadcast:
ret = False
return ret


def main():
sn = calcip('10.0.0.0/26')

print(f"subnet: {sn.subnet}")
print(f"network: {sn.network}")
print(f"broadcast: {sn.broadcast}")
print(f"mask: {sn.mask}")
print(f"wildcard: {sn.wildcard}")
print(f"host_min: {sn.host_min}")
print(f"host_max: {sn.host_max}")
print(f"Avaible hosts: {sn.hosts_num}")
print(f"Class: {sn.net_class}")

tst_hdr = '10.0.0.31'
is_not = 'is '
if not tst_hdr in sn:
is_not = 'is NOT '
print("hdr %s %sin range %s - %s" %
  (tst_hdr, is_not, sn.host_min, sn.host_max))

if __name__ == '__main__':
main()
--
https://mail.python.org/mailman/listinfo/python-list


Re: Looking for a good Python environment

2007-11-14 Thread Simon Pickles
Well,

I am recent Windows escapee, and was dismayed by lack of Pyscripter for 
Linux.

Hold on... there is hope!

Pyscripter works great using WINE. search  
http://groups.google.com/group/PyScripter?hl=en for "Linux"

Enjoy!

Paul Rudin wrote:
> jwelby <[EMAIL PROTECTED]> writes:
>
>
>   
>> This is a fair question. I didn't phrase my post too well.
>>
>> I find PyScripter does pretty much everything I need in terms of doing
>> actual development for Python. My use of 'lightweight' is by no means
>> a criticism of PyScripter - it's more of a compliment, as it refers to
>> the relatively modest demands that it makes on my system compared with
>> Eclipse, which can be hog.
>>
>> The main reason I have used Eclipse for larger, team based, projects
>> is for the source control plug-ins. Eclipse has plug-in support for
>> cvs and svn. PyScripter may have this too - perhaps I've missed it.
>> (I'm away from my Windows box at the moment, otherwise I would check).
>> Of course, there are other ways to implement source control without it
>> needing to be integrated in the IDE, so even this need not put off
>> anyone who wants to use PyScripter with source control.
>>
>> Summary - unless you need the added flexibility offered by Eclipse
>> plug-ins, PyScripter is a great tool for developing with Python on
>> Windows.
>> 
>
> I'm not sure if you count emacs as "lightweight" but it's certainly
> less resource hungry than eclipse/pydev, and does have integrated
> cvs/svn functionality.
>   



-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Looking for a good Python environment

2007-11-14 Thread Eric S. Johansson
[EMAIL PROTECTED] wrote:
> Hey, I'm looking for a good Python environment. That is, at least an editor
> and a debugger, and it should run on Windows. Does anyone have any idea?

I've been looking for the equivalent although I want the IDE to run on Windows
and to be able to edit/debug/bzr files on a remote system (linux in VM or 
remote 
physical hardware).

Solutions that I've explored are:

Network filesystems (Samba, NFS)
Emacs plus tramp
eclipse plus remote file access
remote system IDE, local display with X11
local editor plus unison

Here's how they failed:

Network filesystems always fail because they get ownership and permissions 
wrong.  No matter what you set the mapping to, it's almost always wrong for 
some 
part of the system.  It's made worse because setup .py does not make it easy to 
force permissions and ownership to what you want them to be (afaik).   this 
forces the use of an ad hoc script to enforce permissions and ownership after 
running setup.py.

using this configuration, it is possible to hibernate your Windows machine but 
only if you manually restart your remote filesystem connections before trying 
to 
do anything with your IDE.

Emacs plus tramp is the best solution so far albeit somewhat fragile.  It's 
moderately difficult to jump into the right point in the filesystem although 
this may be an artifact of trying to use speech recognition for this task. 
another annoying problem is forcing Emacs to use UNIX format text files.  I 
know 
I just need to RTF but I haven't gotten around to it yet.

Emacs plus tramp is also the easiest to hibernate as it does not use persistent 
connections to remote machine but if the remote host isn't available when you 
try to access a file via recentf, you lose the reference to the file and need 
to 
type/speak the path in again.

Eclipse has been an unmitigated disaster for me.  It's fat, it's heavy, it 
pushes all of my other applications out of virtual memory and then I need to 
wait 10s of seconds when I switch.  I can't figure out which components of the 
bag of parts I need and easy eclipse is too old to use the remote file system 
access extension.  blech.

Using X11 for local display is great if the remote machine is local and you're 
not paging out to virtual memory.  most common problem is that the local X11 
display loses track of local Windows and you end up with this graphic ink blot 
on the screen that never quite goes away until you restart X11 and all the 
other 
applications through it.

with the X11 solution,  you cannot hibernate your host machine because the 
persistent connections break and cannot be restarted.

local editor plus unison sort of, kind of works.  Yes, you can edit all your 
files and replicate them on the target machine.  Ownership and permissions are 
broken.  There is a problem with UNIX versus DOS file format but once you force 
the editor to do the right thing, the format is right on the remote side.  It's 
clumsy but it does have the advantage that if you make changes on the remote 
system when debugging, those changes are replicated back on your editing house.

As for debugging, personally, I just use winpdb everywhere and just suffer with 
bad X11 connections.

One additional factor raised by split machine operations is how do you organize 
your files?  Do you have different repositories on different machines or do you 
have a single repository on your editing host and look to some form of 
replication for updates across one or more machines?

it's an interesting set of problems.  Today, I just muddle along as I don't 
really see a good solution.  I'm hoping I'll be proven wrong and find a 
solution 
that will make my life easier someday.

-- 
Speech-recognition in use.  It makes mistakes, I correct some.
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Looking for a good Python environment

2007-11-13 Thread Chris Mellon
On Nov 13, 2007 3:56 AM, bramble <[EMAIL PROTECTED]> wrote:
> On Nov 10, 4:48 am, Paul Rudin <[EMAIL PROTECTED]> wrote:
> > jwelby <[EMAIL PROTECTED]> writes:
> >
> > > The main reason I have used Eclipse for larger, team based, projects
> > > is for the source control plug-ins. Eclipse has plug-in support for
> > > cvs and svn. PyScripter may have this too - perhaps I've missed it.
> > > (I'm away from my Windows box at the moment, otherwise I would check).
> > > Of course, there are other ways to implement source control without it
> > > needing to be integrated in the IDE, so even this need not put off
> > > anyone who wants to use PyScripter with source control.
> >
> > > [snip]
> >
> > I'm not sure if you count emacs as "lightweight" but it's certainly
> > less resource hungry than eclipse/pydev, and does have integrated
> > cvs/svn functionality.
>
> I've never understood the desire for using your version control
> software via your IDE. Why not just Alt-Tab over to your terminal
> window and run the svn/bzr/hg/git/whatever commands yourself right
> from there?
>

Because I'm already in my IDE and I'm already managing files from
there. The version integration in Eclipse also has some other handy
features, like showing history in the live document (I can do an svn
blame for the line I'm looking at directly in the editor, without
needing to context switch to a different environment).

In the particular case of Eclipse, Eclipse has it's own "workspace"
and project metaphors, it doesn't work with just any old file it
happens to find. This can be very frustrating at times, but since
that's how Eclipse works it's nice to have source control integrated
into that.

>
> --
> http://mail.python.org/mailman/listinfo/python-list
>
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Looking for a good Python environment

2007-11-13 Thread cokofreedom
On Nov 13, 10:56 am, bramble <[EMAIL PROTECTED]> wrote:
> On Nov 10, 4:48 am, Paul Rudin <[EMAIL PROTECTED]> wrote:
>
> > jwelby <[EMAIL PROTECTED]> writes:
>
> > > The main reason I have used Eclipse for larger, team based, projects
> > > is for the source control plug-ins. Eclipse has plug-in support for
> > > cvs and svn. PyScripter may have this too - perhaps I've missed it.
> > > (I'm away from my Windows box at the moment, otherwise I would check).
> > > Of course, there are other ways to implement source control without it
> > > needing to be integrated in the IDE, so even this need not put off
> > > anyone who wants to use PyScripter with source control.
>
> > > [snip]
>
> > I'm not sure if you count emacs as "lightweight" but it's certainly
> > less resource hungry than eclipse/pydev, and does have integrated
> > cvs/svn functionality.
>
> I've never understood the desire for using your version control
> software via your IDE. Why not just Alt-Tab over to your terminal
> window and run the svn/bzr/hg/git/whatever commands yourself right
> from there?

Because it saves you from having to do this. Some people prefer all
their commands in one place. And GUI wise it is often easier to click
the button showing all previouis versions, or comparing two of them
visually. I use Eclipse with ClearCase and it saves me a great deal of
trouble when dealing with 100+ files...

-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Looking for a good Python environment

2007-11-13 Thread bramble
On Nov 10, 4:48 am, Paul Rudin <[EMAIL PROTECTED]> wrote:
> jwelby <[EMAIL PROTECTED]> writes:
>
> > The main reason I have used Eclipse for larger, team based, projects
> > is for the source control plug-ins. Eclipse has plug-in support for
> > cvs and svn. PyScripter may have this too - perhaps I've missed it.
> > (I'm away from my Windows box at the moment, otherwise I would check).
> > Of course, there are other ways to implement source control without it
> > needing to be integrated in the IDE, so even this need not put off
> > anyone who wants to use PyScripter with source control.
>
> > [snip]
>
> I'm not sure if you count emacs as "lightweight" but it's certainly
> less resource hungry than eclipse/pydev, and does have integrated
> cvs/svn functionality.

I've never understood the desire for using your version control
software via your IDE. Why not just Alt-Tab over to your terminal
window and run the svn/bzr/hg/git/whatever commands yourself right
from there?

-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Looking for a good Python environment

2007-11-13 Thread Nir
On Nov 11, 11:39 pm, Paul Rubin  wrote:
> Russell Warren <[EMAIL PROTECTED]> writes:
> > Wing now has multi-threaded debugging.
>
> Cool, is it windows-only?  I'm using Linux.
>
> > A quick look at the current state of SPE shows that it now has multi-
> > threaded debugging viaWinPDB(what I used to use for debugging thread
> > issues).  Interesting.  Worth a look to see if it is integrated well.
>
> Same issue: this also sounds windows-specific.  Thanks though.

Winpdb may sound to you as windows specific but it actually googles up
as platform independent. Those of you who dare work with a bunch of
separate development tools (oh, the terror, ugh...) instead of an IDE
will find it to be one of the best Python debuggers around.


-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Looking for a good Python environment

2007-11-12 Thread VSmirk
On Nov 11, 4:39 pm, Paul Rubin  wrote:
> Russell Warren <[EMAIL PROTECTED]> writes:
> > Wing now has multi-threaded debugging.
>
> Cool, is it windows-only?  I'm using Linux.
>
> > A quick look at the current state of SPE shows that it now has multi-
> > threaded debugging via WinPDB (what I used to use for debugging thread
> > issues).  Interesting.  Worth a look to see if it is integrated well.
>
> Same issue: this also sounds windows-specific.  Thanks though.

Wing is actually not windows-specific.  They are Linux based as well,
and I believe a number of users are also MacOSX users.

The multi-threading debugging is a new feature with it's latest
release, but I have heard of no platform-specific issues related to it.

-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Looking for a good Python environment

2007-11-11 Thread Paul Rubin
Russell Warren <[EMAIL PROTECTED]> writes:
> Wing now has multi-threaded debugging.

Cool, is it windows-only?  I'm using Linux.

> A quick look at the current state of SPE shows that it now has multi-
> threaded debugging via WinPDB (what I used to use for debugging thread
> issues).  Interesting.  Worth a look to see if it is integrated well.

Same issue: this also sounds windows-specific.  Thanks though.
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Looking for a good Python environment

2007-11-11 Thread Russell Warren
> While we're at it, do any of these debuggers implement a good way to
> debug multi-threaded Python programs?

Wing now has multi-threaded debugging.

I'm a big Wing (pro) fan.  To be fair, when I undertook my huge IDE
evaluation undertaking it was approx 2 years ago... at the time as far
as what I would consider to be a full featured professional IDE it was
IMO really only Wing and Komodo who could compete.  The others were
left in the dust.  Unfortunately both cost money, but it became clear
that at least in this instance you get what you pay for.  Not a big
deal for me because as far as professional development costs the cost
is ridiculously low and I use it professionally, but I could see
balking at the cost if strictly a hobbiest... although I would pay as
I'd be lost without my Wing I think.  At the time, I much preferred
Wing to Komodo, but haven't tried Komodo more than sparingly since
then.  My bet is that the situation would still be similar since Wing
has done nothing but get better over time.  The support crew at Wing
are great, too... the mailing list is excellent and the Wing
developers typically respond very quickly to any support requests, and
even feature requests (I've had a few things added due to the mailing
list).

The biggest missing feature in Wing at the moment is integrating GUI
development.  If you are into that, you may want to look elsewhere.
Any GUI stuff I do I use wxPython and after starting with a template
builder I just manually code the GUIs... painful at times, especially
when you just want to whip up something small, but I've gotten used to
it.  Now that I type this, though, I think I'll go looking for what's
new!  Maybe Boa is less buggy now?  Hmm.

Prior to taking on my "find the ultimate IDE" quest I was using SPE
and it was free and quite decent, just not comparable to Wing.

http://pythonide.stani.be/

A quick look at the current state of SPE shows that it now has multi-
threaded debugging via WinPDB (what I used to use for debugging thread
issues).  Interesting.  Worth a look to see if it is integrated well.

-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Looking for a good Python environment

2007-11-10 Thread PyScripter
PyScripter provides integrated version control, via TortoiseSVN or
TortoiseCVS and the File Explorer.

On Nov 10, 11:21 am, jwelby <[EMAIL PROTECTED]> wrote:
> On Nov 7, 12:42 pm, "Colin J. Williams" <[EMAIL PROTECTED]> wrote:
>
> > jwelby wrote:
> ...
>
> > > I currently use Python Scripter as a lightweight editor for Windows.
>
> > Could you elaborate on "lightweight"
> > please? I findPyScripterto be a
> > powerful editor/debugger combination.
>
> > What functionality does Eclipse have
> > thatPyScripterdoes not?
>
> > Colin W.
>
> This is a fair question. I didn't phrase my post too well.
>
> I findPyScripterdoes pretty much everything I need in terms of doing
> actual development for Python. My use of 'lightweight' is by no means
> a criticism ofPyScripter- it's more of a compliment, as it refers to
> the relatively modest demands that it makes on my system compared with
> Eclipse, which can be hog.
>
> The main reason I have used Eclipse for larger, team based, projects
> is for the source control plug-ins. Eclipse has plug-in support for
> cvs and svn.PyScriptermay have this too - perhaps I've missed it.
> (I'm away from my Windows box at the moment, otherwise I would check).
> Of course, there are other ways to implement source control without it
> needing to be integrated in the IDE, so even this need not put off
> anyone who wants to usePyScripterwith source control.
>
> Summary - unless you need the added flexibility offered by Eclipse
> plug-ins,PyScripteris a great tool for developing with Python on
> Windows.
>
>
>
> > > For project work I use Eclipse, which can be installed with PyDev and
> > > other useful plug-ins already included if you choose a suitable
> > > distribution of Easy Eclipse (http://www.easyeclipse.org/). There is a
> > > distribution specifically for Python development, and also one for
> > > LAMP, which includes a number of other components which will be of use
> > > if you are developing for the web.


-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Looking for a good Python environment

2007-11-10 Thread Paul Rudin
jwelby <[EMAIL PROTECTED]> writes:


> This is a fair question. I didn't phrase my post too well.
>
> I find PyScripter does pretty much everything I need in terms of doing
> actual development for Python. My use of 'lightweight' is by no means
> a criticism of PyScripter - it's more of a compliment, as it refers to
> the relatively modest demands that it makes on my system compared with
> Eclipse, which can be hog.
>
> The main reason I have used Eclipse for larger, team based, projects
> is for the source control plug-ins. Eclipse has plug-in support for
> cvs and svn. PyScripter may have this too - perhaps I've missed it.
> (I'm away from my Windows box at the moment, otherwise I would check).
> Of course, there are other ways to implement source control without it
> needing to be integrated in the IDE, so even this need not put off
> anyone who wants to use PyScripter with source control.
>
> Summary - unless you need the added flexibility offered by Eclipse
> plug-ins, PyScripter is a great tool for developing with Python on
> Windows.

I'm not sure if you count emacs as "lightweight" but it's certainly
less resource hungry than eclipse/pydev, and does have integrated
cvs/svn functionality.
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Looking for a good Python environment

2007-11-10 Thread jwelby
On Nov 7, 12:42 pm, "Colin J. Williams" <[EMAIL PROTECTED]> wrote:
> jwelby wrote:
...
>
> > I currently use Python Scripter as a lightweight editor for Windows.
>
> Could you elaborate on "lightweight"
> please? I find PyScripter to be a
> powerful editor/debugger combination.
>
> What functionality does Eclipse have
> that PyScripter does not?
>
> Colin W.
>

This is a fair question. I didn't phrase my post too well.

I find PyScripter does pretty much everything I need in terms of doing
actual development for Python. My use of 'lightweight' is by no means
a criticism of PyScripter - it's more of a compliment, as it refers to
the relatively modest demands that it makes on my system compared with
Eclipse, which can be hog.

The main reason I have used Eclipse for larger, team based, projects
is for the source control plug-ins. Eclipse has plug-in support for
cvs and svn. PyScripter may have this too - perhaps I've missed it.
(I'm away from my Windows box at the moment, otherwise I would check).
Of course, there are other ways to implement source control without it
needing to be integrated in the IDE, so even this need not put off
anyone who wants to use PyScripter with source control.

Summary - unless you need the added flexibility offered by Eclipse
plug-ins, PyScripter is a great tool for developing with Python on
Windows.

>
> > For project work I use Eclipse, which can be installed with PyDev and
> > other useful plug-ins already included if you choose a suitable
> > distribution of Easy Eclipse (http://www.easyeclipse.org/). There is a
> > distribution specifically for Python development, and also one for
> > LAMP, which includes a number of other components which will be of use
> > if you are developing for the web.


-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Looking for a good Python environment

2007-11-09 Thread Fabio Zadrozny
On 07 Nov 2007 08:50:49 -0800, Paul Rubin <"http://phr.cx"@nospam.invalid>
wrote:

> "Colin J. Williams" <[EMAIL PROTECTED]> writes:
> > Could you elaborate on "lightweight" please? I find PyScripter to be a
> > powerful editor/debugger combination.
> >
> > What functionality does Eclipse have that PyScripter does not?
>
> While we're at it, do any of these debuggers implement a good way to
> debug multi-threaded Python programs?
>

Pydev handles multi-threaded debugging.

Cheers,

Fabio
-- 
http://mail.python.org/mailman/listinfo/python-list

Re: Looking for a good Python environment

2007-11-08 Thread PyScripter
On Nov 7, 6:50 pm, Paul Rubin  wrote:
> "Colin J. Williams" <[EMAIL PROTECTED]> writes:
>
> > Could you elaborate on "lightweight" please? I findPyScripterto be a
> > powerful editor/debugger combination.
>
> > What functionality does Eclipse have thatPyScripterdoes not?
>
> While we're at it, do any of these debuggers implement a good way to
> debug multi-threaded Python programs?

PyScripter (http://pyscripter.googlepages.com) debugging is based on
the standard Python debugger bdb.py which does not currently support
multi-threaded debugging (only the main thread can be debugged).  One
debugger with such support is Winpdb.  PyScripter may integrate Winpdb
in the future.  However PyScripter does support debugging of GUI (e.g.
Tkinter, WxPython) applications with remote debugging.

-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Looking for a good Python environment

2007-11-07 Thread Paul Rubin
"Colin J. Williams" <[EMAIL PROTECTED]> writes:
> Could you elaborate on "lightweight" please? I find PyScripter to be a
> powerful editor/debugger combination.
> 
> What functionality does Eclipse have that PyScripter does not?

While we're at it, do any of these debuggers implement a good way to
debug multi-threaded Python programs?
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Looking for a good Python environment

2007-11-07 Thread VSmirk
On Nov 7, 9:16 am, Gerhard Häring <[EMAIL PROTECTED]> wrote:
> [EMAIL PROTECTED] wrote:
> > Hey, I'm looking for a good Python environment. That is, at least an
> > editor and a debugger, and it should run on Windows. Does anyone have
> > any idea?
>
> I like ERIC. You can get it 
> athttp://www.die-offenbachs.de/eric/eric4-download.html
>
> Or just download and install PyQt4, which includes it:
>
> http://www.riverbankcomputing.com/Downloads/PyQt4/GPL/PyQt-Py2.5-gpl-...
>
> There's also a list of Python IDEs on the Python 
> wiki:http://wiki.python.org/moin/IntegratedDevelopmentEnvironments
>
> -- Gerhard

WingIDE all the way.  After trying a number of deve environments, Wing
was the first I used that actually allowed me to be productive.

They offer a free version, but it's worth getting the professional
version, too.

http://www.wingide.com/

VSmirk

-- 
http://mail.python.org/mailman/listinfo/python-list

Re: Looking for a good Python environment

2007-11-07 Thread Gerhard Häring
[EMAIL PROTECTED] wrote:
> Hey, I'm looking for a good Python environment. That is, at least an
> editor and a debugger, and it should run on Windows. Does anyone have
> any idea?

I like ERIC. You can get it at
http://www.die-offenbachs.de/eric/eric4-download.html

Or just download and install PyQt4, which includes it:

http://www.riverbankcomputing.com/Downloads/PyQt4/GPL/PyQt-Py2.5-gpl-4.3.1-1.exe

There's also a list of Python IDEs on the Python wiki:
http://wiki.python.org/moin/IntegratedDevelopmentEnvironments

-- Gerhard

-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Looking for a good Python environment

2007-11-07 Thread Colin J. Williams
jwelby wrote:
> On Nov 6, 10:56 pm, "[EMAIL PROTECTED]" <[EMAIL PROTECTED]>
> wrote:
>> Hey, I'm looking for a good Python environment. That is, at least an
>> editor and a debugger, and it should run on Windows. Does anyone have
>> any idea?
> 
> I currently use Python Scripter as a lightweight editor for Windows.

Could you elaborate on "lightweight" 
please? I find PyScripter to be a
powerful editor/debugger combination.

What functionality does Eclipse have 
that PyScripter does not?


Colin W.

> 
> For project work I use Eclipse, which can be installed with PyDev and
> other useful plug-ins already included if you choose a suitable
> distribution of Easy Eclipse (http://www.easyeclipse.org/). There is a
> distribution specifically for Python development, and also one for
> LAMP, which includes a number of other components which will be of use
> if you are developing for the web.
> 

-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Looking for a good Python environment

2007-11-07 Thread [EMAIL PROTECTED]
On Nov 7, 1:15 pm, jwelby <[EMAIL PROTECTED]> wrote:
> On Nov 6, 10:56 pm, "[EMAIL PROTECTED]" <[EMAIL PROTECTED]>
> wrote:
>
> > Hey, I'm looking for a good Python environment. That is, at least an
> > editor and a debugger, and it should run on Windows. Does anyone have
> > any idea?
>
> I currently use Python Scripter as a lightweight editor for Windows.
>
> For project work I use Eclipse, which can be installed with PyDev and
> other useful plug-ins already included if you choose a suitable
> distribution of Easy Eclipse (http://www.easyeclipse.org/). There is a
> distribution specifically for Python development, and also one for
> LAMP, which includes a number of other components which will be of use
> if you are developing for the web.

Thanks jewlby, I'll check it out.

-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Looking for a good Python environment

2007-11-07 Thread jwelby
On Nov 6, 10:56 pm, "[EMAIL PROTECTED]" <[EMAIL PROTECTED]>
wrote:
> Hey, I'm looking for a good Python environment. That is, at least an
> editor and a debugger, and it should run on Windows. Does anyone have
> any idea?

I currently use Python Scripter as a lightweight editor for Windows.

For project work I use Eclipse, which can be installed with PyDev and
other useful plug-ins already included if you choose a suitable
distribution of Easy Eclipse (http://www.easyeclipse.org/). There is a
distribution specifically for Python development, and also one for
LAMP, which includes a number of other components which will be of use
if you are developing for the web.

-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Looking for a good Python environment

2007-11-07 Thread Fabio Zadrozny
On 11/6/07, Jens <[EMAIL PROTECTED]> wrote:
>
> Just wrote a mini "review" of three Python code editors on my blog...
>
> http://pyminer.blogspot.com/2007/11/python-code-editors.html
>
> I use PSPad or Notepad++ for quick editing, and Komodo Edit 4.2 for
> longer sessions. Komodo Edit is the only one with code completion - a
> very nice feature. You can pay $299 and get Komodo Edit, which has a
> debugger.
>
> I've only used Eclipse for Java programming, but there's a Python plug-
> in called PyDev - just haven't figured out how to install it :-(
>

Have you checked: http://www.fabioz.com/pydev/manual_101_install.html ?
-- 
http://mail.python.org/mailman/listinfo/python-list

Re: Looking for a good Python environment

2007-11-07 Thread [EMAIL PROTECTED]
On Nov 7, 3:51 am, Jens <[EMAIL PROTECTED]> wrote:
> Just wrote a mini "review" of three Python code editors on my blog...
>
> http://pyminer.blogspot.com/2007/11/python-code-editors.html
>
> I use PSPad or Notepad++ for quick editing, and Komodo Edit 4.2 for
> longer sessions. Komodo Edit is the only one with code completion - a
> very nice feature. You can pay $299 and get Komodo Edit, which has a
> debugger.
>
> I've only used Eclipse for Java programming, but there's a Python plug-
> in called PyDev - just haven't figured out how to install it :-(

Thanks Jeff and thanks Jen. I'll take a look at these editors to see
if they're good for me.

-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Looking for a good Python environment

2007-11-06 Thread Jens
Just wrote a mini "review" of three Python code editors on my blog...

http://pyminer.blogspot.com/2007/11/python-code-editors.html

I use PSPad or Notepad++ for quick editing, and Komodo Edit 4.2 for
longer sessions. Komodo Edit is the only one with code completion - a
very nice feature. You can pay $299 and get Komodo Edit, which has a
debugger.

I've only used Eclipse for Java programming, but there's a Python plug-
in called PyDev - just haven't figured out how to install it :-(

-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Looking for a good Python environment

2007-11-06 Thread Jeff
Pida is a nice looking IDE for Python, written in Python with GTK.
Emacs is decent, Eclipse has support, too.  SciTE is a nice editor if
you are looking for something minimal (such as no debugger).

-- 
http://mail.python.org/mailman/listinfo/python-list


Looking for a good Python environment

2007-11-06 Thread [EMAIL PROTECTED]
Hey, I'm looking for a good Python environment. That is, at least an
editor and a debugger, and it should run on Windows. Does anyone have
any idea?

-- 
http://mail.python.org/mailman/listinfo/python-list


Re: looking for a good python module for MS SQL server

2005-11-02 Thread Jarek Zgoda
Peter Decker napisał(a):

>>Things didn't change, as last update to adodbapi was long time ago... I
>>had no problems with stored procedures accessed using cursor's execute()
>>method (i.e. execute('exec sp_someproc, param')), but I never tried to
>>get any results, just call sp and commit or rollback.
> 
> Can the adodbapi module be used on a Linux/Mac client? If not, what's
> the best choice for cross-platform connectivity to a Microsoft SQL
> Server?

Nope, adodbapi relies on COM/ActiveX subsystem, so it's not available
outside Windows.

PyMSSQL can use DB-LIB or FreeTDS, so it may have use also on
non-windows systems, see http://pymssql.sourceforge.net/ (didn't try
this one, though).

-- 
Jarek Zgoda
http://jpa.berlios.de/
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: looking for a good python module for MS SQL server

2005-11-02 Thread Frank Millman

Peter Decker wrote:
> On 11/1/05, Jarek Zgoda <[EMAIL PROTECTED]> wrote:
>
> > Things didn't change, as last update to adodbapi was long time ago... I
> > had no problems with stored procedures accessed using cursor's execute()
> > method (i.e. execute('exec sp_someproc, param')), but I never tried to
> > get any results, just call sp and commit or rollback.
>
> Can the adodbapi module be used on a Linux/Mac client? If not, what's
> the best choice for cross-platform connectivity to a Microsoft SQL
> Server?
>
> --
>
> # p.d.

I preserved this link from a discussion about a year ago, as I may well
need it one day. I have not actually tried any of the suggestions.

http://groups.google.co.za/group/comp.lang.python/browse_frm/thread/bce901b08536cd89/ba6d5359c3c1b4bd

Frank

-- 
http://mail.python.org/mailman/listinfo/python-list


Re: looking for a good python module for MS SQL server

2005-11-01 Thread Peter Decker
On 11/1/05, Jarek Zgoda <[EMAIL PROTECTED]> wrote:

> Things didn't change, as last update to adodbapi was long time ago... I
> had no problems with stored procedures accessed using cursor's execute()
> method (i.e. execute('exec sp_someproc, param')), but I never tried to
> get any results, just call sp and commit or rollback.

Can the adodbapi module be used on a Linux/Mac client? If not, what's
the best choice for cross-platform connectivity to a Microsoft SQL
Server?

--

# p.d.
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: looking for a good python module for MS SQL server

2005-11-01 Thread Steve Holden
Jarek Zgoda wrote:
> Steve Holden napisał(a):
> 
> 
>>Does anyone know a good python mudule that works with MS SQL server?
>
>Google will yield something, but I prefer adodbapi over specialized
>modules. Works good with SQLServer using SSPI auth (others rather not).

Though it does have problems with stored procedures.
>>>
>>>Didn't discover any of these.
>>>
>>
>>Maybe things have changes since I last used adodbapi - can you actually
>>run stored procedures now?
> 
> 
> Things didn't change, as last update to adodbapi was long time ago... I
> had no problems with stored procedures accessed using cursor's execute()
> method (i.e. execute('exec sp_someproc, param')), but I never tried to
> get any results, just call sp and commit or rollback.
> 
Thanks. The situation does remain unchanged, then.

regards
  Steve
-- 
Steve Holden   +44 150 684 7255  +1 800 494 3119
Holden Web LLC www.holdenweb.com
PyCon TX 2006  www.python.org/pycon/

-- 
http://mail.python.org/mailman/listinfo/python-list


Re: looking for a good python module for MS SQL server

2005-11-01 Thread Jarek Zgoda
Steve Holden napisał(a):

> Does anyone know a good python mudule that works with MS SQL server?

 Google will yield something, but I prefer adodbapi over specialized
 modules. Works good with SQLServer using SSPI auth (others rather not).
>>>
>>> Though it does have problems with stored procedures.
>>
>> Didn't discover any of these.
>>
> Maybe things have changes since I last used adodbapi - can you actually
> run stored procedures now?

Things didn't change, as last update to adodbapi was long time ago... I
had no problems with stored procedures accessed using cursor's execute()
method (i.e. execute('exec sp_someproc, param')), but I never tried to
get any results, just call sp and commit or rollback.

-- 
Jarek Zgoda
http://jpa.berlios.de/
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: looking for a good python module for MS SQL server

2005-11-01 Thread Steve Holden
Jarek Zgoda wrote:
> Steve Holden napisał(a):
> 
> 
Does anyone know a good python mudule that works with MS SQL server?
>>>
>>>Google will yield something, but I prefer adodbapi over specialized
>>>modules. Works good with SQLServer using SSPI auth (others rather not).
>>>
>>
>>Though it does have problems with stored procedures.
> 
> 
> Didn't discover any of these.
> 
Maybe things have changes since I last used adodbapi - can you actually 
run stored procedures now?

regards
  Steve
-- 
Steve Holden   +44 150 684 7255  +1 800 494 3119
Holden Web LLC www.holdenweb.com
PyCon TX 2006  www.python.org/pycon/

-- 
http://mail.python.org/mailman/listinfo/python-list


Re: looking for a good python module for MS SQL server

2005-11-01 Thread Jarek Zgoda
Steve Holden napisał(a):

>>> Does anyone know a good python mudule that works with MS SQL server?
>>
>> Google will yield something, but I prefer adodbapi over specialized
>> modules. Works good with SQLServer using SSPI auth (others rather not).
>>
> Though it does have problems with stored procedures.

Didn't discover any of these.

-- 
Jarek Zgoda
http://jpa.berlios.de/
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: looking for a good python module for MS SQL server

2005-10-31 Thread Frank Millman

Anat wrote:
> Hi,
> Does anyone know a good python mudule that works with MS SQL server?
> Thanks,
> Anat

I use the odbc module from pywin32. I believe that it is not 100%
DB-API 2.0 compliant, but it works fine for me. It has the advantage
that if you have installed pywin32 (which is advisable on MSW anyway)
you do not have to install anything else.

I tried adodbapi a few years ago, and it seemed slow in returning
results. I don't know if it has improved in the meantime.

There is one thing I have not figured out how to do with MS-SQL - I
would be interested if anyone has a solution. I use 'scrollable
cursors' a lot. DB-API does not seem to define any methods to
facilitate this, so I construct them and manage them myself with a
series of cur.execute(...) commands. PostgreSQL allows you to 'fetch'
multiple rows at a time. MS-SQL in its normal mode does not. This is
taken from the on-line help -

"Transact-SQL cursors are limited to fetching one row at a time. API
server cursors support fetching blocks of rows with each fetch. A
cursor that supports fetching multiple rows at a time is called a block
cursor."

It goes on to say that API's which support block cursors are OLE DB,
ODBC, ADO, and DB-Library, and that each one has its own syntax.

Do adodbapi, mxODBC, or any other modules allow you to do this?

Thanks

Frank

-- 
http://mail.python.org/mailman/listinfo/python-list


Re: looking for a good python module for MS SQL server

2005-10-31 Thread Grig Gheorghiu
I successfully used mxODBC
()

Grig

-- 
http://mail.python.org/mailman/listinfo/python-list


Re: looking for a good python module for MS SQL server

2005-10-31 Thread Steve Holden
Jarek Zgoda wrote:
> Anat napisał(a):
> 
> 
>>Does anyone know a good python mudule that works with MS SQL server?
> 
> 
> Google will yield something, but I prefer adodbapi over specialized
> modules. Works good with SQLServer using SSPI auth (others rather not).
> 
Though it does have problems with stored procedures.

regards
  Steve
-- 
Steve Holden   +44 150 684 7255  +1 800 494 3119
Holden Web LLC www.holdenweb.com
PyCon TX 2006  www.python.org/pycon/

-- 
http://mail.python.org/mailman/listinfo/python-list


Re: looking for a good python module for MS SQL server

2005-10-31 Thread Brian
I've had good results with adodbapi as well.

-- 
http://mail.python.org/mailman/listinfo/python-list


Re: looking for a good python module for MS SQL server

2005-10-31 Thread Jarek Zgoda
Anat napisał(a):

> Does anyone know a good python mudule that works with MS SQL server?

Google will yield something, but I prefer adodbapi over specialized
modules. Works good with SQLServer using SSPI auth (others rather not).

-- 
Jarek Zgoda
http://jpa.berlios.de/
-- 
http://mail.python.org/mailman/listinfo/python-list


looking for a good python module for MS SQL server

2005-10-31 Thread Anat
Hi,
Does anyone know a good python mudule that works with MS SQL server?
Thanks,
Anat 


-- 
http://mail.python.org/mailman/listinfo/python-list