On Thu, Jun 5, 2014 at 10:17 AM, Robin Becker wrote:
> in python 2 str and unicode were much more comparable. On balance I think
> just reversing them ie str --> bytes and unicode --> str was probably the
> right thing to do if the default conversions had been turned off. However
> making bytes a
On Thu, Jun 5, 2014 at 1:58 PM, Paul Rubin wrote:
> Ryan Hiebert writes:
>> How so? I was using line=line[:-1] for removing the trailing newline, and
>> just replaced it with rstrip('\n'). What are you doing differently?
>
> rstrip removes all the newlines off the end, whether there are zero or
>
On Thu, Jun 5, 2014 at 2:34 PM, Albert-Jan Roskam wrote:
>> If you want to be really picky about removing exactly one line
>> terminator, then this captures all the relatively modern variations:
>> re.sub('\r?\n$|\n?\r$', line, '', count=1)
>
> or perhaps: re.sub("[^ \S]+$", "", line)
That will r
On Sat, Jun 7, 2014 at 11:40 AM, 1989lzhh <1989l...@gmail.com> wrote:
> Here is the code
> m1.py
> def f():
> print globals()
>
> m2.py
> from m1 import f
> f()# how to get current module's globals?
Evaluate globals() in the current module and pass the resulting dict
in as a parameter:
# m1.p
On Sat, Jun 7, 2014 at 12:45 AM, jongiddy wrote:
> The language D has a feature called Uniform Function Call Syntax, which
> allows instance methods to be resolved using function calls.
>
> In Python terms, the call:
>
> x.len()
>
> would first check if 'x' has a method 'len', and would then look
On Sun, Jun 8, 2014 at 9:56 AM, Marko Rauhamaa wrote:
> Paul Sokolovsky :
>
>> Python already has that - like, len(x) calls x.__len__() if it's
>> defined
>
> In fact, what's the point of having the duality?
>
>len(x) <==> x.__len__()
>
>x < y <==> x.__lt__(y)
>
>str(x) <==> x.__str__(
On Sun, Jun 8, 2014 at 10:24 AM, jongiddy wrote:
> A contrived example - which of these is easier to understand?
>
> from base64 import b64encode
>
> # works now
> print(b64encode(str(min(map(int, f.readlines()), key=lambda n: n % 10)),
> b'?-'))
>
> # would work with UFCS
> f.readlines().map(int
On Sun, Jun 8, 2014 at 2:15 AM, jongiddy wrote:
> One problem with your untested code, the superclasses would need to be
> checked before using UFCS, so the structure is:
>
> try:
> return super().__getattr__(attr)
> except AttributeError:
> # resolve using UFCS
And then if UFCS finds no
On Sun, Jun 8, 2014 at 10:48 AM, Chris Angelico wrote:
> Except that it's even more complicated than that, because hasattr
> wasn't defined in your module, so it has a different set of globals.
> In fact, this would mean that hasattr would become quite useless.
hasattr is a builtin, so it has no
On Sun, Jun 8, 2014 at 11:13 AM, Chris Angelico wrote:
> On Mon, Jun 9, 2014 at 3:08 AM, Ian Kelly wrote:
>> On Sun, Jun 8, 2014 at 10:48 AM, Chris Angelico wrote:
>>> Except that it's even more complicated than that, because hasattr
>>> wasn't defined in y
On Fri, Jun 6, 2014 at 2:34 PM, Josh English wrote:
> I have been using os.startfile(filepath) to launch files I've created in
> Python, mostly Excel spreadsheets, text files, or PDFs.
>
> When I run my script from my IDE, the file opens as I expect. But if I go
> back to my script and re-run it
On Sun, Jun 8, 2014 at 12:02 PM, Ian Kelly wrote:
> On Sun, Jun 8, 2014 at 11:57 AM, Joshua Landau wrote:
>> On 8 June 2014 08:12, Marko Rauhamaa wrote:
>>>
>>> Does anyone have an example motivating a return from finally? It seems
>>> to me it would always
On Sun, Jun 8, 2014 at 11:57 AM, Joshua Landau wrote:
> On 8 June 2014 08:12, Marko Rauhamaa wrote:
>>
>> Does anyone have an example motivating a return from finally? It seems
>> to me it would always be a bad idea as it silently clears all unexpected
>> exceptions.
>
> In a general sense:
>
>
On Jun 8, 2014 9:56 PM, "Steven D'Aprano"
> > which means that hasattr (which is defined by
> > attempting to get the attribute and seeing if an exception is thrown)
> > has to return True.
>
> Yes. And this is a problem why?
Earlier in this thread I pointed out that returning True creates problem
On Mon, Jun 9, 2014 at 9:34 AM, Roy Smith wrote:
> We noticed recently that:
>
None in 'foo'
>
> raises (at least in Python 2.7)
>
> TypeError: 'in ' requires string as left operand, not NoneType
>
> This is surprising. The description of the 'in' operatator is, 'True if an
> item of s is e
On Mon, Jun 9, 2014 at 10:59 AM, Chris Angelico wrote:
> On Tue, Jun 10, 2014 at 2:53 AM, Roy Smith wrote:
>> In retrospect, I suspect:
>>
>> hourly_data = [(t if status in set('CSRP') else None) for (t,
>> status) in hours]
>>
>> is a little cleaner.
>
> I'd go with this. It's clearer
On Mon, Jun 9, 2014 at 11:40 AM, Chris Angelico wrote:
> Also, this is the first time I've seen None as a constant other than
> the first. Usually co_consts[0] is None, but this time co_consts[4] is
> None.
Functions always seem to have None as the first constant, but modules
and classes are othe
On Mon, Jun 9, 2014 at 9:54 PM, Stefan Ram wrote:
> Chris Angelico writes:
>>On Tue, Jun 10, 2014 at 12:57 PM, Stefan Ram wrote:
>>>AFAIK standard Python has no GUI library at all, so Java SE
>>>and C# already are better than Python insofar as they
>>>include a standard GUI toolkit at all! In Py
On Wed, Jun 11, 2014 at 1:19 AM, Frank Millman wrote:
> First attempt - same as before
>
> loop = asyncio.get_event_loop()
> threading.Thread(target=loop.run_forever).start()
> input('Press to stop')
> loop.stop()
> loop.close()
Each event loop is hosted by a specific thread.
On Thu, Jun 12, 2014 at 12:18 PM, Robert Lehmann wrote:
> Hi all,
>
> I have noticed there is a slight asymmetry in the way the interpreter
> (v3.3.5, reproduced also in v3.5.x) loads and stores globals. While loading
> globals from a custom mapping triggers __getitem__ just fine, writing seems
>
On Fri, Jun 13, 2014 at 5:42 AM, Frank Millman wrote:
> Now I want to use the functionality of asyncio by using a 'yield from' to
> suspend the currently executing function at a particular point while it
> waits for some information. I find that adding 'yield from' turns the
> function into a gene
On Sat, Jun 14, 2014 at 8:51 PM, Steven D'Aprano
wrote:
> Does anyone know any examples of values or types from the standard
> library or well-known third-party libraries which satisfies
> isinstance(a, numbers.Number) but not isinstance(a, numbers.Complex)?
>>> issubclass(decimal.Decimal, number
On Sun, Jun 15, 2014 at 11:28 AM, Roy Smith wrote:
> In article <539dbcbe$0$29988$c3e8da3$54964...@news.astraweb.com>,
> Steven D'Aprano wrote:
>
>> On Sun, 15 Jun 2014 01:22:50 -0600, Ian Kelly wrote:
>>
>> > On Sat, Jun 14, 2014 at 8:51 PM, Steven D
On Wed, Jun 18, 2014 at 10:36 AM, wrote:
> The questions are,
> i) prev_f_sum = sum(f_prev[k]*a[k][st] for k in states)
> here f_prev is called,
> f_prev is assigned to f_curr ["f_prev = f_curr"]
> f_curr[st] is again being calculated as, ["f_curr[st] = e[st][x_i] *
> prev_f_sum"] which again
On Wed, Jun 18, 2014 at 5:03 PM, cutey Love wrote:
> I'm trying to write data to a text file
>
> But I'm getting the error:
>
> TypeError: invalid file: <_io.TextIOWrapper
Post the full traceback. By posting only the error message you're
removing useful information.
--
https://mail.python.org/m
On Wed, Jun 18, 2014 at 4:32 PM, cutey Love wrote:
> Hi, thanks for the replies,
>
> I mean windows displays "Not responding close the program now"
>
> How can I do it asynconistrically?
>
> It's simple code just open file, loop through line by line and do some
> comparons with the string.
If al
On Wed, Jun 18, 2014 at 11:50 PM, wrote:
> Thank you for the reply. But as I checked it again I found,
> f_prev[k] is giving values of f_curr[st] = e[st][x_i] * prev_f_sum
> which is calculated later and again uses prev_f_sum.
f_prev is the f_curr that was calculated on the previous iteration of
On Thu, Jun 19, 2014 at 12:48 AM, Nicholas Cannon
wrote:
> On Thursday, June 19, 2014 1:53:31 PM UTC+8, Nicholas Cannon wrote:
>> I am making a calculator and i need it to support floating point values but
>> i am using the function isnumeric to check if the user has entered an int
>> value. I n
On Thu, Jun 19, 2014 at 1:23 AM, Ian Kelly wrote:
> On Thu, Jun 19, 2014 at 12:48 AM, Nicholas Cannon
> wrote:
>> On Thursday, June 19, 2014 1:53:31 PM UTC+8, Nicholas Cannon wrote:
>>> I am making a calculator and i need it to support floating point values but
>&g
On Thu, Jun 19, 2014 at 3:48 AM, wrote:
> I am trying to see this line,
> prev_f_sum = sum(f_prev[k]*a[k][st] for k in states)
>
> a[k][st], and f_prev[k] I could take out and understood.
> Now as it is doing sum() so it must be over a list,
> I am trying to understand the number of entities in t
On Thu, Jun 19, 2014 at 12:44 PM, wrote:
> Dear Group,
> Generally most of the issues are tackled here, but as I am trying to cross
> check my understanding I found another question,
>
> f_curr[st] = e[st][x_i] * prev_f_sum
>
> Here, if I give one print command and see the results,
> print "$$2"
On Fri, Jun 20, 2014 at 12:14 AM, Nicholas Cannon
wrote:
> Guys i am only a beginner at python most of the stuff you are saying i need
> to do i dont understand.
All we're saying is that the simplest and most accurate way to
determine whether a string can be converted to an int or a float is to
On Fri, Jun 20, 2014 at 8:28 AM, Grant Edwards wrote:
> On 2014-06-20, Mark Lawrence wrote:
>
>> For the OP a very important rule of thumb is never use a bare except, so
>> this is right out.
>>
>> try:
>> doSomething()
>> except:
>> WTF()
>
> IMO, that sort of depends on WTF() does. On
On Thu, Jun 26, 2014 at 9:24 AM, dandrigo wrote:
> Dear all,
>
> I coded a python script (web service with query postgresql/postgis). Up to
> now, i did several test on my local laptop station (windows).
>
> Now i want to execute this python script on our remote server (Web server :
> Apache;OS :
On Thu, Jun 26, 2014 at 9:24 PM, Chris Angelico wrote:
> But you're right that this can be very surprising. And it's inherent
> to the concept of digits having more range than just "high" or "low",
> so there's no way you can get this with binary floats.
For an average of two numbers, I think tha
On Fri, Jun 27, 2014 at 10:05 AM, Skip Montanaro wrote:
> On Fri, Jun 27, 2014 at 10:55 AM, Mark Lawrence
> wrote:
>> Expectations don't count, measure it :)
>
> It's no contest. I have measured it (ages ago). The logging module
> does so many things that it's impossible for it to ever be as fas
On Tue, Jul 1, 2014 at 3:45 AM, Skip Montanaro wrote:
> On Tue, Jul 1, 2014 at 3:58 AM, Piyush Verma <114piy...@gmail.com> wrote:
>>
>> Since two threads are running same method, I wanted to know which main
>> thread will be interrupted in both case.
>
> I'm no threading expert, but a process can
On Tue, Jul 1, 2014 at 1:05 PM, Paul Sokolovsky wrote:
> On 01 Jul 2014 18:40:23 GMT
> Steven D'Aprano wrote:
>> http://nedbatchelder.com/blog/201405/github_monoculture.html
>
> Everyone who (re)posts stuff like that should have mandatory N.B. of "I
> just bought a server farm to offer an alterna
On Wed, Jul 2, 2014 at 10:55 PM, Gregory Ewing
wrote:
> Although loss of precision might give you the
> right answer anyway. :-)
There aren't that many digits in the speed of light. Unless we're
talking about a very, very slow-moving automobile.
--
https://mail.python.org/mailman/listinfo/pytho
On Fri, Jul 4, 2014 at 8:00 PM, Rick Johnson
wrote:
> Strangly, I rather fancy the idea of using tabs in code,,,
> which allow each viewer to view the code in his or her level
> of indention,,, however, i cannot justify using a tab as a
> replacement for a space. Tabs should be used for "tabular"
On Sun, Jul 6, 2014 at 1:25 PM, Dan Stromberg wrote:
> I like tabs. Tabs work better for me than spaces, because I know how
> to use them. Also, some "make" tools insist on tabs.
Those tools are just as broken as the ones that only work with spaces.
Fortunately, I can't even remember the last t
On Sun, Jul 6, 2014 at 12:57 PM, wrote:
> I write the following code:
>
> ...
> import re
>
> line = "abcdb"
>
> matchObj = re.match( 'a[bcd]*b', line)
>
> if matchObj:
>print "matchObj.group() : ", matchObj.group()
>print "matchObj.group(0) : ", matchObj.group()
>print "matchObj.
On Mon, Jul 7, 2014 at 7:30 AM, wrote:
> Because I am new to Python, I may not describe the question clearly. Could you
> read the original problem on web:
>
> https://docs.python.org/2/howto/regex.html
>
> It says that it gets 'abcb'. Could you explain it to me? Thanks again
The string being ma
On Mon, Jul 7, 2014 at 8:41 AM, Piyush Verma <114piy...@gmail.com> wrote:
> Thanks Ian for information. There is slightly more I want to do. Consider if
> I want to kill some threads not all, is there a way to do that?
You can't safely interrupt threads. What you can do is *request* the
thread to
On Sun, Jul 6, 2014 at 4:49 PM, MRAB wrote:
> \d also matches more than just [0-9] in Unicode.
I think that anything matched by \d will also be accepted by int().
>>> decimals = [c for c in (chr(i) for i in range(17 * 2**16)) if
>>> unicodedata.category(c) == 'Nd']
>>> len(decimals)
460
>>> re.
On Mon, Jul 7, 2014 at 2:09 AM, Chris Angelico wrote:
> But if the code's more complicated and it's not so easy to split, then
> sure, doesn't seem a problem. It's like spam[foo//bar] and then
> catching either IndexError or ZeroDivisionError - there's no big
> confusion from having two distinct s
On Tue, Jul 8, 2014 at 8:53 AM, Anders J. Munch <2...@jmunch.dk> wrote:
> And that worked fine in my Python 2.4 apps. Then I upgraded to 2.7
> and it broke. Because 2.7 goes out of it's way to ensure that NaN's
> don't compare equal to themselves.
As far as I know nothing changed between 2.4 and
On Tue, Jul 8, 2014 at 1:16 PM, Ethan Furman wrote:
> What you said is: "They just don't appear in normal computation, because the
>
> interpreter raises an exception instead."
>
> I just ran a calculation that created a NaN, the same as 4 - 3 creates a 1,
> and no exception was raised.
>
> Do you
On Tue, Jul 8, 2014 at 12:54 PM, Anders J. Munch <2...@jmunch.dk> wrote:
>
> Ian Kelly wrote:
>>
>> As far as I know nothing changed between 2.4 and 2.7 in this regard.
>> Python has always had NaN compare unequal to everything, per the
>> standard.
>
> I
On Tue, Jul 8, 2014 at 2:10 PM, Anders J. Munch <2...@jmunch.dk> wrote:
> Steven D'Aprano wrote:
>> - Keeping reflexivity for NANs would have implied some pretty nasty
>>things, e.g. if log(-3) == log(-5), then -3 == -5.
>
>
log(-3)
> Traceback (most recent call last):
> File "", line 1, i
On Tue, Jul 8, 2014 at 3:53 PM, Ian Kelly wrote:
> On Tue, Jul 8, 2014 at 2:10 PM, Anders J. Munch <2...@jmunch.dk> wrote:
>> Steven D'Aprano wrote:
>>> - Keeping reflexivity for NANs would have implied some pretty nasty
>>>things, e.g. if log(-3) == log(
On Tue, Jul 8, 2014 at 4:03 PM, Ethan Furman wrote:
> On 07/08/2014 11:54 AM, Anders J. Munch wrote:
>>
>>
>> If a standard tells you to jump of a cliff...
>
>
> because a bunch of tanks are chasing you down, there's water at the bottom,
> and not a helicopter in sight...
>
> well, jumping off the
On Wed, Jul 9, 2014 at 10:53 AM, Steven D'Aprano
> Cast your 64-bit float into a 64-bit int. Or, if it's a C single rather
> than a double, cast the 32-bit float into a 32-bit int. Now you can
> compare them for equality without carrying about NANs, and without losing
> data. Later, when you're rea
On Wed, Jul 9, 2014 at 3:17 AM, Steven D'Aprano wrote:
> People are already having problems, just listen to Anders. He's
> (apparently) not doing NAN-aware computations on his data, he just wants
> to be able to do something like
>
> this_list_of_floats == that_list_of_floats
>
> without NANs scre
On Wed, Jul 9, 2014 at 8:27 AM, sssdevelop wrote:
> prev = 0
> blocks = []
> tmp = []
> last = 0
> for element in a:
>if prev == 0:
Is 0 allowed to be in the input list? What would happen if it were?
> next
This line doesn't do anything. It looks up the builtin function named
next an
On Wed, Jul 9, 2014 at 12:05 PM, Tim Chase
wrote:
> def equalish(x, y):
>return x == y or (math.isnan(x) and math.isnan(y))
With more generality:
def nan_type(x):
if isinstance(x, numbers.Complex):
if cmath.isnan(x): return 'qnan'
elif isinstance(x, decimal.Decimal):
On Wed, Jul 9, 2014 at 5:03 PM, Anders J. Munch <2...@jmunch.dk> wrote:
> Joel Goldstick wrote:
>>
>> I've been following along here, and it seems you haven't received the
>> answer you want or need.
>
>
> So far I received exactly the answer I was expecting. 0 examples of
> NaN!=NaN being benefic
On Thu, Jul 10, 2014 at 9:23 AM, fl wrote:
> Is '\A' the same with '^'?
> Is '\Z' the same with '$'?
The meanings of these are explained at:
https://docs.python.org/library/re.html#regular-expression-syntax
Outside of multiline mode, they're equivalent. In multiline mode, ^
and $ will also match
On Sat, Jul 12, 2014 at 8:05 PM, Rodrick Brown
wrote:
> if a == 13:
> t = b + c
This looks incorrect. So no, I don't think the problem is with codingbat.
--
https://mail.python.org/mailman/listinfo/python-list
On Mon, Jul 14, 2014 at 10:44 AM, Anders J. Munch <2...@jmunch.dk> wrote:
> alister wrote:
>>
>> I don't have time to start this discussion over again on another mailing
>> list.
>> Don't anyone on those lists read python-list also?
>>
>> they possibly do, but prefer to keep discussions to the prop
On Mon, Jul 14, 2014 at 2:01 PM, Terry Reedy wrote:
> The under-known difflib.differ shows within line differences.
> Your example would look like:
>
> -if not metar.is_in_temp_range_f(...):
> ? ^
> +if not info.is_in_temp_range_f
> ?
>
> Deletions and insertio
On Tue, Jul 15, 2014 at 12:01 PM, Rick Johnson
wrote:
> On Tuesday, July 15, 2014 9:31:31 AM UTC-5, Chris Angelico wrote:
>> [...] That said, though, I would advise you to give 2to3 a
>> shot. You never know, it might do exactly what you need
>> right out-of-the-box and give you a 3.x-compatible
>
On Tue, Jul 15, 2014 at 2:20 PM, Rick Johnson
wrote:
> On Tuesday, July 15, 2014 1:53:27 PM UTC-5, Steven D'Aprano wrote:
>
>> No software developer is obliged to support their software
>> forever, especially if they are giving it away for free
>> [...] Nobody but nobody is supporting Python 1.1 a
On Wed, Jul 16, 2014 at 11:33 AM, Javier wrote:
> I think there has been a severe miscalculation, and the change in the
> name of the interpreter python3 to python
> http://legacy.python.org/dev/peps/pep-0394/ is a good example of the
> disconnection between GvR and the real world.
Er, that PEP c
On Wed, Jul 16, 2014 at 11:32 AM, Deb Wyatt wrote:
> Can you all stop already with the non python US bashing? Please?
I read it more as counter-US-glorification-trolling than bashing, but
in any case that subthread seems to have died down already, so you
should be safe to start reading again if
On Thu, Jul 17, 2014 at 1:10 PM, Marko Rauhamaa wrote:
> Mathematically, there are undefined operations, for a good reason.
> That's because the limits are not unambiguous and that's why 0/0, 0**0,
> 1/0 and inf-inf are undefined.
Well, 0**0 is usually defined as 1, despite the limits being
ambig
On Thu, Jul 17, 2014 at 3:08 PM, Marko Rauhamaa wrote:
> Ian Kelly :
>
>> Well, 0**0 is usually defined as 1, despite the limits being
>> ambiguous.
>
> https://www.math.hmc.edu/funfacts/ffiles/10005.3-5.shtml>
>
> But if it could be defined, what "shou
On Thu, Jul 17, 2014 at 5:00 PM, Ian Kelly wrote:
> On Thu, Jul 17, 2014 at 3:08 PM, Marko Rauhamaa wrote:
>> Ian Kelly :
>>
>>> Well, 0**0 is usually defined as 1, despite the limits being
>>> ambiguous.
>>
>> https://www.math.hmc.edu/funfacts/ffil
On Thu, Jul 17, 2014 at 9:37 PM, Rick Johnson
wrote:
> On Thursday, July 17, 2014 9:15:15 PM UTC-5, Chris Angelico wrote:
>> For myself, though, I completely do not use the editor half of [IDLE]; but
>> it's spectacularly useful (with limitations) as my primary interactive
>> interpreter.
>
> Yes
On Sat, Jul 19, 2014 at 10:41 AM, Chris Angelico wrote:
>> However, a *bare* HOME_KEY press is placing the insertion
>> cursor *BEHIND* the prompt of the current line. In a shell
>> environment, you never want to be *BEHIND* the command
>> prompt.
>
> I don't know about the old versions, but in 3.
On Sat, Jul 19, 2014 at 12:24 PM, Mark Lawrence wrote:
> Besides that I wouldn't write the function on one line, the first. Once you
> return your data you can do what you want with it. The second you can only
> write by default to stdout. The third is really horrible in my book, YMMV.
I agree
On Sat, Jul 19, 2014 at 12:52 PM, C.D. Reimer wrote:
> I've seen code samples for simple functions with the definition and return
> statements written on one line.
Personally, I use this style sometimes for easily understood one-line
if statements or loops. Named functions consist of an interface
On Jul 24, 2014 1:26 AM, "Marko Rauhamaa" wrote:
>
> Terry Reedy :
>
> > 18.5.3. Tasks and coroutines, seems to be devoid of event wait
> > examples. However, there is a 'yield from' network example in 18.5.5
> > Streams using socket functions wrapped with coroutines. These should
> > definitely b
On Thu, Jul 24, 2014 at 11:33 AM, fl wrote:
> Hi,
> I want to write some test code. Some on-line tutorials have such codes:
>
>
> from unnecessary_math import multiply
>
> When it runs, it has errors:
>
from unnecessary_math import multiply
> Traceback (most recent call last):
> File "", li
On Thu, Jul 24, 2014 at 1:02 PM, Chris “Kwpolska” Warrick
wrote:
> AFAIK, Qt follows the system style properly, and it looks quite native
> on every Windows OS. No idea about ttk though.
My understanding is that Qt merely emulates the native LAF, although
it does a good job of it. wxPython on th
On Thu, Jul 24, 2014 at 2:25 PM, fl wrote:
> Hi,
>
> I have seen several kinds of module import examples, but most of the programs
> are
> small and less content. They only have one or two module import.
>
> I'll use the following modules in a small project. I would like to know
> whether
> it i
On Thu, Jul 24, 2014 at 7:29 PM, fl wrote:
> On Thursday, July 24, 2014 10:25:52 AM UTC-4, Marko Rauhamaa wrote:
>> #!/usr/bin/env python3
>>
>> import math
>>
>> for x in range(0, 361, 15):
>>
>> print(int((math.sin(x / 180 * math.pi) + 1) * 30 + 0.5) * " " + "*")
>>
>> ==
On Fri, Jul 25, 2014 at 5:08 PM, fl wrote:
> I want to use your reply about numpy, but I find only the following works:
>
> import numpy as numpy
>
> Do you have other ways to import? (I find the above import a little more
> letters)
What's wrong with:
import numpy
--
https://mail.python.org/m
On Jul 25, 2014 6:54 PM, "Dan Stromberg" wrote:
>
> On Fri, Jul 25, 2014 at 5:21 PM, Skip Montanaro wrote:
> >> OK, Eclipse with PyDev doesn't like this first line, with the function:
> >> def add(self, (sub, pred, obj)):
> >>
> >> It complains about the parentheses just before sub.
> >
> > Seems
On Jul 30, 2014 4:37 AM, "Robert Kern" wrote:
>
> On 2014-07-30 09:46, Peter Otten wrote:
>>
>> Steven D'Aprano wrote:
>>
>>> I'm looking for a programmatic way to get a list of all Python modules
>>> and packages. Not just those already imported, but all those which
>>> *could* be imported.
>>>
>
On Thu, Jul 31, 2014 at 5:24 AM, Dilu Sasidharan wrote:
> Hi,
>
> I am wondering why the dictionary in python not returning multi value key
> error when i define something like
>
> p = {'k':"value0",'k':"value1"}
>
> key is string immutable and sometimes shares same id.
>
> also if the key is immu
On Thu, Jul 31, 2014 at 1:17 PM, Terry Reedy wrote:
> On 7/31/2014 7:24 AM, Dilu Sasidharan wrote:
>
>> I am wondering why the dictionary in python not returning multi value
>> key error when i define something like
>>
>> p = {'k':"value0",'k':"value1"}
>
>
> This is documented behavior: "you can
On Thu, Jul 31, 2014 at 9:28 PM, Terry Reedy wrote:
> On 7/31/2014 5:15 PM, Ian Kelly wrote:
>>
>> On Thu, Jul 31, 2014 at 5:24 AM, Dilu Sasidharan
>> wrote:
>>>
>>> Hi,
>>>
>>> I am wondering why the dictionary in python not returni
On Sat, Aug 2, 2014 at 2:46 PM, Mark Summerfield wrote:
> On Saturday, 2 August 2014 20:58:59 UTC+1, Ben Finney wrote:
>> Steven D'Aprano writes:
>>
>> > If you need instances which carry state, then object is the wrong
>> > class.
>
> Fair enough.
>
>> Right. The 'types' module provides a Simple
On Sun, Aug 3, 2014 at 11:41 PM, Marko Rauhamaa wrote:
> Steven D'Aprano :
> And I'm talking about a third kind: object-based. It is in active
> (albeit limited) use in scheme: http://irreal.org/blog/?p=40>. I'm
> currently using the principle in a project of mine.
>
> In Java, you use anonymous c
On Tue, Aug 5, 2014 at 1:39 PM, Christian Calderon
wrote:
> I have been using python for 4 years now, and I just started learning ruby.
> I like that in ruby I don't have to type parenthesis at the end of each
> function call if I don't need to provide extra arguments. I just realized
> right now
On Fri, Aug 8, 2014 at 7:25 AM, Ethan Furman wrote:
> On 08/08/2014 04:51 AM, cool-RR wrote:
>>
>>
>> If I want to acquire a `threading.Lock` using the context manager
>> protocol,
>> is it possible to specify the `blocking` and `timeout` arguments that
>> `acquire` would usually take?
>
>
> Not
On Fri, Aug 8, 2014 at 3:01 AM, Paul Wolf wrote:
> * Uses SystemRandom class (if available, or falls back to Random)
A simple improvement would be to also allow the user to pass in a
Random object, in case they have their own source of randomness they
want to use, or for fake Randoms used for wri
On Sat, Aug 9, 2014 at 12:52 AM, Paul Wolf wrote:
> On Friday, 8 August 2014 23:03:18 UTC+1, Ian wrote:
>> Have you given any thought to adding a validation mode, where the user
>> provides a template and a string and wants to know if the string
>> matches the template?
>
> Isn't that what regula
On Sat, Aug 9, 2014 at 1:49 AM, Ian Kelly wrote:
> On Sat, Aug 9, 2014 at 12:52 AM, Paul Wolf wrote:
>> On Friday, 8 August 2014 23:03:18 UTC+1, Ian wrote:
>>> Have you given any thought to adding a validation mode, where the user
>>> provides a template and a stri
On Sat, Aug 9, 2014 at 7:44 PM, Yuanchao Xu wrote:
> 1. I wonder in python, is there any more fast way to generate this kind of
> map, as a whole, not a series of shapes, i think that would be faster??
You mean like collecting all the shapes into a single sparse array and
passing the single array
On Aug 10, 2014 6:45 AM, "Devin Jeanpierre" wrote:
> > * Uses SystemRandom class (if available, or falls back to Random)
>
> This sounds cryptographically weak. Isn't the normal thing to do to
> use a cryptographic hash function to generate a pseudorandom sequence?
You mean in the fallback case,
On Sun, Aug 10, 2014 at 10:34 AM, Paul Wolf wrote:
> For instance, a template language that validates the output would have to do
> frequency analysis. But that is getting too far off the purpose of strgen,
> although such a mechanism would certainly have its place.
I don't think that would be
On Tue, Aug 12, 2014 at 8:12 AM, Grant Edwards wrote:
> On 2014-08-12, Chris “Kwpolska” Warrick wrote:
>> On Mon, Aug 11, 2014 at 8:53 PM, Grant Edwards
>> wrote:
>>> I just installed Arch Linux for the first time, and was surprosed to
>>> find that Python isn't installed as part of a "base" sy
On Tue, Aug 12, 2014 at 11:02 AM, cool-RR wrote:
> And that's it, no coroutines, no `yield from`. Since, if I understand
> correctly, asyncio requires a mainloop, it would make sense for the
> AsyncIOExecutor to have a thread of its own in which it could run its
> mainloop.
I think that puttin
On Tue, Aug 12, 2014 at 11:03 PM, Marko Rauhamaa wrote:
>
> Ian Kelly :
>
> > On Tue, Aug 12, 2014 at 11:02 AM, cool-RR wrote:
> >> And that's it, no coroutines, no `yield from`. Since, if I understand
> >> correctly, asyncio requires a mainloop, it would m
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
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
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
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
2701 - 2800 of 3558 matches
Mail list logo