Re: a python console in bluestacks

2014-08-13 Thread Cameron Simpson
On 14Aug2014 08:25, Chris =?utf-8?B?4oCcS3dwb2xza2HigJ0=?= Warrick wrote: On Aug 14, 2014 4:30 AM, "luofeiyu" wrote: I have installed bluestacks(an android phone emulator) on my pc,and SL4A on it.Now i can run python thish way : 1.edit an file ending with .py, save it in /sdcard/sl4a/script

Re: newbee

2014-08-13 Thread Bob Martin
in 726715 20140813 103037 Chris Angelico wrote: >On Wed, Aug 13, 2014 at 9:57 AM, Frank Scafidi wrote: >> I just acquired a Raspberry Pi and want to program in Python. I was a PL/1 >> programmer back in the 60's & 70's and Python is similar. I am struggling >>

Re: how to change the time string into number?

2014-08-13 Thread luofeiyu
in the manual https://docs.python.org/3.4/library/time.html %z Time zone offset indicating a positive or negative time difference from UTC/GMT of the form +HHMM or -HHMM, where H represents decimal hour digits and M represents decimal minute digits [-23:59, +23:59]. %Z Time zone name

Re: newbee

2014-08-13 Thread Chris “Kwpolska” Warrick
On Aug 13, 2014 9:34 PM, "Terry Reedy" wrote: > Have you verified that Idle *does* (not just *should*) run on RPi? (That would mean having tcl/tk running, with whatever *it* requires on linux.) I am working on Idle and the idea of people (especially hobbyists, students, and other amateurs) running

Re: a python console in bluestacks

2014-08-13 Thread Chris “Kwpolska” Warrick
On Aug 14, 2014 4:30 AM, "luofeiyu" wrote: > > I have installed bluestacks(an android phone emulator) on my pc,and SL4A on it.Now i can run python thish way : > 1.edit an file ending with .py, save it in /sdcard/sl4a/scripts/yourname.py. > 2.open sl4a ,and click the file to make it run. > > Is the

Re: how to write file into my android phone?

2014-08-13 Thread Chris “Kwpolska” Warrick
On Aug 14, 2014 8:11 AM, "alex23" wrote: > > On 10/08/2014 7:08 PM, Chris “Kwpolska” Warrick wrote: >>> >>> 2) the phone isn't necessarily visible on a pc as a drive at all. >>> For example the Samsung gs4. >> >> >> This is actually true for ALL android devices, starting with Android 3.0. > > >

Re: how to write file into my android phone?

2014-08-13 Thread alex23
On 10/08/2014 7:08 PM, Chris “Kwpolska” Warrick wrote: 2) the phone isn't necessarily visible on a pc as a drive at all. For example the Samsung gs4. This is actually true for ALL android devices, starting with Android 3.0. This isn't true for my Samsung gs2 running Android 4.1.2. -- https:

Re: how to change the time string into number?

2014-08-13 Thread Marko Rauhamaa
Tim Chase : > Or, if you want a more convoluted way: > > >>> import calendar as c > >>> [i for i, m in enumerate(c.month_abbr) if m == "Aug"].pop() > 8 Let's not forget the much simpler solutions: >>> def eight(x): return 8 ... >>> eight("Aug") 8 and: >>> 8 8 BTW,

Re: [OT] Awesome bug of the week

2014-08-13 Thread Xavier Ho
Haha! On 14 August 2014 14:54, Steven D'Aprano wrote: > Nothing to do with Python, but awesome: "OpenOffice won't print on > Tuesdays". > > https://bugs.launchpad.net/ubuntu/+source/cupsys/+bug/255161/comments/28 > > > > -- > Steven > -- > https://mail.python.org/mailman/listinfo/python-list >

Optional static typing

2014-08-13 Thread Steven D'Aprano
The BDFL Guido van Rossum is considering optional static typing (ish) for Python 3.5: https://mail.python.org/pipermail/python-ideas/2014-August/028618.html Does anyone here use function annotations? If so, what do you use them for? -- Steven -- https://mail.python.org/mailman/listinfo/py

[OT] Awesome bug of the week

2014-08-13 Thread Steven D'Aprano
Nothing to do with Python, but awesome: "OpenOffice won't print on Tuesdays". https://bugs.launchpad.net/ubuntu/+source/cupsys/+bug/255161/comments/28 -- Steven -- https://mail.python.org/mailman/listinfo/python-list

Re: what is the "/" mean in __init__(self, /, *args, **kwargs) ?

2014-08-13 Thread Terry Reedy
On 8/13/2014 10:20 PM, Ethan Furman wrote: On 08/13/2014 07:01 PM, luofeiyu wrote: help(int.__init__) Help on wrapper_descriptor: __init__(self, /, *args, **kwargs) Initialize self. See help(type(self)) for accurate signature. what is the "/" mean in __init__(self, /, *args, **kwargs) ?

Re: what is the "/" mean in __init__(self, /, *args, **kwargs) ?

2014-08-13 Thread Ben Finney
Tim Chase writes: > On 2014-08-14 10:01, luofeiyu wrote: > > >>> help(int.__init__) > > Help on wrapper_descriptor: > > > > __init__(self, /, *args, **kwargs) > > Initialize self. See help(type(self)) for accurate signature. > > > > what is the "/" mean in __init__(self, /, *args, **kwar

Re: how to change the time string into number?

2014-08-13 Thread Roy Smith
In article <53ec2453$0$2299$426a7...@news.free.fr>, YBM wrote: > Le 14/08/2014 04:16, Tim Chase a écrit : > > On 2014-08-13 21:01, Tim Chase wrote: > >> On 2014-08-14 09:46, luofeiyu wrote: > >>> s="Aug" > >>> > >>> how can i change it into 8 with some python time module? > >> > >> >>> import

Re: web2py and python3

2014-08-13 Thread Chris Angelico
On Thu, Aug 14, 2014 at 12:21 PM, Dan Stromberg wrote: > I don't think I'm going to be doing web2py anytime soon. :( But I > was hoping it'd be a better alternative than Django for web > development. I'm no expert on Python web frameworks, but the only one that I've used seems to be pretty dec

Re: how to change the time string into number?

2014-08-13 Thread Ian Kelly
On Wed, Aug 13, 2014 at 8:51 PM, YBM wrote: > BTW, why iterators does not have such an index method ? Because iterators don't support indexing. In order to support such a thing, it would have to exhaust the iterator. >>> iter(range(5))[3] Traceback (most recent call last): File "", line 1, in

Re: how to change the time string into number?

2014-08-13 Thread YBM
Le 14/08/2014 04:16, Tim Chase a écrit : On 2014-08-13 21:01, Tim Chase wrote: On 2014-08-14 09:46, luofeiyu wrote: s="Aug" how can i change it into 8 with some python time module? >>> import time >>> s = "Aug" >>> time.strptime(s, "%b").tm_mon 8 works for me. Or, if you want a mo

a python console in bluestacks

2014-08-13 Thread luofeiyu
I have installed bluestacks(an android phone emulator) on my pc,and SL4A on it.Now i can run python thish way : 1.edit an file ending with |.py|, save it in /sdcard/sl4a/scripts/yourname.py. 2.open sl4a ,and click the file to make it run. Is there a python console to type python command to run

web2py and python3

2014-08-13 Thread Dan Stromberg
I heard there was a presentation about web2py in my area tonight. Trying to decide if I wanted to attend, I googled about web2py and python3. I was amazed by what I found. I've never seen a group so opposed to python3. They make the old (and long-since lost) Solaris 2 wars seem tame. I don't th

Re: what is the "/" mean in __init__(self, /, *args, **kwargs) ?

2014-08-13 Thread Ethan Furman
On 08/13/2014 07:12 PM, Tim Chase wrote: Where are you seeing this? Probably in 3.4, or the tip (what will be 3.5). -- ~Ethan~ -- https://mail.python.org/mailman/listinfo/python-list

Re: what is the "/" mean in __init__(self, /, *args, **kwargs) ?

2014-08-13 Thread Ethan Furman
On 08/13/2014 07:01 PM, luofeiyu wrote: help(int.__init__) Help on wrapper_descriptor: __init__(self, /, *args, **kwargs) Initialize self. See help(type(self)) for accurate signature. what is the "/" mean in __init__(self, /, *args, **kwargs) ? The '/' means that all arguments before i

Re: how to change the time string into number?

2014-08-13 Thread Tim Chase
On 2014-08-13 21:01, Tim Chase wrote: > On 2014-08-14 09:46, luofeiyu wrote: > > s="Aug" > > > > how can i change it into 8 with some python time module? > > >>> import time > >>> s = "Aug" > >>> time.strptime(s, "%b").tm_mon > 8 > > works for me. Or, if you want a more convoluted way: >>

Re: what is the "/" mean in __init__(self, /, *args, **kwargs) ?

2014-08-13 Thread Tim Chase
On 2014-08-14 10:01, luofeiyu wrote: > >>> help(int.__init__) > Help on wrapper_descriptor: > > __init__(self, /, *args, **kwargs) > Initialize self. See help(type(self)) for accurate signature. > > what is the "/" mean in __init__(self, /, *args, **kwargs) ? Where are you seeing this?

Re: what is the "/" mean in __init__(self, /, *args, **kwargs) ?

2014-08-13 Thread Ben Finney
luofeiyu writes: > >>> help(int.__init__) > Help on wrapper_descriptor: > > __init__(self, /, *args, **kwargs) > Initialize self. See help(type(self)) for accurate signature. > > what is the "/" mean in __init__(self, /, *args, **kwargs) ? I don't know, I haven't seen that before. It is con

Re: newbee

2014-08-13 Thread Larry Hudson
On 08/12/2014 04:57 PM, Frank Scafidi wrote: I just acquired a Raspberry Pi and want to program in Python. I was a PL/1 programmer back in the 60's & 70's and Python is similar. I am struggling with some very fundamental things that I am not finding in the documentation. Can someone help me wit

Re: how to change the time string into number?

2014-08-13 Thread Tim Chase
On 2014-08-14 09:46, luofeiyu wrote: > s="Aug" > > how can i change it into 8 with some python time module? >>> import time >>> s = "Aug" >>> time.strptime(s, "%b").tm_mon 8 works for me. -tkc -- https://mail.python.org/mailman/listinfo/python-list

Re: how to change the time string into number?

2014-08-13 Thread Ben Finney
luofeiyu writes: > s="Aug" > > how can i change it into 8 with some python time module? What is your purpose here? If you want to parse a text value into a structured time object, don't do it piece by piece. Use the ‘time.strptime’ function. >>> import time >>> input_time_text = "14 Aug

what is the "/" mean in __init__(self, /, *args, **kwargs) ?

2014-08-13 Thread luofeiyu
>>> help(int.__init__) Help on wrapper_descriptor: __init__(self, /, *args, **kwargs) Initialize self. See help(type(self)) for accurate signature. what is the "/" mean in __init__(self, /, *args, **kwargs) ? -- https://mail.python.org/mailman/listinfo/python-list

Re: how to change the time string into number?

2014-08-13 Thread Chris Angelico
On Thu, Aug 14, 2014 at 11:46 AM, luofeiyu wrote: > s="Aug" > > how can i change it into 8 with some python time module? Is this homework? If not, let me set you some homework. Step 1: Read the docs for some Python time module. Step 2: See if it lets you do what you want. Step 3: Return to step

how to change the time string into number?

2014-08-13 Thread luofeiyu
s="Aug" how can i change it into 8 with some python time module? -- https://mail.python.org/mailman/listinfo/python-list

Re: Captcha identify

2014-08-13 Thread Chris Angelico
On Thu, Aug 14, 2014 at 6:16 AM, Ian Kelly wrote: > On Wed, Aug 13, 2014 at 1:43 PM, Chris Angelico wrote: >> There are alternatives that are both easier for legit people and >> harder for spambots. Some rely on the fact that humans read things two >> dimensionally, and scripts look at the underl

Re: Captcha identify

2014-08-13 Thread Ian Kelly
On Wed, Aug 13, 2014 at 2:01 PM, Tim Chase wrote: > On 2014-08-13 12:24, Chris Kaynor wrote: >> Many of the better captchas also include options for an audio cue in >> addition to the default visual one. > > Have you actually tried to use the audio cue? They're atrocious. I > got more intelligib

Re: Need simple Python Script

2014-08-13 Thread Terry Reedy
On 8/13/2014 12:11 PM, taifuls...@gmail.com wrote: I am new in Python programming. > Currently reading the book " Learn Python the Heard Way". The title is '... Hard Way'. This is literally true. The author 'warns' beginners to not learn Python 3, which is easier to learn than Python 2, and

Re: Captcha identify

2014-08-13 Thread Eric S. Johansson
On 8/13/2014 3:27 PM, Chris Angelico wrote: I agree with you, and I don't use CAPTCHAs on any of my services, anywhere, and never have. (Partly because they *are* broken by people writing scripts, and/or by just grinding them with human solvers; but also because of the problems they cause for le

Re: Captcha identify

2014-08-13 Thread Ian Kelly
On Wed, Aug 13, 2014 at 1:43 PM, Chris Angelico wrote: > There are alternatives that are both easier for legit people and > harder for spambots. Some rely on the fact that humans read things two > dimensionally, and scripts look at the underlying structure; so, for > instance, random field names a

Re: Captcha identify

2014-08-13 Thread Tim Chase
On 2014-08-13 12:24, Chris Kaynor wrote: > Many of the better captchas also include options for an audio cue in > addition to the default visual one. Have you actually tried to use the audio cue? They're atrocious. I got more intelligible words out of my old 8-bit SoundBlaster or a de-tuned radi

Re: Captcha identify

2014-08-13 Thread Skip Montanaro
On Wed, Aug 13, 2014 at 2:44 PM, Joel Goldstick wrote: > I wrote a sample form page with a simple math problem to solve -- 2 or > 3 random small integers to add ... I've also seen challenge systems where they present you with a small set of images and ask you to select one with a particular prope

Re: Captcha identify

2014-08-13 Thread Joel Goldstick
On Wed, Aug 13, 2014 at 3:24 PM, Chris Kaynor wrote: > On Wed, Aug 13, 2014 at 4:39 AM, Eric S. Johansson wrote: >> >> eliminate captchas, 35+million disabled people would thank you as would >> many more millions of the not-yet-disabled like your future self. > > > And so would the spammers, whic

Re: Captcha identify

2014-08-13 Thread Chris Angelico
On Thu, Aug 14, 2014 at 5:24 AM, Chris Kaynor wrote: > On Wed, Aug 13, 2014 at 4:39 AM, Eric S. Johansson wrote: >> >> eliminate captchas, 35+million disabled people would thank you as would >> many more millions of the not-yet-disabled like your future self. > > > And so would the spammers, whic

Re: newbee

2014-08-13 Thread Terry Reedy
On 8/13/2014 7:55 AM, alister wrote: I am not in the same league as many of the posters here when it comes to Python but fortunately i do have two Raspberry Pi's :-) Great! We really someone with hands-on experience. if you are running the Pi connected to a TV/Monitor with the Gui enabled th

Re: Captcha identify

2014-08-13 Thread Chris Kaynor
On Wed, Aug 13, 2014 at 4:39 AM, Eric S. Johansson wrote: > eliminate captchas, 35+million disabled people would thank you as would > many more millions of the not-yet-disabled like your future self. And so would the spammers, which is who captchas are trying to block. For ease-of-use, most si

Re: Captcha identify

2014-08-13 Thread Chris Angelico
On Wed, Aug 13, 2014 at 9:39 PM, Eric S. Johansson wrote: > you are clear but also missing a really good reason to break captchas. > handicapped accessibility. Captchas are a huge barrier to access and in > many cases push disabled users away from using a service with captchas. > For me (very ac

Re: Captcha identify

2014-08-13 Thread Eric S. Johansson
On 8/12/2014 9:46 PM, Chris Angelico wrote: On Wed, Aug 13, 2014 at 11:36 AM, Wesley wrote: If my questions make you guys not so happy, I am sorry and please just ignore. I just wanna a general suggestion here in the beginning. Why I need to write such program is just having such requirements,

Re: Arbitrary dunder attributes (was Re: odd difference calling function from class or instance variable)

2014-08-13 Thread Terry Reedy
On 8/13/2014 5:51 AM, Chris Angelico wrote: On Wed, Aug 13, 2014 at 7:06 PM, GregS wrote: When I assign the reference as a class variable, the reference has __self__ set, too, so I get an extra argument passed to the function. If I assign the reference as an instance variable, then __self__ is

Re: Why does str not have a __radd__ method?

2014-08-13 Thread Jason Swails
On Wed, Aug 13, 2014 at 1:55 PM, Steven D'Aprano < steve+comp.lang.pyt...@pearwood.info> wrote: > Ethan Furman wrote: > > > On 08/13/2014 09:00 AM, Steven D'Aprano wrote: > >> > >> What is the rationale for str not having __radd__ method? > > > > At a guess I would say because string only knows ho

Re: Why does str not have a __radd__ method?

2014-08-13 Thread Ethan Furman
On 08/13/2014 10:55 AM, Steven D'Aprano wrote: Ethan Furman wrote: On 08/13/2014 09:00 AM, Steven D'Aprano wrote: What is the rationale for str not having __radd__ method? At a guess I would say because string only knows how to add itself to other strings, so __add__ is sufficient. # Pyth

Re: Captcha identify

2014-08-13 Thread Chris Angelico
On Thu, Aug 14, 2014 at 3:52 AM, Steven D'Aprano wrote: >> I need it for stuff, so dont worry > > :-) > > You'll only use it for good, right? He needs it for stuffing. Remind me to decline any invitation to turkey dinner that he sends. ChrisA -- https://mail.python.org/mailman/listinfo/python-l

Re: Log base 2 of large integers

2014-08-13 Thread Ian Kelly
On Wed, Aug 13, 2014 at 10:18 AM, Chris Angelico wrote: > On Thu, Aug 14, 2014 at 2:12 AM, Peter Pearson > wrote: >> MK Shen used to hang out on the sci.crypt newsgroup, so we're >> probably talking "cryptographically large" rather than "engineeringly >> large". > > So "fairly large" means somew

Re: Why does str not have a __radd__ method?

2014-08-13 Thread Steven D'Aprano
Ethan Furman wrote: > On 08/13/2014 09:00 AM, Steven D'Aprano wrote: >> >> What is the rationale for str not having __radd__ method? > > At a guess I would say because string only knows how to add itself to > other strings, so __add__ is sufficient. # Python 2.7 py> "Hello" + u"World" u'HelloWor

Re: Captcha identify

2014-08-13 Thread Steven D'Aprano
Rob Gaddi wrote: > On Tue, 12 Aug 2014 18:36:21 -0700 (PDT) > Wesley wrote: > >> If my questions make you guys not so happy, I am sorry and please just >> ignore. I just wanna a general suggestion here in the beginning. >> Why I need to write such program is just having such requirements, and >>

Re: Why does str not have a __radd__ method?

2014-08-13 Thread Ethan Furman
On 08/13/2014 09:00 AM, Steven D'Aprano wrote: What is the rationale for str not having __radd__ method? At a guess I would say because string only knows how to add itself to other strings, so __add__ is sufficient. -- ~Ethan~ -- https://mail.python.org/mailman/listinfo/python-list

Re: Python Object Systems

2014-08-13 Thread thequietcenter
On Wednesday, August 13, 2014 4:32:04 AM UTC-4, Michele Simionato wrote: > Years ago I wrote strait: https://pypi.python.org/pypi/strait What is the difference between traits and roles? -- https://mail.python.org/mailman/listinfo/python-list

Re: Need simple Python Script

2014-08-13 Thread John Gordon
In <0ec17bee-0ed6-4494-b4ab-231988031...@googlegroups.com> taifuls...@gmail.com writes: > I am new in Python programming.Currently reading the book " Learn Python > the Heard Way".However i need a python script which will take an image > file (any standard format) from my windows pc as input.Can

Re: newbee

2014-08-13 Thread William Ray Wing
On Aug 13, 2014, at 9:57 AM, alister wrote: > On Wed, 13 Aug 2014 15:13:34 +0200, Mok-Kong Shen wrote: > >> Am 13.08.2014 13:55, schrieb alister: >> [snip] >> >> A related question: How could one write a Python program and have it run >> on a mobile phone in general (independent of a PC)? >> >

Re: Captcha identify

2014-08-13 Thread Rob Gaddi
On Tue, 12 Aug 2014 18:36:21 -0700 (PDT) Wesley wrote: > If my questions make you guys not so happy, I am sorry and please just ignore. > I just wanna a general suggestion here in the beginning. > Why I need to write such program is just having such requirements, and has > nothing to do with the

Re: Log base 2 of large integers

2014-08-13 Thread Marko Rauhamaa
Peter Pearson : > MK Shen used to hang out on the sci.crypt newsgroup, so we're probably > talking "cryptographically large" rather than "engineeringly large". I'm thinking we're talking about philosophically large. Those kinds of numbers are unwieldy from all angles, including cryptography. Ma

Re: Log base 2 of large integers

2014-08-13 Thread Chris Angelico
On Thu, Aug 14, 2014 at 2:12 AM, Peter Pearson wrote: > MK Shen used to hang out on the sci.crypt newsgroup, so we're > probably talking "cryptographically large" rather than "engineeringly > large". So "fairly large" means somewhere between googolplex an Graham's Number, and after that they'd be

Re: Need simple Python Script

2014-08-13 Thread Chris Angelico
On Thu, Aug 14, 2014 at 2:11 AM, wrote: > I am new in Python programming.Currently reading the book " Learn Python the > Heard Way".However i need a python script which will take an image file (any > standard format) from my windows pc as input.Can anybody have any solution?I > use command pro

Need simple Python Script

2014-08-13 Thread taifulsust
Hello Guys I am new in Python programming.Currently reading the book " Learn Python the Heard Way".However i need a python script which will take an image file (any standard format) from my windows pc as input.Can anybody have any solution?I use command prompt and gedit to learn python. Thanks

Re: Log base 2 of large integers

2014-08-13 Thread Peter Pearson
On Wed, 13 Aug 2014 15:58:02 +0200, Peter Otten <__pete...@web.de> wrote: > Mok-Kong Shen wrote: > >> I like to compute log base 2 of a fairly large integer n but >> with math.log(n,2) I got: >> >> OverflowError: long int too large to convert to float. [snip] > Or maybe our idea of "fairly large

Why does str not have a __radd__ method?

2014-08-13 Thread Steven D'Aprano
I just tried to override str.__radd__: class Special(str): def __radd__(self, other): print("I'm special!") return super().__radd__(self, other) My __radd__ method was called correctly by the + operator, but to my surprise, the super().__radd__ call failed with: Traceback (mo

Re: Python and IDEs [was Re: Python 3 is killing Python]

2014-08-13 Thread Mark Lawrence
On 13/08/2014 11:42, Wolfgang Keller wrote: By the way, you keep replying to people, and quoting them, but deleting their name. Please leave the attribution in place, so we know who you are replying to. That's what the "References:"-Header is there for. The References header is for the benefi

Re: Begginer in python trying to load a .dll

2014-08-13 Thread c1234 py
Thanks a lot. El martes, 12 de agosto de 2014 17:17:26 UTC-3, Mark Lawrence escribió: > On 12/08/2014 20:25, c1234 py wrote: > > > El martes, 12 de agosto de 2014 16:16:21 UTC-3, Christian Gollwitzer > > escribi�: > > >> Am 12.08.14 20:36, schrieb c1223: > > >> > > >>> Hi, Im working i

Re: Suitable Python code to scrape specific details from web pages.

2014-08-13 Thread Denis McMahon
On Tue, 12 Aug 2014 13:00:30 -0700, Simon Evans wrote: > in accessing from the 'Racing Post' on a daily basis. Anyhow, the code Following is some starter code. You will have to look at the output, compare it to the web page, and work out how you want to process it further. Note that I use beaut

Re: Log base 2 of large integers

2014-08-13 Thread Peter Otten
Steven D'Aprano wrote: > Mok-Kong Shen wrote: > >> >> I like to compute log base 2 of a fairly large integer n but >> with math.log(n,2) I got: >> >> OverflowError: long int too large to convert to float. >> >> Is there any feasible work-around for that? > > If you want the integer log2, that

Re:Log base 2 of large integers

2014-08-13 Thread Dave Angel
Mok-Kong Shen Wrote in message: > > I like to compute log base 2 of a fairly large integer n but > with math.log(n,2) I got: > > OverflowError: long int too large to convert to float. > > Is there any feasible work-around for that? > > Thanks in advance. > > M. K. Shen > Easiest way to get

Re: Arbitrary dunder attributes (was Re: odd difference calling function from class or instance variable)

2014-08-13 Thread Chris Angelico
On Wed, Aug 13, 2014 at 11:12 PM, Steven D'Aprano wrote: > Chris Angelico wrote: > >> The bound method object stores a reference to the original object (the >> thing that becomes the first argument to the target function) in >> __self__ (and the function in __func__). ISTM this ought to be _self >

Re: Log base 2 of large integers

2014-08-13 Thread Andrew Jaffe
On 13/08/2014 14:46, Mok-Kong Shen wrote: Am 13.08.2014 15:32, schrieb Steven D'Aprano: Mok-Kong Shen wrote: I like to compute log base 2 of a fairly large integer n but with math.log(n,2) I got: OverflowError: long int too large to convert to float. Is there any feasible work-around for th

Re: newbee

2014-08-13 Thread alister
On Wed, 13 Aug 2014 15:13:34 +0200, Mok-Kong Shen wrote: > Am 13.08.2014 13:55, schrieb alister: > [snip] > > A related question: How could one write a Python program and have it run > on a mobile phone in general (independent of a PC)? > > M. K. Shen you would need a python interpreter for tha

Re: Log base 2 of large integers

2014-08-13 Thread Peter Otten
Mok-Kong Shen wrote: > I like to compute log base 2 of a fairly large integer n but > with math.log(n,2) I got: > > OverflowError: long int too large to convert to float. > > Is there any feasible work-around for that? What version of Python are you using? Python 2.7 can handle "fairly large"

Re: Log base 2 of large integers

2014-08-13 Thread Mok-Kong Shen
Am 13.08.2014 15:16, schrieb Skip Montanaro: http://gnumbers.blogspot.com/2011/10/logarithm-of-large-number-it-is-not.html Might be worth studying for ideas. Thanks. I think the idea may help. M. K. Shen -- https://mail.python.org/mailman/listinfo/python-list

Re: Log base 2 of large integers

2014-08-13 Thread Mok-Kong Shen
Am 13.08.2014 15:32, schrieb Steven D'Aprano: Mok-Kong Shen wrote: I like to compute log base 2 of a fairly large integer n but with math.log(n,2) I got: OverflowError: long int too large to convert to float. Is there any feasible work-around for that? If you want the integer log2, that is

Re: Python and IDEs [was Re: Python 3 is killing Python]

2014-08-13 Thread Steven D'Aprano
Wolfgang Keller wrote: > I've been using mail and news for over 20 years now, you definitely > don't need to teach me anything. Except common courtesy. You may have been rude for over 20 years, but I don't have to put up with it for a second longer. > Good Bye, Agreed. *plonk* -- Steven -

Re: Log base 2 of large integers

2014-08-13 Thread Steven D'Aprano
Mok-Kong Shen wrote: > > I like to compute log base 2 of a fairly large integer n but > with math.log(n,2) I got: > > OverflowError: long int too large to convert to float. > > Is there any feasible work-around for that? If you want the integer log2, that is, the floor of log2, the simplest wa

Re: newbee

2014-08-13 Thread Mok-Kong Shen
Am 13.08.2014 13:55, schrieb alister: [snip] A related question: How could one write a Python program and have it run on a mobile phone in general (independent of a PC)? M. K. Shen -- https://mail.python.org/mailman/listinfo/python-list

Re: Log base 2 of large integers

2014-08-13 Thread Skip Montanaro
On Wed, Aug 13, 2014 at 8:05 AM, Mok-Kong Shen wrote: > I like to compute log base 2 of a fairly large integer n but > with math.log(n,2) I got: > > OverflowError: long int too large to convert to float. > > Is there any feasible work-around for that? A bit of googling turned up this page: http:

Re: Arbitrary dunder attributes (was Re: odd difference calling function from class or instance variable)

2014-08-13 Thread Steven D'Aprano
Chris Angelico wrote: > The bound method object stores a reference to the original object (the > thing that becomes the first argument to the target function) in > __self__ (and the function in __func__). ISTM this ought to be _self > (and _func), as it's intended to be private; Why do you say th

Log base 2 of large integers

2014-08-13 Thread Mok-Kong Shen
I like to compute log base 2 of a fairly large integer n but with math.log(n,2) I got: OverflowError: long int too large to convert to float. Is there any feasible work-around for that? Thanks in advance. M. K. Shen -- https://mail.python.org/mailman/listinfo/python-list

Re: Arbitrary dunder attributes (was Re: odd difference calling function from class or instance variable)

2014-08-13 Thread Ned Batchelder
On 8/13/14 5:51 AM, Chris Angelico wrote: On Wed, Aug 13, 2014 at 7:06 PM, GregS wrote: When I assign the reference as a class variable, the reference has __self__ set, too, so I get an extra argument passed to the function. If I assign the reference as an instance variable, then __self__ is u

Re: newbee

2014-08-13 Thread alister
On Tue, 12 Aug 2014 19:57:14 -0400, Frank Scafidi wrote: > I just acquired a Raspberry Pi and want to program in Python. I was a > PL/1 programmer back in the 60's & 70's and Python is similar. I am > struggling with some very fundamental things that I am not finding in > the documentation. Can so

Re: Python and IDEs [was Re: Python 3 is killing Python]

2014-08-13 Thread Wolfgang Keller
> >> > Because on such operating systems, each and every application is > >> > an entirely self-contained package that doesn't need any > >> > "packages" or "installers" to use it. > > > >> For people who have never used such a system it's probably > >> difficult to see the advantages. > > > > Tha

Re: newbee

2014-08-13 Thread Duncan Booth
Peter Otten <__pete...@web.de> wrote: > Frank Scafidi wrote: > >> I just acquired a Raspberry Pi and want to program in Python. I was a >> PL/1 programmer back in the 60's & 70's and Python is similar. I am >> struggling with some very fundamental things that I am not finding in >> the documentat

Re: Python and IDEs [was Re: Python 3 is killing Python]

2014-08-13 Thread Wolfgang Keller
> >> By the way, you keep replying to people, and quoting them, but > >> deleting their name. Please leave the attribution in place, so we > >> know who you are replying to. > > > > That's what the "References:"-Header is there for. > > The References header is for the benefit of news and mail cl

Re: odd difference calling function from class or instance variable

2014-08-13 Thread Chris Angelico
On Wed, Aug 13, 2014 at 8:20 PM, GregS wrote: > Thanks to both of you for your incredibly prompt replies. My homework for > tonight is to digest the descriptor protocol... > > Peter, thanks for suggesting using staticmethod() to get the behaviour I was > expecting. I've only used staticmethod as

Re: odd difference calling function from class or instance variable

2014-08-13 Thread GregS
Thanks to both of you for your incredibly prompt replies. My homework for tonight is to digest the descriptor protocol... Peter, thanks for suggesting using staticmethod() to get the behaviour I was expecting. I've only used staticmethod as a decorator before now. Chris, I agree that it's n

logging question

2014-08-13 Thread Arulnambi Nandagoban
Hello, I posted a question about logger module to create a log file every day. I had a problem recently in logging. My pc restarts regularly. Whenever it restarts I lose all the log since it writes in the file once per day. Is there a way to log information in a file as soon as it available.

Re: newbee

2014-08-13 Thread Peter Otten
Frank Scafidi wrote: > I just acquired a Raspberry Pi and want to program in Python. I was a PL/1 > programmer back in the 60's & 70's and Python is similar. I am struggling > with some very fundamental things that I am not finding in the > documentation. Can someone help me with the basics like h

Arbitrary dunder attributes (was Re: odd difference calling function from class or instance variable)

2014-08-13 Thread Chris Angelico
On Wed, Aug 13, 2014 at 7:06 PM, GregS wrote: > When I assign the reference as a class variable, the reference has __self__ > set, too, so I get an extra argument passed to the function. If I assign > the reference as an instance variable, then __self__ is unset so no extra > argument. Spin-off

Re: odd difference calling function from class or instance variable

2014-08-13 Thread Chris Angelico
On Wed, Aug 13, 2014 at 7:06 PM, GregS wrote: > If you look at i.ref.__self__ for the two cases, you'll see what's going on. > I've tried RTFMing but can't find the reason for the two behaviours. Could > someone provide an explanation for me, please? What you're seeing there is the magic of inst

Re: odd difference calling function from class or instance variable

2014-08-13 Thread Peter Otten
GregS wrote: > Hello, > > This is my first post here so please gently inform me of any etiquette > breaches. > > I'm seeing a behaviour I can't explain with Python 3.4.1 when I call a > function via a reference stored in an object. > > When I assign the reference as a class variable, the refere

Re: newbee

2014-08-13 Thread Chris Angelico
On Wed, Aug 13, 2014 at 9:57 AM, Frank Scafidi wrote: > I just acquired a Raspberry Pi and want to program in Python. I was a PL/1 > programmer back in the 60's & 70's and Python is similar. I am struggling > with some very fundamental things that I am not finding in the > documentation. Can someo

odd difference calling function from class or instance variable

2014-08-13 Thread GregS
Hello, This is my first post here so please gently inform me of any etiquette breaches. I'm seeing a behaviour I can't explain with Python 3.4.1 when I call a function via a reference stored in an object. When I assign the reference as a class variable, the reference has __self__ set, too,

Re: newbee

2014-08-13 Thread Joel Goldstick
On Tue, Aug 12, 2014 at 7:57 PM, Frank Scafidi wrote: > I just acquired a Raspberry Pi and want to program in Python. I was a PL/1 > programmer back in the 60's & 70's and Python is similar. I am struggling > with some very fundamental things that I am not finding in the > documentation. Can someo

Re: [Announce] Python-Future v0.13; cheatsheet for Python 2/3 compatible code

2014-08-13 Thread Steven D'Aprano
On Wed, 13 Aug 2014 13:28:03 +1000, Ed Schofield wrote: > Hi all, > > I am happy to announce an update to Python-Future for Python 2/3 > compatibility and a new cheat-sheet for writing code compatible with > both versions. Nice! But are you aware that some of your Python 2 code only works in ce

Re: Python Object Systems

2014-08-13 Thread Michele Simionato
Years ago I wrote strait: https://pypi.python.org/pypi/strait I wonder who is using it and for what purpose, since surprisingly enough it has 50+ downloads per day. For me it was more of an experiment than a real project. -- https://mail.python.org/mailman/listinfo/python-list