On 3.3.2014. 1:44, Cameron Simpson wrote:
ValueError: cannot hash writable memoryview object
Have you considered subclassing memoryview and giving the subclass
a __hash__ method?
I have, and then, when I failed to subclass it, I considered doing
aggregation, and make it behave byte-like. Bu
On 3.3.2014. 1:49, Mark Lawrence wrote:
If your data is readonly why can't you simply read it as bytes in the
first place? Failing that from
http://docs.python.org/3/library/stdtypes.html#memoryview
tobytes() - Return the data in the buffer as a bytestring. This is
equivalent to calling the by
On 3.3.2014. 2:27, Ian Kelly wrote:
Python 3.3 has a C API function to create a memoryview for a char*,
that can be made read-only.
http://docs.python.org/3/c-api/memoryview.html#PyMemoryView_FromMemory
Yes, this is probably what I'll do in absence of pure Python solution.
Thanks for th
hello
Consider following code:
A=7
B=7
A is B
True
I understand that there is a single object 7 somewhere in memory and
both variables A and B point toward this object 7
now do the same with a list:
l1 = [1, 2]
l2 = [1, 2]
l1 is l2
False
It seems this time that there are 2 distincts obje
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1
On behalf of the Python development team, I'm happy to announce
the release of Python 3.3.5, release candidate 2.
Python 3.3.5 includes a fix for a regression in zipimport in 3.3.4
(see http://bugs.python.org/issue20621) and a few other bugs.
Python
"ast" writes:
> >>> A=7
> >>> B=7
> >>> A is B
> True
>
> I understand that there is a single object 7 somewhere in memory and
> both variables A and B point toward this object 7
Try not to think in terms of “point to”. Rather, the names “A” and “B”
are bound to that object.
The distinction is
On Mon, 03 Mar 2014 06:14:09 +0700, musicdenotation wrote:
> If Python is not a fnctional language, then which programming paradigmis
> dominant?
Python follows the Pythonic paradigm :-)
--
Hope this helps some, sorry for not being able to do a brain dump.
- Mike Stump helping a clue
thanks ben, that's clear
--
https://mail.python.org/mailman/listinfo/python-list
in 718085 20140302 231409 musicdenotat...@gmail.com wrote:
>If Python is not a fnctional language, then which programming paradigmis dom=
>inant?=
Labels are always misleading.
--
https://mail.python.org/mailman/listinfo/python-list
hi folks,
Python Decimal Library dmath.py v0.3 Released
https://code.google.com/p/pythondecimallibrary/
This code provides the C accelerated decimal module with
scientific/transcendental functions for arbitrary precision.
I have also included pilib.py which is a PI library of historic
algorith
On Monday, March 3, 2014 6:57:15 AM UTC+5:30, Ned Batchelder wrote:
> On 3/2/14 6:14 PM, musicdenotation wrote:
> > If Python is not a fnctional language, then which programming paradigmis
> > dominant?
> is_a_functional_language() is not a binary condition, yes or no. It's a
> continuum. Pyth
On Monday, March 3, 2014 5:34:30 AM UTC-6, Mark H. Harris wrote:
> hi folks,
Terry, I posted this mod as an idea on python-ideas, as you suggested.
Also, I made the additional suggestion that decimal floating point be
considered as the primary floating point type for python4.x, with an
optional
On Mon, Mar 3, 2014 at 10:45 PM, Rustom Mody wrote:
> - cannot do a 'type-incorrect' expression like
[1,2] + [[3,4],[5]]
> [1, 2, [3, 4], [5]]
What do you mean by "type-incorrect"? This is adding two lists and
getting back a list. Seems perfectly correct to me.
ChrisA
--
https://mail.pytho
Hello,
I'm trying to use urllib and urllib2 to open an url + login_data in a for loop.
How can I display when successfully logged in and how to show when the login is
denied?
I've tried use this:
html_content = urllib2.urlopen(url).read()
re.findall('ERROR: The password you entered for the us
This is the code right now: http://pastebin.com/pE1YZX2K
--
https://mail.python.org/mailman/listinfo/python-list
On Mon, Mar 3, 2014 at 11:44 PM, Chris Angelico wrote:
> So basically, you're doing a dictionary attack. May I ask why you're
> doing this, exactly?
--
https://mail.python.org/mailman/listinfo/python-list
On Mon, Mar 3, 2014 at 11:44 PM, Chris Angelico wrote:
> So basically, you're doing a dictionary attack. May I ask why you're
> doing this, exactly?
oops, misclicked.
I note that the user name 'alex' does not appear to match your name.
I'm going to want a good reason for this code to be written,
On Mon, Mar 3, 2014 at 11:35 PM, Marcus wrote:
> This is the code right now: http://pastebin.com/pE1YZX2K
That looks short enough to include in-line, no need to point us to an
external site :)
So basically, you're doing a dictionary attack. May I ask why you're
doing this, exactly?
ChrisA
--
h
Yes, it's only for my own use on my local WordPress installation. Only
educational use.
--
https://mail.python.org/mailman/listinfo/python-list
On Mon, Mar 3, 2014 at 11:51 PM, Marcus wrote:
> Yes, it's only for my own use on my local WordPress installation. Only
> educational use.
What are you trying to learn, exactly? How to break into a WP site?
Still dubious.
ChrisA
--
https://mail.python.org/mailman/listinfo/python-list
On Monday, March 3, 2014 3:42:30 AM UTC-6, ast wrote:
> Consider following code:
>
> >>> A=7
> >>> B=7
> >>> A is B
> True
The names A and B are both bound to the same object (7).
You will discover that this is True for all small ints less
than 257; on CPython3.3.4. I just checked it. :)
I
It's not that hard to find a program that does this already. But I'm trying to
learn how to use these modules to create this. I've started it and now i want
to complete it so I can create another program and learn more about other
stuff, maybe a Twitter script or something. How do I learn when n
On 3 March 2014 11:34, Mark H. Harris wrote:
> hi folks,
>
> Python Decimal Library dmath.py v0.3 Released
>
> https://code.google.com/p/pythondecimallibrary/
Hi Mark,
Is this available on PyPI? It seems there already is a "dmath" package
on PyPI that was written by someone else some time ago so
Django views.py:
...
pwd = os.path.dirname(os.path.realpath(__file__ ))
home_lastmod =
strftime('%Y-%m-%dT%H:%m:%SZ',gmtime(os.path.getmtime(pwd+'/templates/art_index.html')))
...
The template gives a wrong modification time: "2014-03-02T19:03:55Z".
...
jaap@liakoster:~$ python
Python 2.7.3 (de
In article ,
Chris Angelico wrote:
> The greatest threats these days are from the network, not from someone
> physically walking into an office. (That said, though, the low-hanging
> fruit from walking into an office can be *extremely* tempting. Pulling
> off a basic password leech off sticky no
In article ,
Marcus wrote:
> I'm trying to use urllib and urllib2 to open an url + login_data in a for
> loop.
Step 1: Ignore all that crap and get http://www.python-requests.org/
> How can I display when successfully logged in and how to show when the
> login is denied?
>
> I've tried us
On Monday, March 3, 2014 5:50:37 PM UTC+5:30, Chris Angelico wrote:
> On Mon, Mar 3, 2014 at 10:45 PM, Rustom Mody wrote:
> > - cannot do a 'type-incorrect' expression like
> [1,2] + [[3,4],[5]]
> > [1, 2, [3, 4], [5]]
> What do you mean by "type-incorrect"? This is adding two lists and
> ge
On Monday, March 3, 2014 7:18:00 PM UTC+5:30, Rustom Mody wrote:
> Unfortunately modern versions give a less helpful error message
> '++' is list-append, '?' is the prompt
> ? [1,2] + [[3,4],[5]]
Whoops Wrong cut-paste!
? [1,2] ++ [[3,4],[5]]
ERROR: Type error in application
On Tue, Mar 4, 2014 at 12:41 AM, Roy Smith wrote:
> I used to work at which had a typical big company IT
> department which enforced all sorts of annoying pseudo-security rules.
> As far as I could figure out, however, all you needed to get them to
> reset anybody's password and tell you the new
On Tue, Mar 4, 2014 at 12:48 AM, Rustom Mody wrote:
> ? [1,2] + [[3,4],[5]]
> ERROR: Type error in application
> *** expression : [1,2] + [[3,4],[5]]
> *** term : [1,2]
> *** type : [Int]
> *** does not match : [[Int]]
>
> IOW [1,2,[3,4],[5]]
> is a type-wise ill-formed exp
On Tue, Mar 4, 2014 at 12:35 AM, Jaap van Wingerde
wrote:
time.strftime('%Y-%m-%dT%H:%m:%SZ',gmtime(os.path.getmtime('/var/django/test2/art/templates/art_index.html')))
> '2014-03-02T19:03:55Z'
quit()
> jaap@liakoster:~$ ls --full-time
> /var/django/test2/art/templates/art_index.html
>
On Monday, March 3, 2014 7:30:17 PM UTC+5:30, Chris Angelico wrote:
> On Tue, Mar 4, 2014 at 12:48 AM, Rustom Mody wrote:
> > ? [1,2] + [[3,4],[5]]
> > ERROR: Type error in application
> > *** expression : [1,2] + [[3,4],[5]]
> > *** term : [1,2]
> > *** type : [Int]
> > ***
Charles R Harris Wrote in message:
> ___
> NumPy-Discussion mailing list
> numpy-discuss...@scipy.org
> http://mail.scipy.org/mailman/listinfo/numpy-discussion
>
Imo the lesson here is never write in low level c. Use modern
languages with well design
On 2014-03-02, Chris Angelico wrote:
> On Mon, Mar 3, 2014 at 3:55 AM, Mark Lawrence wrote:
>> On 02/03/2014 16:45, Grant Edwards wrote:
>>>
>>>
>>> That's irrelevent. The actual location of the memory containing the
>>> struct object (static, stack, heap, shared) doesn't matter. The
>>> addres
On Tue, Mar 4, 2014 at 1:08 AM, Rustom Mody wrote:
>> How do you know that [1,2] is a list that must contain nothing but
>> integers? By extension, it's also a list that must contain positive
>> integers less than three, so adding [5] violates that. And [] is a
>> list that must contain nothing, e
On Tue, Mar 4, 2014 at 1:18 AM, Grant Edwards wrote:
>> Note that, technically, Grant is correct as long as you grant (heh)
>> that a structure may have an invisible member, the virtual function
>> table pointer. C++ only (I don't believe C has virtual functions -
>> but it may have grown them in
Op schreef Chris Angelico
in bericht :
> See if ls is actually giving you ctime rather than mtime - compare the
> results if you ask for os.path.getctime.
jaap@liakoster:~$ python
Python 2.7.3 (default, Jan 2 2013, 13:56:14)
[GCC 4.7.2] on linux2
Type "help", "copyright", "credits" or "licen
On 2014-03-03, ast wrote:
> hello
>
> Consider following code:
>
A=7
B=7
A is B
> True
>
> I understand that there is a single object 7 somewhere in memory
Maybe, maybe not. Integer are immutable, so that's allowed but not
required. In CPython, that's true for small integers, but
On Monday, March 3, 2014 7:34:40 AM UTC-6, Oscar Benjamin wrote:
> Python Decimal Library dmathlib.py v0.3 Released
> https://code.google.com/p/pythondecimallibrary/
> Is this available on PyPI? It seems there already is a "dmath" package
> on PyPI that was written by someone else some time ago
On Monday, March 3, 2014 7:53:01 PM UTC+5:30, Chris Angelico wrote:
> On Tue, Mar 4, 2014 at 1:08 AM, Rustom Mody wrote:
> >> How do you know that [1,2] is a list that must contain nothing but
> >> integers? By extension, it's also a list that must contain positive
> >> integers less than three, so
On Tue, Mar 4, 2014 at 1:38 AM, Rustom Mody wrote:
> If you want the (semantic) equivalent of python's [1,2,'foo']
> you need to make an explicit union Int and String and its that
> *single* union type's elements that must go in.
>
> In all cases its always a single type. And so
> sum([1,2,[3])
O
How to create a voting website by Python and Flask? I studying Python and Flask
for some months, and
- Now I have some Python & Flask basic skills.
- I need some advices like following example:
Step 1: You could writing an voting application by Python Step 2: You could
build a website by Flas
On Monday, March 3, 2014 7:34:40 AM UTC-6, Oscar Benjamin wrote:
> On 3 March 2014 11:34, Mark H. Harris wrote:
>
> Is this available on PyPI? It seems there already is a "dmath" package
> on PyPI that was written by someone else some time ago so you might
> need to use a different name:
> Osc
On Monday, March 3, 2014 8:31:47 PM UTC+5:30, Chris Angelico wrote:
> On Tue, Mar 4, 2014 at 1:38 AM, Rustom Mody wrote:
> > If you want the (semantic) equivalent of python's [1,2,'foo']
> > you need to make an explicit union Int and String and its that
> > *single* union type's elements that must
On Monday, March 3, 2014 3:12:30 PM UTC+5:30, ast wrote:
> hello
> Consider following code:
> >>> A=7
> >>> B=7
> >>> A is B
> True
> I understand that there is a single object 7 somewhere in memory and
> both variables A and B point toward this object 7
> now do the same with a list:
> >>> l1
Quoting Harry Wood (2014-03-03 16:22:22)
> How to create a voting website by Python and Flask? I studying Python and
> Flask for some months, and
>
> - Now I have some Python & Flask basic skills.
> - I need some advices like following example:
> Step 1: You could writing an voting application
On 2014-03-03 13:55, Chris Angelico wrote:
On Tue, Mar 4, 2014 at 12:41 AM, Roy Smith wrote:
I used to work at which had a typical big company IT
department which enforced all sorts of annoying pseudo-security rules.
As far as I could figure out, however, all you needed to get them to
reset an
On 3 March 2014 15:22, Mark H. Harris wrote:
> On Monday, March 3, 2014 7:34:40 AM UTC-6, Oscar Benjamin wrote:
>> On 3 March 2014 11:34, Mark H. Harris wrote:
>>
>> Is this available on PyPI?
>
> Python3.3 Decimal Library v0.3 is Released here:
>
> https://code.google.com/p/pythondecimallibra
On Tue, 04 Mar 2014 00:55:45 +1100, Chris Angelico wrote:
> But it's an attack vector that MUST be considered, which is why I never
> tell the truth in any "secret question / secret answer" boxes. Why some
> sites think "mother's maiden name" is at all safe is beyond my
> comprehension. And that's
On Monday, March 3, 2014 10:44:16 AM UTC-6, Oscar Benjamin wrote:
> Is it on PyPI though? I was referring to a PyPI name so that people
> could install it with "pip install pdeclib"
> Oscar
hi Oscar, I'm sorry, I completely missed the point of your question. No its not
on PyPI, but I don't mind
Am Montag, 3. März 2014 12:34:30 UTC+1 schrieb Mark H. Harris:
> hi folks,
>
>
>
> Python Decimal Library dmath.py v0.3 Released
>
>
>
> https://code.google.com/p/pythondecimallibrary/
>
>
>
> This code provides the C accelerated decimal module with
>
> scientific/transcendental function
On Tue, 04 Mar 2014 02:01:47 +1100, Chris Angelico wrote:
> This is why it's tricky to put rules in based on type inference. The
> programmer's intent isn't in the picture.
Of course it is. If I assign 23 to variable x, that signals my intent to
assign an int to x. By Occam's razor, it is reaso
On Mon, 03 Mar 2014 08:41:10 -0500, Roy Smith wrote:
> In article ,
> Chris Angelico wrote:
>
>> The greatest threats these days are from the network, not from someone
>> physically walking into an office. (That said, though, the low-hanging
>> fruit from walking into an office can be *extremel
On Tue, Mar 4, 2014 at 4:27 AM, Steven D'Aprano
wrote:
> On Tue, 04 Mar 2014 02:01:47 +1100, Chris Angelico wrote:
>
>> This is why it's tricky to put rules in based on type inference. The
>> programmer's intent isn't in the picture.
>
> Of course it is. If I assign 23 to variable x, that signals
On 3/3/2014 1:16 AM, Westley Martínez wrote:
I understand that in an object method the first argument in the
object itself, called self. However, it doesn't have to be called
self, and can be called anything. So my question is why is it called
self and not this like from C++ and Java. It's kin
On Tue, Mar 4, 2014 at 3:46 AM, Steven D'Aprano
wrote:
> On Tue, 04 Mar 2014 00:55:45 +1100, Chris Angelico wrote:
>
>> But it's an attack vector that MUST be considered, which is why I never
>> tell the truth in any "secret question / secret answer" boxes. Why some
>> sites think "mother's maiden
On 3/3/2014 4:42 AM, ast wrote:
Consider following code:
A=7
B=7
A is B
The 'is' operator has three uses, two intended and one not. In
production code, 'is' tests that an object *is* a particular singular
object, such as None or a sentinel instance of class object. In test
code, 'is' can
On 03/03/2014 00:07, Terry Reedy wrote:
On 3/2/2014 6:55 PM, Mark Lawrence wrote:
Trying to install pyttsx, it doesn't strike me as very clever that, as
seen below, you get "Successfully installed pyttsx" despite the syntax
errors and you can't actually do an import.
c:\Users\Mark\CrossCode>c:\
On Monday, March 3, 2014 11:23:13 AM UTC-6, Wolfgang Maier wrote:
> def fact(x):
> """ fact(x)factorial{x} int x > 0
>
> return +Decimal(math.factorial(x))
> to make it return a Decimal rounded to context precision?
hi Wolfgang, I'm not sure. We're doing some things wit
hi folks,
I am having a fit with pip this afternoon. I finally
got pip installed on this system from a binary
blob (what nightmare, talk about 1987). Anyway,
pip is installed, but when I go to PyPI to pull
down distutils is gives a message that no such
package exists. I feel like Obeewan; "i
On Monday, March 3, 2014 6:28:21 AM UTC-8, Jaap van Wingerde wrote:
> Op schreef Chris Angelico
> in bericht
> :
>
> > See if ls is actually giving you ctime rather than mtime - compare the
> > results if you ask for os.path.getctime.
>
> jaap@liakoster:~$ python
> Python 2.7.3 (default, Jan
On 03/03/2014 20:10, Mark H. Harris wrote:
hi folks,
I am having a fit with pip this afternoon. I finally
got pip installed on this system from a binary
blob (what nightmare, talk about 1987). Anyway,
pip is installed, but when I go to PyPI to pull
down distutils is gives a message that no such
Jaap van Wingerde writes:
> >>> time.strftime('%Y-%m-%dT%H:%m:%SZ',gmtime(os.path.getmtime('/var/django/test2/art/templates/art_index.html')))
> >>>
> '2014-03-02T19:03:55Z'
> >>> quit()
> jaap@liakoster:~$ ls --full-time
> /var/django/test2/art/templates/art_index.html
> -rwxrwx--- 1 lia w
On Tue, Mar 4, 2014 at 7:22 AM, donarb wrote:
> You're using the months format '%m' when you should be using minutes '%M'.
Heh! I didn't even notice that. When I tested it, I didn't use
strftime at all, just looked at gmtime's output.
ChrisA
--
https://mail.python.org/mailman/listinfo/python-li
Rustom Mody writes:
> Short answer: Avoid using 'is'.
This is bad advice in a Python forum.
The ‘is’ operator is commonly used in Python, so please don't advise
against it in an unqualified “short answer”.
> Long answer:
> http://www.beyondwilber.ca/healing-thinking/non-identity-korzybski.ht
On Monday, March 3, 2014 2:03:19 PM UTC-6, Mark H. Harris wrote:
> On Monday, March 3, 2014 11:23:13 AM UTC-6, Wolfgang Maier wrote:
Wolfgang, answer is not so much, in fact, not at all.
But it is an interesting question for me; where I am
continuing to learn the limits of Decimal, and the
dec
On 2014-03-04 08:10, Ben Finney wrote:
> > Long answer:
> > http://www.beyondwilber.ca/healing-thinking/non-identity-korzybski.html
>
> Interesting, but mostly a distraction for the querent here.
>
> Short answer: Use ‘use’ any time you need to compare object
> identity. You usually do not need
On Monday, March 3, 2014 2:53:00 PM UTC-6, Mark Lawrence wrote:
> distutils has been part of the standard library for years.
hi Mark, that's fabulous, why can't I import it? Because I'm doing
something wrong of course. :)
marcus
--
https://mail.python.org/mailman/listinfo/python-list
Tim Chase writes:
> On 2014-03-04 08:10, Ben Finney wrote:
> > Short answer: Use ‘use’ any time you need to compare object
> > identity. You usually do not need to compare object identity.
Damn it, a snappy response marred by a typo.
> I think there use something wrong with that sentence...unle
On 2014-03-03 21:20, Mark H. Harris wrote:
On Monday, March 3, 2014 2:53:00 PM UTC-6, Mark Lawrence wrote:
distutils has been part of the standard library for years.
hi Mark, that's fabulous, why can't I import it? Because I'm doing
something wrong of course. :)
Probably. If you want us t
On 03/03/2014 21:10, Ben Finney wrote:
Rustom Mody writes:
Short answer: Avoid using 'is'.
This is bad advice in a Python forum.
The ‘is’ operator is commonly used in Python, so please don't advise
against it in an unqualified “short answer”.
Long answer:
http://www.beyondwilber.ca/heali
On Monday, March 3, 2014 3:32:43 PM UTC-6, Robert Kern wrote:
> Probably. If you want us to help, you need to show us what you tried, tell us
> what results you expected, and copy-paste the output that you got.
> Robert Kern
hi Robert, well, I finally came up with trying to find setup(). Its
"Stefan Behnel" wrote in message
news:mailman.7568.1393756930.18130.python-l...@python.org...
Haven't seen any mention of it on this list yet, but since it's such an
obvious flaw in quite a number of programming languages, here's a good
article on the recent security bug in iOS, which was due
In article <31feb451-7fb6-48a6-9986-bddce69c4...@googlegroups.com>,
"Mark H. Harris" wrote:
> On Monday, March 3, 2014 3:32:43 PM UTC-6, Robert Kern wrote:
>
> > Probably. If you want us to help, you need to show us what you tried, tell
> > us
> > what results you expected, and copy-paste the
On 2014-03-03 21:35, Mark Lawrence wrote:
> I'd just like to know why people are so obsessed with identities,
> I've never thought to use them in 10+ years of writing Python. Do
> I use the KISS principle too often?
There are a couple use-cases I've encountered where "is" matters:
1) the most po
On 03Mar2014 09:15, Juraj Ivančić wrote:
> On 3.3.2014. 1:44, Cameron Simpson wrote:
> >>ValueError: cannot hash writable memoryview object
> >
> >Have you considered subclassing memoryview and giving the subclass
> >a __hash__ method?
>
> I have, and then, when I failed to subclass it, I conside
On Mon, Mar 3, 2014 at 4:51 PM, Tim Chase wrote:
> There are a couple use-cases I've encountered where "is" matters:
>
> 1) the most popular:
>
> if foo is None:
> do_stuff()
I know this is the one that always comes up, but honestly, I feel like
"is" doesn't matter here. That code would be
Steven D'Aprano wrote:
Given that x is an integer, and that you add 1 (also an integer) to it,
is it really necessary to tell the compiler that add_one returns an
integer? What else could the output type be?
Just because the compiler *can* infer the return type
doesn't necessarily mean it *sho
Mark Lawrence :
> I'd just like to know why people are so obsessed with identities, I've
> never thought to use them in 10+ years of writing Python. Do I use the
> KISS principle too often?
Calmly choosing the right tool for the job is not an obsession.
Marko
--
https://mail.python.org/mailma
On 2014-03-03 21:37, Mark H. Harris wrote:
On Monday, March 3, 2014 3:32:43 PM UTC-6, Robert Kern wrote:
Probably. If you want us to help, you need to show us what you tried, tell us
what results you expected, and copy-paste the output that you got.
Robert Kern
hi Robert, well, I finally
On Monday, March 3, 2014 3:18:37 PM UTC-6, Mark H. Harris wrote:
Yeah, you can set Emin & Emax enormously large (or small), can set
off overflow, and set clamping.
I am needing a small utility (tk?) that will allow the context to be set
manually by the interactive user dynamically (for a particu
On Mon, Mar 3, 2014 at 1:47 PM, Mark Lawrence wrote:
> FTR I raised this as http://bugs.python.org/issue20846 and it was closed 11
> minutes after I raised it. I won't say anything else as I'm extremely tired
> and irritable and might well regret it later.
Best I can tell, the issue was closed c
Jerry Hill writes:
> if foo == None:
> do_stuff()
>
> The only time it would give you a different result from the "is"
> version is if foo was bound to an object that returned True when
> compared with None.
That's right. Python provides this singleton and then recommends you
compare with ‘i
Marko Rauhamaa writes:
> Mark Lawrence :
>
> > I'd just like to know why people are so obsessed with identities, I've
> > never thought to use them in 10+ years of writing Python. Do I use the
> > KISS principle too often?
>
> Calmly choosing the right tool for the job is not an obsession.
Pers
On Monday, March 3, 2014 9:03:19 PM UTC+1, Mark H. Harris wrote:
> On Monday, March 3, 2014 11:23:13 AM UTC-6, Wolfgang Maier wrote:
> > def fact(x):
> > """ fact(x)factorial{x} int x > 0
> >
> > return +Decimal(math.factorial(x)
> > to make it return a Decimal rounded to co
Jerry Hill :
> except for the fact that there has been 20 years of custom saying that
> comparing to None with equality is wrong.
"if foo == None" is not wrong in any manner. It's just that if you are
comfortable with the "is" operator and its semantics, "if foo is None"
is slightly more natural.
On Tue, Mar 4, 2014 at 9:19 AM, Cameron Simpson wrote:
> On 03Mar2014 09:17, Neal Becker wrote:
>> Charles R Harris Wrote in message:
>> >
>>
>> Imo the lesson here is never write in low level c. Use modern
>> languages with well designed exception handling.
>
> What, and rely on someone else'
Marko Rauhamaa writes:
> Jerry Hill :
>
> > except for the fact that there has been 20 years of custom saying that
> > comparing to None with equality is wrong.
>
> "if foo == None" is not wrong in any manner.
Marko, please don't keep asserting falsehoods. It's already been pointed
out in this f
On 03Mar2014 09:17, Neal Becker wrote:
> Charles R Harris Wrote in message:
> >
>
> Imo the lesson here is never write in low level c. Use modern
> languages with well designed exception handling.
What, and rely on someone else's low level C?
--
Cameron Simpson
Hag:Two
On Tue, Mar 4, 2014 at 9:22 AM, Marko Rauhamaa wrote:
> You generally use "==" if more than one object could be equal. If you
> know there's only one object of the kind, you convey that knowledge by
> the use of "is" even when functionally, it doesn't matter.
It's even simpler than that.
You use
On Tue, Mar 4, 2014 at 9:31 AM, Ben Finney wrote:
> def frobnicate(flang, splets, queeble=False):
> """ Righteously frobnicate the flang.
>
> :param flang: A file-like object, opened for reading.
I had to read that a few times before I was sure that you actually
meant "fil
On Monday, March 3, 2014 10:18:37 PM UTC+1, Mark H. Harris wrote:
> On Monday, March 3, 2014 2:03:19 PM UTC-6, Mark H. Harris wrote:
>
> Wolfgang, answer is not so much, in fact, not at all.
> But it is an interesting question for me; where I am
> continuing to learn the limits of Decimal, and
On Monday, March 3, 2014 4:15:39 PM UTC-6, Wolfgang Maier wrote:
> Well, that may be your use-case, but then math.factorial is for you.
> On the other hand, you may be interested in getting
> context-rounded factorials and rounding to context
> precision is what you'd expect from a Decimal func
Gregory Ewing writes:
> Just because the compiler *can* infer the return type doesn't
> necessarily mean it *should*. When I was playing around with
> functional languages, I ended up adopting the practice of always
> declaring the types of my functions, because it helps the *human*
> reader.
Su
On 03/03/2014 22:25, Chris Angelico wrote:
On Tue, Mar 4, 2014 at 9:19 AM, Cameron Simpson wrote:
On 03Mar2014 09:17, Neal Becker wrote:
Charles R Harris Wrote in message:
Imo the lesson here is never write in low level c. Use modern
languages with well designed exception handling.
On Mon, Mar 3, 2014 at 2:25 PM, Chris Angelico wrote:
> On Tue, Mar 4, 2014 at 9:19 AM, Cameron Simpson wrote:
> > On 03Mar2014 09:17, Neal Becker wrote:
> >> Charles R Harris Wrote in message:
> >> >
> >>
> >> Imo the lesson here is never write in low level c. Use modern
> >> languages with
In article ,
Ben Finney wrote:
> That's right. Python provides this singleton and then recommends you
> compare with âisâ, precisely to protect against pathological cases like
> a âreturn True when compared for equality with Noneâ data type.
Going off on a tangent, I've often wished Pyt
On Tue, Mar 4, 2014 at 9:55 AM, Chris Kaynor wrote:
> You can go much simpler than that. Merely port Python to LISP, then write a
> LISP interpreter in Python. Done.
Actually, here's an easier way. Just write an 80x86 assembly language
interpreter in Python, then port CPython to Python.
ChrisA
-
In article ,
Cameron Simpson wrote:
> On 03Mar2014 09:17, Neal Becker wrote:
> > Charles R Harris Wrote in message:
> > >
> >
> > Imo the lesson here is never write in low level c. Use modern
> > languages with well designed exception handling.
>
> What, and rely on someone else's low lev
On Tue, Mar 4, 2014 at 10:02 AM, Roy Smith wrote:
> In article ,
> Ben Finney wrote:
>
>> That's right. Python provides this singleton and then recommends you
>> compare with ‘is’, precisely to protect against pathological cases like
>> a “return True when compared for equality with None” data t
1 - 100 of 134 matches
Mail list logo