Re: Love to get some feedback on my first python app!!!

2014-09-20 Thread Nicholas Cannon
I have just committed a new main.py file on github. I added alot more comments and slimmed down the getinfo() function. -- https://mail.python.org/mailman/listinfo/python-list

one problem in cx_Freeze4.3.3 for Python3.4

2014-09-20 Thread 8pa2y han
#torrent.py - import re import urllib.request import urllib.parse urltemp = 'https://btdigg.org/search?info_hash=&q=' urlinput = urllib.parse.quote(input('Please input keywords:')) url = urltemp + urlinput print('Searching'+'\n'+url) cont

Re: Love to get some feedback on my first python app!!!

2014-09-20 Thread Chris Angelico
On Sun, Sep 21, 2014 at 11:33 AM, Nicholas Cannon wrote: > Yeah this is exactly what I was looking for I know the comments are horrible > and I had no idea about the camelCase stuff. Should I use > ''' > Use this commenting on my functions or not. I think they are called > docStrings or somethin

Re: Love to get some feedback on my first python app!!!

2014-09-20 Thread Nicholas Cannon
On Saturday, September 20, 2014 9:17:27 PM UTC+8, Nicholas Cannon wrote: > I have created my first python program and I have learnt a lot about python > from this group and wanted some feedback. I am still improving it and trying > to tackle some performance and GUI stuff so keep that in mind. I

Re: Pybuez Client sending messages to j2me Server

2014-09-20 Thread kabugimatu
On Wednesday, May 6, 2009 11:38:16 AM UTC+3, CkurtM wrote: > I have a problem with recieving requests on j2me based bluetooth > server using RFCOMM. I can send messages from the j2me client to > python server, but cant receive from the python bluetooth client to > j2me server, it only connects but

Re: Class Inheritance from different module

2014-09-20 Thread Peter Otten
Juan Christian wrote: > I have the following structure: > > Third-party API installed via pip: > steamapi / > app.py > consts.py > core.py > users.py > [...] > > My script: > test.py > > > In the API, the module users.py has a class 'SteamUser' and I want to > mimic it's usage on my code, like

Re: Love to get some feedback on my first python app!!!

2014-09-20 Thread Mark Lawrence
On 20/09/2014 15:58, Chris Angelico wrote: On Sat, Sep 20, 2014 at 11:16 PM, Nicholas Cannon wrote: You may also notice that the camelCase variable names you're using are in stark contrast to the rest of the language. It's normal to use lower_case_with_underscores instead. That may be the PEP

Re: Love to get some feedback on my first python app!!!

2014-09-20 Thread Chris Angelico
On Sat, Sep 20, 2014 at 11:16 PM, Nicholas Cannon wrote: > I have created my first python program and I have learnt a lot about python > from this group and wanted some feedback. I am still improving it and trying > to tackle some performance and GUI stuff so keep that in mind. I don't think >

Re: Class Inheritance from different module

2014-09-20 Thread Steven D'Aprano
Juan Christian wrote: [...] > In the API, the module users.py has a class 'SteamUser' and I want to > mimic it's usage on my code, like this: > > import steamapi > > [...] > > class User(Inheritance from API): What do you mean, "Inheritance from API"? You can't inherit from an API, only from c

Class Inheritance from different module

2014-09-20 Thread Juan Christian
I have the following structure: Third-party API installed via pip: steamapi / app.py consts.py core.py users.py [...] My script: test.py In the API, the module users.py has a class 'SteamUser' and I want to mimic it's usage on my code, like this: import steamapi [...] class User(Inheritance

Love to get some feedback on my first python app!!!

2014-09-20 Thread Nicholas Cannon
I have created my first python program and I have learnt a lot about python from this group and wanted some feedback. I am still improving it and trying to tackle some performance and GUI stuff so keep that in mind. I don't think it is the best program but is a good product of 3 months of python

Re: pad binary string with a given byte value (python 3)

2014-09-20 Thread Peter Otten
Nagy László Zsolt wrote: > >>> bytes/str.ljust() >>> >> def pad(b, n=16, c=b"\x0f"): >>> ... length = (len(b)+n-1)//n*n >>> ... return b.ljust(length, c) >> Thanks! > One more question. How do I create a single char binary string from a > number? E.g. > > >>> bytes([65]) > b'A' > >

Re: pad binary string with a given byte value (python 3)

2014-09-20 Thread Nagy László Zsolt
bytes/str.ljust() def pad(b, n=16, c=b"\x0f"): ... length = (len(b)+n-1)//n*n ... return b.ljust(length, c) Thanks! One more question. How do I create a single char binary string from a number? E.g. >>> bytes([65]) b'A' It seems to be wrong again. The bytes constructor requires a

Re: pad binary string with a given byte value (python 3)

2014-09-20 Thread Peter Otten
Nagy László Zsolt wrote: > I can figure out way for example this: > > >>> b'T'+bytearray([32]) > > but it just don't seem right to create a list, then convert it to a byte > array and then convert it to a binary string. What am I missing? By the way, you can repeat bytes (and strings) by multip

Re: pad binary string with a given byte value (python 3)

2014-09-20 Thread Nagy László Zsolt
bytes/str.ljust() def pad(b, n=16, c=b"\x0f"): ... length = (len(b)+n-1)//n*n ... return b.ljust(length, c) Thanks! -- This message has been scanned for viruses and dangerous content by MailScanner, and is believed to be clean. -- https://mail.python.org/mailman/listinfo/python-li

Re: pad binary string with a given byte value (python 3)

2014-09-20 Thread Steven D'Aprano
Nagy László Zsolt wrote: > >>> BS = 16 > >>> pad = lambda s: s + (BS - len(s) % BS) * chr(BS - len(s) % BS) > >>> pad('L') > 'L\x0f\x0f\x0f\x0f\x0f\x0f\x0f\x0f\x0f\x0f\x0f\x0f\x0f\x0f\x0f' > >>> pad(b'L') > Traceback (most recent call last): >File "", line 1, in >File "", line 1, in

Re: pad binary string with a given byte value (python 3)

2014-09-20 Thread Peter Otten
Nagy László Zsolt wrote: > >>> BS = 16 > >>> pad = lambda s: s + (BS - len(s) % BS) * chr(BS - len(s) % BS) > >>> pad('L') > 'L\x0f\x0f\x0f\x0f\x0f\x0f\x0f\x0f\x0f\x0f\x0f\x0f\x0f\x0f\x0f' > >>> pad(b'L') > Traceback (most recent call last): >File "", line 1, in >File "", line 1, in

pad binary string with a given byte value (python 3)

2014-09-20 Thread Nagy László Zsolt
>>> BS = 16 >>> pad = lambda s: s + (BS - len(s) % BS) * chr(BS - len(s) % BS) >>> pad('L') 'L\x0f\x0f\x0f\x0f\x0f\x0f\x0f\x0f\x0f\x0f\x0f\x0f\x0f\x0f\x0f' >>> pad(b'L') Traceback (most recent call last): File "", line 1, in File "", line 1, in TypeError: can't concat bytes to str How do I