On Wed, Sep 16, 2015 at 11:24 AM, Steven D'Aprano wrote:
>
> if word in line in text:
> print("word in line and line in text")
It find it hard to imagine how one would arrive at the situation of
needing to check this.
--
https://mail.python.org/mailman/listinfo/python-list
On Thu, Sep 17, 2015 at 3:19 AM, wrote:
> This is not true that only two percent of this world can solve this puzzle.
> May be the 2% will solve it by a quick look on the statements.
Are you replying to this thread?
https://mail.python.org/pipermail/python-list/2001-March/063293.html
I had to
On Thu, Sep 17, 2015 at 1:06 AM, Jussi Piitulainen
wrote:
> Ordinary binary operators not only combine things of the same type, they
> also produce a thing of that same type. So 'in' does not fit among them
> either.
>
> I feel it's _more_ at home among comparison operators. (Hm. That's
> 'operato
On Fri, Sep 18, 2015 at 1:12 PM, Random832 wrote:
> On Fri, Sep 18, 2015, at 14:24, Terry Reedy wrote:
>> The semantics Python copies from math is "a op b op c == a op b and b op
>> c",
>
> I don't believe those *are* the semantics in math. I believe that in
> math this notation is *specifically*
On Fri, Sep 18, 2015 at 7:45 AM, Christian Gollwitzer wrote:
> The first error indicates, that you are running Python 3, and the script was
> made for Python 2. In Python 3, print is a function so you need parentheses
> around that print("Initializing...") - either fix that
> or install Python 2.
On Mon, Sep 21, 2015 at 7:58 AM, Dave Green
wrote:
>
> Hi
> I have just spent the last few hours trying to install Python 3.5 64 bit
and 32 bit as I am
> trying to install pygame so I can learn Python. However the only versions
that seems to work
> are Python-2.7.10 with pygame-1.91.win32-py2.7.
>
On Tue, Sep 22, 2015 at 12:43 PM, Python_Teacher via Python-list
wrote:
> you have 10 minutes😂 Good luck!!
Sorry, I'm more interested in critiquing the questions than answering them.
> Let's define the function plural :
>
> def plural(words):
> plurals = []
> for word in words:
>
On Tue, Sep 22, 2015 at 3:18 PM, wrote:
> On Tuesday, September 22, 2015 at 11:45:00 AM UTC-7, Lj Fc wrote:
>> you have 10 minutes😂 Good luck!!
>
> Pretty sure this guy is asking us to do his homework. :-P
Well, looks like it was due 2 hours ago.
--
https://mail.python.org/mailman/listinfo/pyt
On Sep 22, 2015 3:46 PM, "Chris Roberts" wrote:
>
>
> (How do I make it into an index? )
> Preferably something fairly easy to understand as I am new at this.
>
> results = 134523 #(Integer)
>
> Desired:
> results = [1, 2, 3, 4, 5, 2, 3] #(INDEX)
>
> Somehow I see ways to convert index to l
On Tue, Sep 22, 2015 at 4:55 PM, Chris Angelico wrote:
> The Python list.sort() method is guaranteed to be
> stable. I can't find a comparable guarantee for sorted()
https://docs.python.org/3.5/library/functions.html#sorted
--
https://mail.python.org/mailman/listinfo/python-list
On Wed, Sep 23, 2015 at 6:47 AM, SANKAR . wrote:
> Hi all,
>
> I am not a expert programmer but I have to extract information from a large
> file.
> I used codecs.open(..) with UTF16 encoding to read this file. It could
> read all the lines in the file but returns with the non Ascii characters.
On Wed, Sep 23, 2015 at 12:12 PM, James Harris wrote:
> A list comprehension has various components. Anyone know when each of the
> elements is evaluated? In the form
>
> [v0 for v0 in expr0 if expr1]
>
> If v0 appears in expr0 or expr1 the evaluation order matters.
>
> I think of the above as be
On Wed, Sep 23, 2015 at 3:02 PM, SANKAR . wrote:
> Thanks Ian,
> this isn't a text file, but when I read with readline I get the data I need
> along with mojibake. UTF 32 returns following error:
>
> Traceback (most recent call last):
> File "D:\RV\RV1.py", line 17, in
> linenumx1 = file.r
On Wed, Sep 23, 2015 at 6:09 PM, MRAB wrote:
> On 2015-09-24 00:51, paul.hermeneu...@gmail.com wrote:
>>
>> If this starts at the beginning of the file, then it indicates that
>> the file is UTF-16 (LE).
>>
>> UTF-8[t 1] EF BB BF 239 187 191
>> UTF-16 (BE)FE FF 254 255
>>
On Thu, Sep 24, 2015 at 8:07 AM, jmp wrote:
> result = getResult()
>
> For the later, the original weird form come from a C habit to allocate
> returned structures within the caller and provide a pointer to it so the
> function can fill the data in, otherwise the structure is lost as the stack
> i
On Thu, Sep 24, 2015 at 12:04 PM, jmp wrote:
> I'm not an expert but I think this "return by value thing" is only for C++.
> In vintage C, you can only return something that fits within a register.
If that was true at one time, it was before ANSI C.
$ cat test.c
#include
struct foo {
int a;
On Thu, Sep 24, 2015 at 2:28 PM, Joseph L. Casale
wrote:
> I have a class factory where I dynamically add a constructor to the class
> output.
> The method is a closure and works just fine, however to accommodate the varied
> input its signature is (*args, **kwargs).
>
> While I modify the doc st
On Thu, Sep 24, 2015 at 4:10 PM, Ian Kelly wrote:
> On Thu, Sep 24, 2015 at 2:28 PM, Joseph L. Casale
> wrote:
>> I have a class factory where I dynamically add a constructor to the class
>> output.
>> The method is a closure and works just fine, however to accommodate
On Thu, Sep 24, 2015 at 5:01 PM, Joseph L. Casale
wrote:
>> py> from inspect import Signature, Parameter
>> py> def foo(*args, **kwargs): pass
>> ...
>> py> foo.__signature__ = Signature([Parameter('x',
>> Parameter.POSITIONAL_OR_KEYWORD), Parameter('y',
>> Parameter.KEYWORD_ONLY)])
>> py> help(fo
On Fri, Sep 25, 2015 at 1:03 PM, Cody Cox wrote:
> def main():
> #set the variable to 0.0, makes it a float and creates a place in memory
> for the variable.
> kilo = 0.0
This is addressing a symptom, not the actual problem. Initializing
kilo here prevents Python from complaining when yo
On Tue, Sep 29, 2015 at 3:04 PM, Random832 wrote:
> How about x not in range(11)?
That's fine as long as x is known to only take integral values.
--
https://mail.python.org/mailman/listinfo/python-list
On Tue, Sep 29, 2015 at 9:14 PM, Steven D'Aprano wrote:
> On Wed, 30 Sep 2015 01:08 pm, Random832 wrote:
>
>> Steven D'Aprano writes:
>>> It's not fine. In Python 2,
>>>...
>>> Testing a numeric value within a certain range of values should be
>>> constant time and constant memory. It should be *
On Wed, Sep 30, 2015 at 2:19 PM, alister
wrote:
> On Wed, 30 Sep 2015 21:06:02 +0300, Marko Rauhamaa wrote:
>
>> Grant Edwards :
>>
>>> not (0 <= x <= 10) (I)
>>> [...]
>>>(x < 0) or (x > 10) (II)
>>> [...]
>>> IMO, (I) is _more_ readable than (II)
>>
>> IMO, they're equally re
On Thu, Oct 1, 2015 at 2:33 AM, alister
wrote:
> Why is it that the Phrase "Don't Panic" is strongly discouraged in
> emergency situations?
>
> answer because the brain parses the statement as follows and focuses on
> Panic instead of calm.
>
> Don't : I must not do somthing what must i not do
>
On Thu, Oct 1, 2015 at 2:45 PM, Paulo da Silva
wrote:
> Hi all.
>
> What is the fastest way to do the following:
>
> I have an initial value V and a vector vec of (financial) indexes.
> I want to generate a new vector nvec as
>
> V, V*vec[0], V*vec[0]*vec[1], V*vec[0]*vec[1]*vec[2], ...
>
> A nump
On Thu, Oct 1, 2015 at 3:45 PM, John Gordon wrote:
> In <87r3le1ht3@elektro.pacujo.net> Marko Rauhamaa
> writes:
>> Wouldn't
>
>>x < 0 or 10 < x
>
>> be even more visual?
>
> [SNIP]
>
> Another strike is that the code isn't consistent with itself; it puts the
> variable on the left in th
On Thu, Oct 1, 2015 at 3:58 PM, Cecil Westerhof wrote:
> I want to get the first 6 lines of ps output. For this I use:
>
> from subprocess import check_output
>
> ps_command = ('ps', '-eo', 'user,pid,pcpu,pmem,stat,start,time
On Thu, Oct 1, 2015 at 3:45 PM, John Gordon wrote:
> In <87r3le1ht3@elektro.pacujo.net> Marko Rauhamaa
> writes:
>
>> > I wasn't commenting directly to the "ask not..." quote; I was
>> > referring upthread to the choice between
>> >
>> > not 0 <= x <= 10
>> >
>> > and
>> >
>> > x < 0
On Fri, Oct 2, 2015 at 12:27 PM, Kenneth L wrote:
> I tried to use gimp but as a photoshop user it was horrible. I was trying to
> like it. That is a great idea tearing down gimp. that is how I learn html and
> css. Breakin down websites.
What about Inkscape? It's a lot friendlier than GIMP, an
On Oct 5, 2015 4:27 PM, "Ben Finney" wrote:
>
> Josef Pktd writes:
>
> > related
>
> Care to give us a summary of what that is, and describe what you think
> is the relevant point?
Following the link reveals it to be the video of a talk on Python exe
compilation from PyCon 2014.
If you're worri
On Wed, Oct 7, 2015 at 6:01 PM, Dennis Lee Bieber wrote:
> On Wed, 7 Oct 2015 13:05:07 + (UTC), alister
> declaimed the following:
>
>
>>With a simple Cesar the method is "shift the alphabet by 'X' characters
>>and X is the key
>>
>>if the key is unknown then the attacker still has to brute f
On Thu, Oct 8, 2015 at 9:46 AM, alister
wrote:
> Oh please
> the Caesar cypher was mentioned as a simplification for the purpose of
> demonstration.
> it was not intended to be even a remotely serious suggestion
>
> which I am sure at least Denis understood when he posted his tongue in
> cheek rep
On Thu, Oct 8, 2015 at 4:03 PM, Cecil Westerhof wrote:
> I want to do the following Bash command in Python:
> sqlite3 spreekwoorden.sqlite "SELECT spreekwoord FROM spreekwoorden;" |
> sort > spreekwoorden2.txt
>
> The following does this in Python:
> sqlite_pipe = Popen(
> (
>
On Sat, Oct 10, 2015 at 11:02 AM, wrote:
> (This is a long post, but the question is simple. Most of this is
> just me enumerating what I've already tried.)
>
> Someone wrote a library that creates and manipulates `Node`s.
> I would like to write another layer on top of this, to make
> trees that
On Sat, Oct 10, 2015 at 11:11 PM, Rustom Mody wrote:
> At
> https://docs.python.org/3.5/faq/extending.html#can-i-create-an-object-class-with-some-methods-implemented-in-c-and-others-in-python-e-g-through-inheritance
>
> it says
> In Python 2.2, you can inherit from built-in classes such as int, l
On Mon, Oct 12, 2015 at 2:47 AM, John Michael Lafayette
wrote:
> Now that Python has static type checking and support for IDE auto-complete
> (PEP 484?), I beg you to please use it. In your standard library, in your
> production code, in everywhere. I cannot type without auto-complete.
*Decent* P
On Mon, Oct 12, 2015 at 4:42 PM, Glenn Schultz wrote:
> Hello All,
>
> I have an application written in R for the analysis of mortgage-backed and
> asset-backed securities. I am in the process of writing it in Python. I
> need some help getting started.Here is the repository
>
> https://gi
On Oct 13, 2015 7:48 AM, "Steven D'Aprano" wrote:
>
> In Python 3, comparisons between arbitrary types raise TypeError:
>
> py> None < 2
> Traceback (most recent call last):
> File "", line 1, in
> TypeError: unorderable types: NoneType() < int()
>
>
> In Python 2, that same comparison will arb
On Tue, Oct 13, 2015 at 9:24 AM, Random832 wrote:
> Ian Kelly writes:
>> You couldn't do this with a __future__ import because those must be
>> confined to the importing module and are therefore generally limited
>> to syntax changes.
>
> In principle, it
On Wed, Oct 14, 2015 at 11:04 AM, Cai Gengyang wrote:
> So I am going through this article on Python for newbies
> ---http://askpython.com/execute-python-scripts/
That looks like a terrible resource. There are plenty of tutorials and
books out there that are actually good. I suggest starting wit
On Wed, Oct 14, 2015 at 3:11 PM, candide via Python-list
wrote:
> If set size changes during a for loop, a runtime exception is raised:
>
> [SNIP]
>
> Surprisingly, if a for loop changes the size of a list it is iterating on, no
> exception is raised :
>
> [SNIP]
>
> So why lists and sets don't r
On Thu, Oct 15, 2015 at 5:25 AM, Nagy László Zsolt wrote:
> I'm new to Python 3.5 async / await syntax. I would like to create a class -
> let's call it AsyncBus - that can be used to listen for keys, and send
> messages for keys ansynchronously.
>
> class BusTimeoutError(Exception):
> pass
>
On Thu, Oct 15, 2015 at 8:04 AM, wrote:
>
> I am using the Python Programming third edition for absolute beginners.
> I was able to create my Game over program, but I do not have the start menu
> with the icons and cannot seem to find it. I have the Shell and the script
> mode but I am not able t
On Thu, Oct 15, 2015 at 11:16 AM, Nagy László Zsolt
wrote:
> In order to schedule a callback in the future, you would have to have a
> standard event loop interface for scheduling. We do have a base class
> asyncio.BaseEventLoop, but tornado's ioloop is NOT a descendant of it.
> (It is based on to
On Thu, Oct 15, 2015 at 4:02 PM, James DeVincentis
wrote:
>
> Anyone have any ideas? I feel like this could be a bug with the garbage
collector across multiprocessing.
I'll second MRAB's response from yesterday: could it just be reusing space
that it has recently freed?
As a debugging measure, w
On Sun, Oct 18, 2015 at 2:46 AM, James DeVincentis
wrote:
>
> I see, looks like I’ll have to use Queue.close()
>
> Didn’t think it would be necessary since I was assuming it would be
garbage collected. Sigh. Bug, fixed.
I'm not really following what the issue is here -- it sounds like it runs
pre
On Mon, Oct 19, 2015 at 8:36 AM, Michael Torrie wrote:
> On 10/19/2015 08:14 AM, Chris Angelico wrote:
>> On Mon, Oct 19, 2015 at 7:31 AM, gaini2002--- via Python-list
>> wrote:
>>> Please remove the page
>>
>> That page is just spam that someone sent to the newsgroup/mailing
>> list. You can ign
On Tue, Oct 20, 2015 at 12:57 PM, Martin Schöön wrote:
> It has been a while.
> I have mastered solving Kenken and Sudoku using Python-constraint.
>
> I still have no clue on how to tell the solver how to constrain
> the number of occupants in rooms: I have made up an simple example
> with nine pe
On Tue, Oct 20, 2015 at 1:26 PM, Ian Kelly wrote:
> def room_size_constraint(*v):
> counter = Counter(v.values())
Sorry, this should just be Counter(v), since v here is a tuple, not a dict.
--
https://mail.python.org/mailman/listinfo/python-list
On Tue, Oct 20, 2015 at 11:39 AM, Michael Torrie wrote:
> On 10/20/2015 10:25 AM, Storey, Geneva wrote:
>> FYI-We formatted the machines, reinstalling everything, including
>> Python. I works with no problems now. Confusing that this would
>> happen on 3 out of 13 machines. Just letting you kno
On Wed, Oct 21, 2015 at 11:31 AM, wrote:
> So here what I have, I have a 3 IF's within the same level. If one IF is
> satisfied, I would like to "skip" the other IFs and continue with my code.
I think you're looking for the elif keyword. An elif branch will only
be considered if the previous b
On Nov 2, 2015 7:31 AM, "Gabe Clark" wrote:
>
> i am currently running python 3.5 in my programming class and when ever i
> go to open one of my saved files or a file saved by some one else this new
> tab pops up and says modify, repair, or uninstall i have uninstalled and
> repaired it multiple t
On Mon, Nov 2, 2015 at 12:24 PM, wrote:
> I have read some articles that returning None is not a good approach, so I am
> confused.
>
> How to handle exceptions properly in a pythonic way?
I'm having a hard time understanding what question you're asking. You
have a lot of discussion about where
On Tue, Nov 3, 2015 at 7:45 AM, William Ray Wing wrote:
>
>> On Oct 25, 2015, at 8:17 PM, Montana Burr wrote:
>>
>> I'm looking for a library that will allow Python to listen for the shriek of
>> a smoke alarm. Once it detects this shriek, it is to notify someone.
>> Ideally, specificity can be
On Tue, Nov 3, 2015 at 9:56 AM, Tim Chase wrote:
> On 2015-11-03 16:35, Peter Otten wrote:
>> I wish there were a way to prohibit such files. Maybe a special
>> value
>>
>> with open(..., newline="normalize") f:
>> assert all(line.endswith("\n") for line in f)
>>
>> to ensure that all lines en
On Tue, Nov 3, 2015 at 11:33 AM, Ian Kelly wrote:
> On Tue, Nov 3, 2015 at 9:56 AM, Tim Chase
> wrote:
>> Or even more valuable to me:
>>
>> with open(..., newline="strip") as f:
>> assert all(not line.endswith(("\n", "\r")) f
On Wed, Nov 4, 2015 at 5:41 AM, Christoph Zallmann wrote:
> Hey there,
>
>
>
> i tried using Python 3.5.0 in combination with pycrypto and everything i got
> was crap. Really. I tried so many things, how to solve my problem - using
> environment variables, vs 2015 and many more. With python 2.7 or
On Wed, Nov 4, 2015 at 11:18 AM, Storey, Geneva
wrote:
>
>
>
>
> I am having the same problem that we experienced earlier (see below). This
> student was exploring random numbers in Python. She named her program random
> which caused confusion for her computer. We deleted the file, but still
On Wed, Nov 4, 2015 at 2:44 PM, wrote:
> I have an continues loop with "while True:"
> Now I want to use "raw_input" and when I press "s" on the keybord that it will
> "break" the continues loop.
>
> I tried:
> choices = raw_input
This doesn't call raw_input. For that you need to write raw_input
On Nov 6, 2015 3:20 AM, "wa...@travelsky.com" wrote:
>
> Hello, python-list guys:
>
> I am a newbie of python from Beijing. China.
> I have a question about "math.pi".
> As you can see in the attachment, why i can modify "math.pi"?
> (in "mathmodule.c" "pi" is a "static const doubl
On Nov 8, 2015 12:01 PM, "BartC" wrote:
>
> But then, you say that additional attributes, potentially millions of
different ones, can be invented at runtime. Although I don't see how it can
remove names that are part of the source code: if "A.B" is in the file,
then surely "A" and "B" always have
On Mon, Nov 9, 2015 at 8:44 AM, Cecil Westerhof wrote:
> I have written some code I like to use with several databases. At the
> moment sqlite and postgres. It looks like with progres I can use:
> cursor.execute('COMMIT;')
> but that with sqlite I need to use:
> conn.commit()
>
> Is this tru
On Mon, Nov 9, 2015 at 11:15 AM, Tim Chase
wrote:
> On 2015-11-09 08:12, zljubi...@gmail.com wrote:
>> I know how to send an email, but I would like to be able to receive
>> a reply and act accordingly. Mail reply should contain yes/no
>> answer.
>
> You have a couple options that occur to me:
>
>
On Thu, Nov 12, 2015 at 8:57 AM, PythonDude wrote:
> Hi all,
>
> I've come around a webpage with python-tutorial/description for obtaining
> something and I'll solve this:
>
> R = p^T w
>
> where R is a vector and p^T is the transpose of another vector.
>
> ...
> p is a Nx1 column vector, so p^T
On Fri, Nov 13, 2015 at 8:37 AM, PythonDude wrote:
> Hi all,
>
> Just a quick question about this code-piece (it works, I've tested it):
>
> means, stds = np.column_stack([
> getMuSigma_from_PF(return_vec)
> for _ in xrange(n_portfolios) ])
>
>
> 1) I understand column_stack does this (ass
On Fri, Nov 13, 2015 at 12:20 PM, kent nyberg wrote:
> def LoadCommandAndReact(place_to_read):
> global RegisterAX
>
> tmp = place_to_read.read()[RegisterAX:calcsize('HH')]
It looks like you're trying to get a slice of length 4 here, starting
at the value of RegisterAX. What you're actual
As long as I'm replying to this, I see a few more issues to comment on:
On Fri, Nov 13, 2015 at 12:20 PM, kent nyberg wrote:
> if place_to_read.closed:
>print("Drive error. Drive closed.")
You probably also want to break or return here. Even better: raise an
exception instead of prin
On Fri, Nov 13, 2015 at 1:15 PM, kent nyberg wrote:
> Even with that, it still gets wrong.
> I also tried .read()[RegisterAX:RegisterAX+4]
When you call read for the second time, are you just reading the same
file again without closing or seeking it in the interim? If that's the
case, then you wo
On Fri, Nov 13, 2015 at 1:15 PM, kent nyberg wrote:
> What bothers me, is the error that says
> unpack requires a string argument of 4 bytes.
> Im thinking in the line of arguments? Does unpack look at the 4 bytes it has
> read, and tell for some
> reason say that unpacking needs an argument of 4
On Nov 13, 2015 8:03 PM, "Chris Angelico" wrote:
>
> On Sat, Nov 14, 2015 at 1:40 PM, Steven D'Aprano
wrote:
> > On Sat, 14 Nov 2015 09:42 am, Chris Angelico wrote:
> >
> >> However, this is a reasonable call for the abolition of unary plus...
> >
> > The only way you'll take unary plus out of Py
On Nov 13, 2015 8:03 PM, "Chris Angelico" wrote:
>
> On Sat, Nov 14, 2015 at 1:40 PM, Steven D'Aprano
wrote:
> > On Sat, 14 Nov 2015 09:42 am, Chris Angelico wrote:
> >
> >> However, this is a reasonable call for the abolition of unary plus...
> >
> > The only way you'll take unary plus out of Py
On Nov 9, 2015 7:41 PM, "Heather Piwowar" wrote:
>
> Today's scientists often turn to Python to run analysis, simulation, and
other sciency tasks.
>
> That makes us wonder: which Python libraries are most influential in
scientific research?
>
> We just released a tool (built in Python, of course)
On Fri, Nov 13, 2015 at 10:40 PM, Steven D'Aprano wrote:
> Python has operator overloading, so it can be anything you want it to be.
> E.g. you might have a DSL where +feature turns something on and -feature
> turns it off.
By that argument we should also have operators ~, !, $, \, ? because
some
On Sat, Nov 14, 2015 at 7:46 AM, fl wrote:
> A following problem now is about the args in class decorate. I do not see
> args and kwargs are transferred by get_fullname(self).
>
>
> If I change
>
> return "{0}".format(func(*args, **kwargs))
>
> to
>
> return "{0}".format(func(*args))
>
> The outpu
On Nov 14, 2015 9:56 AM, "Marko Rauhamaa" wrote:
>
> Ian Kelly :
>
> > For somebody reading one of these uses of unary plus in real code, I
> > imagine it would be a bit of a WTF moment if it's the first time
> > they've encountered it. I don'
On Nov 14, 2015 10:10 AM, "Chris Angelico" wrote:
>
> On Sun, Nov 15, 2015 at 4:04 AM, Ian Kelly wrote:
> > Unary integer division seems pretty silly since the only possible
results
> > would be 0, 1 or -1.
>
> 1, -1, or ZeroDivisionError. The zero's on the
On Nov 16, 2015 6:10 AM, "Adrien Viala" <
adrien.georges.louis.vi...@gmail.com> wrote:
>
> Hello,
>
> Thank you for your work. Just discovering python.
>
> My issue steps were :
> - 3.5 installed
> - friend codes in 2.7
> - server scripts can t run on my laptop (cant find module 0o)
> - whatever,
On Mon, Nov 16, 2015 at 11:20 AM, Michiel Overtoom wrote:
>
> Hi,
>
>> On 16 Nov 2015, at 18:14, syedmwaliul...@gmail.com wrote:
>> For some reason it doesn't save the file.
>
> Did you get an error message?
>
>> excel.activeWorkbook.SaveAs ("c:\TurnData.xlsx")
>
> When you use backslashes in stri
Playing around a bit with PEP 484, I annotated a function that returns
an asyncio.Future:
import asyncio
def get_future() -> asyncio.Future[int]:
future = asyncio.Future()
future.set_result(42)
return future
The problem with this is that in Python 3.5, asyncio.Future can't be
used as
On Wed, Nov 18, 2015 at 2:08 PM, fl wrote:
> Hi,
>
> I have tried the below function and find that it can remember the previous
> setting value to 'val'. I think the second parameter has something on this
> effect, but I don't know the name and function of '=[]' in this application.
>
> Could you
On Wed, Nov 18, 2015 at 3:38 PM, fl wrote:
> On Wednesday, November 18, 2015 at 5:12:44 PM UTC-5, Ian wrote:
>> On Wed, Nov 18, 2015 at 2:08 PM, fl wrote:
>> > Hi,
>> >
>> > I have tried the below function and find that it can remember the previous
>> > setting value to 'val'. I think the second
On Wed, Nov 18, 2015 at 4:22 PM, Chris Angelico wrote:
> On Thu, Nov 19, 2015 at 10:14 AM, BartC wrote:
>> So, looking at some source code, a default value for certain types is only
>> certain to be that value for the very first call of that function?
>
> On the contrary, it is certain always to
On Wed, Nov 18, 2015 at 5:05 PM, fl wrote:
> Hi,
>
> I cannot reason out why the code:
>
> def mpl():
> return [lambda x : i * x for i in range(4)]
>
> print [m(2) for m in mpl()]
> /
>
> has result:
>
> [6, 6, 6, 6]
>
>
> I have tried to simplify the above code to an easy und
On Wed, Nov 18, 2015 at 5:34 PM, fl wrote:
> After I try with
>
> list1 = eList(12, [2])
>
> and
>
> list1 = eList(12)
>
> it gives me new surprises. Even though I delete list1, the subsequent
> list1 = eList(12)
> will remember the number of '12' of the previous sequence. This is my new
> questio
On Thu, Nov 19, 2015 at 5:45 AM, Steven D'Aprano wrote:
> But if you want the default value to be evaluated exactly once, and once
> only, there is no real alternative to early binding. You could use a global
> variable, of course, but that is no solution -- that's a problem waiting to
> happen.
On Thu, Nov 19, 2015 at 11:26 AM, Mark Lawrence wrote:
> To summarize, it once again shows that you haven't got the faintest idea
> what you're talking about. You're now in a very exclusive club with the RUE
> and Nick the Greek, the world's leading webmaster.
Eh. Ranting Rick and Mark Janssen /
On Thu, Nov 19, 2015 at 12:19 PM, Chris Angelico wrote:
> But you're
> saying that it "simply substitute[s] the expression", which would mean
> that "func()" is exactly the same as "func(y)". A function default
> argument is therefore able to STEAL STUFF FROM THE CALLER'S SCOPE.
> Sorry for shouti
On Thu, Nov 19, 2015 at 12:45 PM, Kaufman, Stan wrote:
> Python would not run on this Windows XP computer. After four attempts at
> "change/remove" it still gives the same message:
>
> [cid:image001.png@01D122D0.93CC3270]
>
> The first trip through "change/remove" appeared to be a further step
On Thu, Nov 19, 2015 at 2:53 PM, bSneddon wrote:
> I know there are a plethora of web frameworks out there for Python and to be
> serious about website developement I should learn on like Django. Really
> thought, I just want to dabble and do some easy stuff. Does anyone have any
> suggesto
On Nov 19, 2015 5:31 PM, "Steven D'Aprano" wrote:
>
> [Aside: there is some ambiguity here. If I say "a reference to B", I
> actually mean a reference to the object referenced to by B. I don't mean a
> reference to the *name* B. Python doesn't support that feature: names are
> not values in Python
On Fri, Nov 20, 2015 at 5:28 AM, Marko Rauhamaa wrote:
> The Ackermann function really is an esoteric example, but the other
> example that has been discussed here can make practical use of the
> default-value semantics:
>
>[ lambda x: i * x for i in range(4) ]
>
> which is salvaged with a def
On Fri, Nov 20, 2015 at 5:39 AM, BartC wrote:
> * The persistent nonsense that somehow [] is mutable (what happens is that
> [] is assigned to a variable, and /that/ is mutable) (And I will probably
> get some flak now because 'assign' and 'variable' are meaningless in
> Python!)
I think the prob
On Fri, Nov 20, 2015 at 9:24 AM, Chris Angelico wrote:
> The cases where that's not true are usually ones that are more like
> C++ overloaded functions:
>
> def next(iter):
> return iter.__next__()
> def next(iter, default):
> try: return iter.__next__()
> except StopIteration: return
On Fri, Nov 20, 2015 at 9:31 AM, Marko Rauhamaa wrote:
> Ian Kelly :
>
>> On Fri, Nov 20, 2015 at 5:28 AM, Marko Rauhamaa wrote:
>>> One could argue that you should always use a sentinel object for
>>> default values. That also allows you to distinguish between
On Fri, Nov 20, 2015 at 10:57 AM, Peter Otten <__pete...@web.de> wrote:
> Dylan Riley wrote:
>
>> input("\nPress enter to see your fortune")
>
> Make sure that you run your code with Python 3, not Python 2.
Or if you must use Python 2, use raw_input() instead of input().
>> fortune = random.randr
On Fri, Nov 20, 2015 at 11:16 AM, wrote:
> Dana petak, 20. studenoga 2015. u 18:16:52 UTC+1, korisnik Denis McMahon
> napisao je:
>> On Fri, 20 Nov 2015 08:43:04 +0100, HKRSS wrote:
>>
>> > Thanks In Advance, Robert...;)
>>
>> Just keep appending child lists to parent list:
>>
>> l = []
>>
>> wh
On Sat, Nov 21, 2015 at 1:46 AM, Chris Angelico wrote:
> On Sat, Nov 21, 2015 at 7:38 PM, Todd wrote:
>> Rather than a dedicated syntax, might this be something that could be
>> handled by a built-in decorator?
>>
>> Maybe something like:
>>
>> @late_binding
>> def myfunc(x, y=[]):
>
> No, it can
On Mon, Nov 23, 2015 at 1:23 AM, Chris Angelico wrote:
> def latearg(f):
> tot_args = f.__code__.co_argcount
> min_args = tot_args - len(f.__defaults__)
> defs = f.__defaults__
> # With compiler help, we could get the original text as well as something
> # executable that works
On Mon, Nov 23, 2015 at 10:54 AM, Israel Brewster wrote:
> Concern: Since the master process is multi-threaded, it seems likely enough
> that multiple threads on the master side would make requests at the same
> time. I understand that the Queue class has locks that make this fine (one
> thread
On Mon, Nov 23, 2015 at 12:55 PM, Ian Kelly wrote:
> On Mon, Nov 23, 2015 at 10:54 AM, Israel Brewster
> wrote:
>> Concern: Since the master process is multi-threaded, it seems likely enough
>> that multiple threads on the master side would make requests at the same
>>
2601 - 2700 of 3558 matches
Mail list logo