from svn:
http://stackoverflow.com/questions/2213551/installing-scipy-with-pip
pip install --install-option="--user" git+http://github.com/scipy/scipy/
Otherwise, if you are installing from source using distutils, add the
--user option directly:
python setup.py install --user sci
, this hinges on how one defines "called from". I think it is
helpful to understand methods as being called from the instance doing the
calling rather than the class where they are defined.
--
Steven
--
https://mail.python.org/mailman/listinfo/python-list
On Wed, 18 Sep 2013 05:14:23 -0700, nikhil Pandey wrote:
> I want to iterate in the inner loop by reading each line till some
> condition is met.how can i do that. Thanks for this code.
while not condition:
read line
Re-write using Python syntax, and you are done.
--
Steven
--
On Wed, 18 Sep 2013 13:28:44 +0100, Oscar Benjamin wrote:
> On 18 September 2013 03:48, Steven D'Aprano wrote:
>> On Tue, 17 Sep 2013 20:06:44 -0400, Susan Lubbers wrote:
>>
>>> Our group is a python 2.7 which is installed in a shared area. We
>>> have sci
ndom-access by index much easier to understand
that itertools.tee solutions.
--
Steven
--
https://mail.python.org/mailman/listinfo/python-list
ot;credits" or "license" for more information.
>>> void
Traceback (most recent call last):
File "", line 1, in
NameError: name 'void' is not defined
What gave you the idea that void was part of Python?
--
Steven
--
https://mail.python.org/mailman/listinfo/python-list
t or not. This was a bad design, and Python 3 has fixed that, but I
don't know whether you have Python 2 or Python 3. So to be safe, I divide
by 2.0 to ensure that it calculates the right answer no matter what
version you are using.
Regards,
--
Steven
--
https://mail.python.org/mailman/listinfo/python-list
>>> import random
>>> x = random.uniform(0,100)
>>> print x #doctest:+SKIP
42.012345678901234
(There's no need to convert things to str before printing them.)
--
Steven
--
https://mail.python.org/mailman/listinfo/python-list
#x27;ll never see
the exception because it is ignored.
So you simply can't do what you want. You can't both ignore the output of
a doctest and have doctest report if the test fails.
--
Steven
--
https://mail.python.org/mailman/listinfo/python-list
andom
>>> random.seed(100)
>>> random.uniform(0, 100)
14.566925510413032
Alas, that only works reliably if you stick to a single Python version.
Although the results of calling random.random are guaranteed to be stable
across versions, random functions build on top of random.random like
uniform are not and may need to be protected with a version check.
--
Steven
--
https://mail.python.org/mailman/listinfo/python-list
muscle.collect(performance_group)
muscle.dump(remains, "The Canal")
It's not free software (free as in beer), but I'm told that it is dirt
cheap...
--
Steven
--
https://mail.python.org/mailman/listinfo/python-list
gned to:
def quit():
print("Bye now!")
sc.bye()
If that's not the case, there's something you're not telling us about
your code. Actual working examples are appreciated.
--
Steven
--
https://mail.python.org/mailman/listinfo/python-list
ble. But
if you insist, you could always use that technique in your doctests:
>>> ignore = function(a, b, c)
If the function call raises, your doctest will fail, but if it returns
something, anything, it will pass.
--
Steven
--
https://mail.python.org/mailman/listinfo/python-list
ays seemed incredibly limited to me.
> Essentially, it's as if you used unittest but the only assertion you're
> allowed to make is self.assertEqual(str(X), "")
More or less :-)
Doc tests really are documentation first and tests second. That's its
strength.
I don't usually top post, but for this I'll make an exception because I
have *no idea* what any of your post means.
Are you actually asking a question? I can't see a question mark in it, so
there's no explicit question. Are you just sharing something interesting
you have learned? Expecting us t
ise questions written for an
audience who already knows everything you know is not likely to get a lot
of help.
--
Steven
--
https://mail.python.org/mailman/listinfo/python-list
quot;Hello". In that case, you have to
deal with the error. Have you learned about exceptions yet?
It may be acceptable to ignore case #4 -- you'll have to ask your teacher.
Then try it out and make sure it works! For example:
107.6°F == 42°C
-15°C = 5°F
Now you're done! On to the next function...
--
Steven
--
https://mail.python.org/mailman/listinfo/python-list
On Mon, 23 Sep 2013 15:32:37 -0700, kjakupak wrote:
> On Monday, September 23, 2013 9:56:45 AM UTC-4, Steven D'Aprano wrote:
>> On Mon, 23 Sep 2013 05:57:34 -0700, kjakupak wrote:
>>
>> Now you're done! On to the next function...
>>
>>
>>
ny temperature scale, so
long as it is the same for both temperatures.
--
Steven
--
https://mail.python.org/mailman/listinfo/python-list
x: (x + 459.67) * (5.0/9)}
> f = conversion_table[(from_unit.lower(), to_unit.lower())] return
> f(T)
>
> Would this be correct?
Oh, I forgot... what happens if both units are the same?
Hint: if both units are the same, no conversion is necessary.
--
Steven
--
https://mail.python.org/mailman/listinfo/python-list
The locale only sets the default encoding used by the OS, not that used
by Python. Python 2 defaults to ASCII; Python 3 defaults to UTF-8.
--
Steven
--
https://mail.python.org/mailman/listinfo/python-list
s emails to his website users. I've
asked him to explain, but he hasn't. I can only conclude that he is
intending to send spam, or otherwise act unethically or even criminally.
Even if I knew how to write an anonymous mail server, I wouldn't help him.
--
Steven
--
https://mail.python.org/mailman/listinfo/python-list
before that point, probably on the previous line.
How long have you been doing web development with Python? Six months? A
year? You're not a beginner any more. If you can't solve syntax errors by
yourself by now, it's probably time to give up and find a job more suited
to your skills.
--
Steven
--
https://mail.python.org/mailman/listinfo/python-list
7;UnknownRef')
>
> but that doesn't return anything either.
>
> Can you verify that its the correct way to grab the referral string?
The Referer is not an environment variable. How would your shell know
what URL you were just browsing?
Have you googled for H
'UnknownRef'
The get method will not raise KeyError. If the key is missing,
'UnknownRef' will be returned instead.
So when Nikos reports that os.environ.get('HTTP_REFERER', 'UnknownRef')
"doesn't return anything", he is mistaken. It returns 'UnknownRef'.
--
Steven
--
https://mail.python.org/mailman/listinfo/python-list
variables before invoking
> the CGI app.
I stand corrected.
That's a pretty shitty design though, isn't it? Communicating via
environment variables. What is this, 1998? :-)
Mind you, I'm not sure what other alternatives exist.
--
Steven
--
https://mail.python.org/mailman/listinfo/python-list
# [1, 2, 3, 4]
In principle, you can nest as many function calls as needed. In practice,
Python will stop after 1000 nested calls by default, although you can
tune it up and down.
--
Steven
--
https://mail.python.org/mailman/listinfo/python-list
-factory-function-for-tuples-with-named-fields
--
Steven
--
https://mail.python.org/mailman/listinfo/python-list
ct.values():
print(value.x)
print(value.y)
But if you need to change those values, then a namedtuple is no good
because it is immutable. In that case, you can either create a new
namedtuple, or just use the dict-of-dicts version.
# Untested
for key, value in some_dict.items():
kind = type(value) # what sort of namedtuple is it?
new = kind(value.x+1, value.y+2)
some_dict[key] = new
--
Steven
--
https://mail.python.org/mailman/listinfo/python-list
On Thu, 26 Sep 2013 21:20:52 -0700, melwin9 wrote:
> I modified the guess.py file but am unable to run it,
What does that mean?
How do you try to run it?
What happens when you do?
--
Steven
--
https://mail.python.org/mailman/listinfo/python-list
t;default value"
try:
variable = something_that_might_fail()
except SomeException:
pass
--
Steven
--
https://mail.python.org/mailman/listinfo/python-list
gur, then
take a screenshot of the picture on imgur, then post that screenshot here.
--
Steven
--
https://mail.python.org/mailman/listinfo/python-list
t be
generated. They'll be randomly distributed throughout the space of all
possible shuffles, which is so large that you really won't notice the
missing ones.
--
Steven
--
https://mail.python.org/mailman/listinfo/python-list
On Sat, 28 Sep 2013 19:45:40 +0100, Mark Lawrence wrote:
> Not tortured, simply murdered
If your aim was to prove that you're a waste of space than Nikos, you've
admirably succeeded.
*plonk*
--
Steven
--
https://mail.python.org/mailman/listinfo/python-list
ocals() or "blablabla") )
Bad advice, and buggy as well.
py> city = "New New York"
py> ('city' in locals() or "Blah blah")
True
Oh man, can you imagine Nikos trying to debug that?
--
Steven
--
https://mail.python.org/mailman/listinfo/python-list
..^^
Given that the error occurred hours ago, I don't think you'll be able to
diagnose why it happened unless it happens again.
Another thought comes to mind... unless you have changed your habits, I
recall that you edit the source code live. If that is the case, it is
possi
ve pointed Nikos at that before,
but he is running Python 3, not 2, so the obvious problem is not likely
to be the actual problem.
--
Steven
--
https://mail.python.org/mailman/listinfo/python-list
ces a problem. Can you fix the problem?
If so, great, move on! If not, ask for help, but remember to COPY AND
PASTE the entire traceback, starting with the line
Traceback (most recent call last)
all the way to the end of the error message.
--
Steven
--
https://mail.python.org/mailman/listinfo/python-list
#x27;,
r'"\C-xd": dump-functions',
)
)
--
Steven
--
https://mail.python.org/mailman/listinfo/python-list
hat is not universal. The question is
which is more effective at getting the differences between the two
programming models through to the reader. I can't speak for others, but
in my own experience, I never *quite* understood the semantic differences
between Python name bindings and Pas
On Tue, 01 Oct 2013 01:08:41 +0300, Νίκος wrote:
> stfu dickhead.
And you're back in the kill-file.
*plonk*
--
Steven
--
https://mail.python.org/mailman/listinfo/python-list
rn that fixes
this? Can you manually force it to use UTF-8? Can you report this as a
bug?
In case you aren't too clear on the concepts, here are two Must Read
links:
http://www.joelonsoftware.com/articles/Unicode.html
http://nedbatchelder.com/text/unipain.html
--
Steven
--
https://mail.
On Mon, 30 Sep 2013 08:50:01 +, Antoine Pitrou wrote:
> Steven D'Aprano pearwood.info> writes:
>>
>> I don't consider either of these solutions to be satisfactory. If you
>> agree, I urge you to try it out for yourself, and then leave a comment
&g
n't do something equivalent to this couldn't really
claim to be object-oriented.)
--
Steven
--
https://mail.python.org/mailman/listinfo/python-list
ntax that is unambiguous, would allow multiple
statements in an expression, doesn't break backwards compatibility, and
isn't ugly.
Since lambda is just a convenience, not a necessity -- it almost got
dropped from Python 3 -- it is not worth compromising on those design
requirements just for multiple-statement lambdas. It simply isn't
important enough.
--
Steven
--
https://mail.python.org/mailman/listinfo/python-list
itself changed, that's demonstrably untrue since 4 is
immutable. But you know that :-)
I straddle the fence on this dispute... I'll often refer to Python
variables when, in my option, it doesn't confuse the issue or introduce
ambiguity, but I feel guilty doing so :-) And I always look for the
opportunity to introduce the concept of name binding into the discussion.
I'm just not religious about it.
--
Steven
--
https://mail.python.org/mailman/listinfo/python-list
ime while delivering 99.9% uptime.
I know you are getting off on hating Nikos, but take it elsewhere.
--
Steven
--
https://mail.python.org/mailman/listinfo/python-list
uot;;
> target="_blank">[email protected]> wrote: class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc
[rest of the HTML gunk deleted]
--
Steven
--
https://mail.python.org/mailman/listinfo/python-list
they are sure
that if they mock him just a little bit harder he will go away. He won't,
they keep baiting him even more, and this place is going to shit thanks
to them.
P.S. this mailing list is mirrored on Usenet as comp.lang.python, and it
is considered rude to post HTML if yo
e of all that's holy, get yourself some professional
help to secure your website.
--
Steven
--
https://mail.python.org/mailman/listinfo/python-list
On Tue, 01 Oct 2013 22:02:36 -0400, Joel Goldstick wrote:
> On Tue, Oct 1, 2013 at 9:52 PM, Steven D'Aprano <
> [email protected]> wrote:
>
>> Joel, you've been asked repeatedly to please stop posting HTML.
[...]
> class="gmail_extra&q
n tell you this: if the PSF Code of Conduct applied here, Nikos would
be a *distant* third on my list of people to be banned. He might be needy
and annoying, but he is not abusive and hostile except when defending
himself from the abuse and hostility of others.
And I've called Nikos out on
he first thing they see is Nikos asking
questions, and being ignored, or worse, being abused. Does that send the
message that we want, that their questions are welcome?
--
Steven
--
https://mail.python.org/mailman/listinfo/python-list
! You had the
right idea, you just did a little bit too much work.
--
Steven
--
https://mail.python.org/mailman/listinfo/python-list
should be sorry, because that was uncalled for as well as wrong.
--
Steven
--
https://mail.python.org/mailman/listinfo/python-list
ly mentioning this to you as a courtesy,
one human being to another. Please don't insult me by continuing this off-
topic discussion here on this Python list. This is comp.lang.python, not
comp.lang.teach.nikos.everything.he.needs.to.learn.
Come back when you have Python questions. Everything
On Wed, 02 Oct 2013 13:28:11 +0200, Antoon Pardon wrote:
> Op 02-10-13 11:08, Steven D'Aprano schreef:
>> On Wed, 02 Oct 2013 12:32:57 +0530, Ravi Sahni wrote:
>>
>>> I find this real confused!! Why they are answering then?!?! As far as
>>> I can make
t it.
https://duckduckgo.com/html/?q=run+arbitrary+shell+commands+MySQL
https://www.google.com.au/search?q=run+arbitrary+shell+commands
--
Steven
--
https://mail.python.org/mailman/listinfo/python-list
style, it just won't be as
heavily optimized.
--
Steven
--
https://mail.python.org/mailman/listinfo/python-list
On Wed, 02 Oct 2013 16:41:40 +0300, Νίκος wrote:
> Στις 2/10/2013 4:25 μμ, ο/η Steven D'Aprano έγραψε:
>> On Wed, 02 Oct 2013 15:20:00 +0300, Νίκος wrote:
>>
>>> Is it possible for someone that knows the MYSQL password of a server
>>> to run arbitrary co
On Wed, 02 Oct 2013 10:04:49 -0400, random832 wrote:
> On Wed, Oct 2, 2013, at 9:32, Steven D'Aprano wrote:
>> Python is not as aggressively functional as (say) Haskell, but it is
>> surely an exaggeration to suggest that the failure to include tail call
>> optimization
'exec'))
0 SET_LINENO 0
3 SET_LINENO 1
6 LOAD_CONST 0 (1)
9 LOAD_CONST 1 (2)
12 LOAD_CONST 2 (3)
15 BUILD_TUPLE 3
18 STORE_NAME 0 (x)
21 LOAD_CONST 3 (None)
24 RETURN_VALUE
--
Steven
--
https://mail.python.org/mailman/listinfo/python-list
On Thu, 03 Oct 2013 02:46:53 +0100, MRAB wrote:
> On 03/10/2013 02:39, Dave Angel wrote:
>> On 2/10/2013 21:24, Steven D'Aprano wrote:
>>
>>> On Wed, 02 Oct 2013 18:17:06 -0400, Terry Reedy wrote:
>>>
>>>> CPython core developers have be very co
just a few days than
Walter has in months. We need more people like you.
--
Steven
--
https://mail.python.org/mailman/listinfo/python-list
either being ignored or being
abused.
And quite frankly, although I might *prefer* a gentle request asking for
more information, I might *need* something harsher for the lesson to
really sink in. Negative reinforcement is a legitimate teaching tool,
provided it doesn't cross the line into abuse.
--
Steven
--
https://mail.python.org/mailman/listinfo/python-list
save
creating a small list.
More likely would be implementations that didn't re-use constants, than
implementations that aggressively re-used everything possible.
--
Steven
--
https://mail.python.org/mailman/listinfo/python-list
On Thu, 03 Oct 2013 17:31:44 +0530, Ravi Sahni wrote:
> On Thu, Oct 3, 2013 at 5:05 PM, Steven D'Aprano
> wrote:
>> No, you are welcome here. You've posted more in just a few days than
>> Walter has in months. We need more people like you.
>
> Thanks for the w
nd
changing the semantics to prohibit it would be a Bad Thing.
However, I can imagine something like a __future__ directive that
enables, or disables, such optimizations on a per-module basis. In Python
3, it would have to be disabled by default. Python 4000 could make the
optimizations e
g in your question appears to be about Python. If I am
mistaken, please re-word your question explain what Python code you are
having trouble with, what you tried, what you expected, and what it
actually did.
--
Steven
--
https://mail.python.org/mailman/listinfo/python-list
s can be useful, although it counts as
"clever code", possibly "too clever".
--
Steven
--
https://mail.python.org/mailman/listinfo/python-list
ster_all()
As far as I know, there is no way to find out what error handlers are
registered, and no way to deregister one after it has been registered.
Which API would you prefer if you were using this module?
--
Steven
--
https://mail.python.org/mailman/listinfo/python-list
could use improvement, but
incorrect code that doesn’t crash is a horrible nightmare."
-- Chris Smith
http://cdsmith.wordpress.com/2011/01/09/an-old-article-i-wrote/
--
Steven
--
https://mail.python.org/mailman/listinfo/python-list
or, wondering
why his byte-stream of 0x66... displays with a strange 'f'.
If you ask me, including ASCII in the printable representation of byte
strings in Python 3 is buggy by design :-(
--
Steven
--
https://mail.python.org/mailman/listinfo/python-list
times you need to extend the class itself. You can
do that by adding methods to the class:
def minus_one(self):
return self.arg-1
NewTest.minus_one = minus_one
--
Steven
--
https://mail.python.org/mailman/listinfo/python-list
return
...
py> Wot
42
But I digress. In your case, you are using a subclass of type as your
metaclass, and it is creating a new instance of FooMeta. When a new
instance is created, FooMeta.__new__ is called.
To get the effect you are after, you can:
1) Use FooMeta.__new__ instead of __call__;
2) Use a metaclass of the metaclass, FooMetaMeta.__call__; or
3) Use a function that takes the same signature as type.
--
Steven
--
https://mail.python.org/mailman/listinfo/python-list
print(msg)
super(MySubclass, self).spam(*args, **kwargs)
kwargs is also handy for implementing keyword-only arguments in Python 2
(in Python 3 it isn't needed). But in that case, you don't have to worry
about matching up keyword args by position, since position is normally
irrelevant. Python's basic named argument handling should cover nearly
all the code you want to write, in my opinion.
--
Steven
--
https://mail.python.org/mailman/listinfo/python-list
):
instance = super(Subclass, cls).__new__(cls, *args, **kwargs)
# process additional arguments
instance.apply_extras(sneaky, grabby, touchy, feely)
return instance
In general, you should aim to use either __new__ or __init__ but not
both, although that's not a hard law, just a guideline.
Can you adapt this pattern to ndarray?
--
Steven
--
https://mail.python.org/mailman/listinfo/python-list
def foo(arg):
do stuff here
foo(arg-1) # how does Scheme know that this is the same foo?
--
Steven
--
https://mail.python.org/mailman/listinfo/python-list
om/enriquepablo/nl/
http://code.google.com/p/fuxi/
https://sites.google.com/site/pydatalog/
to say nothing of similar, more advanced languages like Mercury. Just
because *you personally* don't understand something, don't think that
nobody else does.
--
Steven
--
https://mail.python.org/mailman/listinfo/python-list
can simulate it in software.
So in that sense, computers are Turing Machines. Anything a physical
computing device can compute, a Turing Machine could too. The converse is
not true though: a Turing Machine with infinite tape can compute things
where a real physical device would run out of mem
ou're then
> merely stating an English construct.
What difference does it make? But if it will make you feel better, I'm
specifying Hypertalk. You've probably never heard of it, but regardless,
it exists, and it has a sort command, and the high-level language does
not specify whic
cal details or
complications. For example, we often talk about "hand-wavy estimates" for
how long a job will take: "my hand-wavy estimate is it will take two
days" is little better than a guess.
--
Steven
--
https://mail.python.org/mailman/listinfo/python-list
st(metaclass=Meta):
... __test = 'foo'
...
{'__module__': '__main__', '_Test__test': 'foo', '__qualname__': 'Test'}
so I think it is done by the parser.
--
Steven
--
https://mail.python.org/mailman/listinfo/python-list
')
Traceback (most recent call last):
File "", line 1, in
UnicodeEncodeError: 'utf-8' codec can't encode character '\ud800' in
position 0: surrogates not allowed
Have I misunderstood? I think that Python is being too strict about
rejecting surrogate code poi
t we are volunteers and we are not being paid to help you.
The harder you make it for us to understand your posts, the less likely
we are to solve your problem.
--
Steven
--
https://mail.python.org/mailman/listinfo/python-list
x27;t always clearly
distinguish between when they are talking about bytes and when they are
talking about code points. This area about surrogates is one of places
where they conflate the two.
--
Steven
--
https://mail.python.org/mailman/listinfo/python-list
etation of the FAQ.
[1] Sequences of Unicode code points.
--
Steven
--
https://mail.python.org/mailman/listinfo/python-list
ages/0/0c/Its_a_trap.jpg
There is a very simple and comprehensive way for Google to learn about
your visitors: Google Analytics.
--
Steven
--
https://mail.python.org/mailman/listinfo/python-list
ld reconsider the
decision to rely on cookies.
--
Steven
--
https://mail.python.org/mailman/listinfo/python-list
e trouble with random, you can never quite tell.
--
Steven
--
https://mail.python.org/mailman/listinfo/python-list
On Tue, 08 Oct 2013 21:28:25 -0400, Terry Reedy wrote:
> On 10/8/2013 6:30 PM, Steven D'Aprano wrote:
>> On Tue, 08 Oct 2013 15:14:33 +, Neil Cerutti wrote:
>>
>>> In any case, "\ud800\udc01" isn't a valid unicode string.
>>
>> I don
in the position of needing
to learn about running a website, and can point Nikos in the right
direction (away from here). How did you learn?
And if nobody is able, or willing, to answer? I've been in that position
too, asking for help that nobody was able to give. It sucks, and you m
have a grab-bag of whatever
arbitrary values the language designer thought ought to be truthy/falsey.
> and
>
> --> Is there a common idiom for taking advantage of the similar behavior
> of "and". The "override or default" just makes me grin every time I use
> it.
Not that I can think of.
--
Steven
--
https://mail.python.org/mailman/listinfo/python-list
On Thu, 10 Oct 2013 00:31:06 +, Denis McMahon wrote:
> On Wed, 09 Oct 2013 23:48:12 +0000, Steven D'Aprano wrote:
>
>> On Wed, 09 Oct 2013 18:06:05 +, Denis McMahon wrote:
>>
>>> Find the relevant forums and ask in them.
>>
>> In fairness t
Hi Errol,
Happy to help, but first I have a brief note about house-keeping... this
group is both a mailing list and a newsgroup on Usenet. A text newsgroup,
so I'm afraid that HTML posts are frowned upon, because a large number of
people reading this will see your message something like this:
e using UTF-8
in the first place. In Python 3, you can pass a codec to open. In Python
2, you can use codecs.open instead of the built-in open.
--
Steven
--
https://mail.python.org/mailman/listinfo/python-list
Just came across this little Javascript gem:
",,," == Array((null,'cool',false,NaN,4));
=> evaluates as true
http://wtfjs.com/2011/02/11/all-your-commas-are-belong-to-Array
I swear, I am never going to complain about Python again.
--
Steven
--
https://mail.pyth
On Wed, 09 Oct 2013 22:36:54 -0700, rusi wrote:
> On Thursday, October 10, 2013 6:40:19 AM UTC+5:30, Steven D'Aprano
> wrote:
>>
>> I have no objection to encouraging people to read the fine manual, and
>> I don't intend to be Nikos' (or anyone el
persistent cluelessness counts as wilful disruption, but otherwise I'm
not disagreeing with you.
--
Steven
--
https://mail.python.org/mailman/listinfo/python-list
mmutative and non-associative, (o1*o2)*o3 != o1*(o2*o3), and sedenions,
a 16-dimensional number.
--
Steven
--
https://mail.python.org/mailman/listinfo/python-list
7101 - 7200 of 15564 matches
Mail list logo