Re: error of opening Python

2023-09-26 Thread Chris Roy-Smith via Python-list
On 26/9/23 22:27, Abdelkhelk ashref salay eabakh via Python-list wrote: Dear Python team, This is my not first time using Python, I tried to launch Python and it showed I'm no expert but "Python 3.11.3 (tags/v3.11.3:f3909b8, Apr 4 2023, 23:49:59) [MSC v.1934 64 bit (AMD64)] on win

Re: NoneType List

2022-12-31 Thread Chris Roy-Smith
On 31/12/22 16:45, Goran Ikac wrote: Happy New Year, everybody! I'm new in the Python List, new in Python world, and new in coding. A few days (weeks?) ago, I faced a problem trying to write a program for an exercise. I asked for help and nobody answered. In the meantime, I found a part of the

[issue43371] Mock.assert_has_calls works strange

2022-01-15 Thread Roy Smith
Roy Smith added the comment: I agree that this is confusing and that what we need is an assertion for the top-level mock having specific calls in a specific order, and ignores any intervening extra calls to mocked functions. In other words, a version of assert_has_calls() which looks

[issue17113] argparse.RawDescriptionHelpFormatter should not delete blank lines

2021-12-10 Thread Roy Smith
Roy Smith added the comment: It's nice to see this is still being worked on after all these years :-) I'm not actually convinced the proposed fix makes sense. It swaps out one incorrect behavior for a different incorrect behavior. If it really is more effort than it's worth to fix

[issue44534] unittest.mock.Mock.unsafe doc is garbled

2021-06-29 Thread Roy Smith
New submission from Roy Smith : At https://docs.python.org/3.9/library/unittest.mock.html#unittest.mock.Mock, it says: unsafe: By default if any attribute starts with assert or assret will raise an AttributeError. That's not an English sentence. I think what was intended was, "By de

[issue24258] BZ2File objects do not have name attribute

2021-04-27 Thread Roy Smith
Roy Smith added the comment: The https://bitbucket.org/cliff/cpython#python24258 URL 404's Looking at the attached bz2.py diff, I would change: if isinstance(filename, (str, bytes, os.PathLike)): self._fp = _builtin_open(filename, mode) +self.filename

[issue24258] BZ2File objects do not have name attribute

2021-04-26 Thread Roy Smith
Change by Roy Smith : -- nosy: +roysmith ___ Python tracker <https://bugs.python.org/issue24258> ___ ___ Python-bugs-list mailing list Unsubscribe:

[issue43873] bz2.open() docs give conflicting defaults for mode

2021-04-16 Thread Roy Smith
New submission from Roy Smith : See https://docs.python.org/3.7/library/bz2.html For bz2.open(), the section header says: bz2.open(filename, mode='r' ...) but the text says: The mode argument ... The default is 'rb'. As I understand it, 'r' and 'rb' actually do the same thing, but the docs

[issue35105] Document that CPython accepts "invalid" identifiers

2020-07-02 Thread Roy Smith
Roy Smith added the comment: Just as another edge case, type() can do the same thing: Foo = type("Foo", (object,), {"a b": 1}) f = Foo() for example, will create a class attribute named "a b". Maybe this actually calls setattr() under the covers, but

[issue16399] argparse: append action with default list adds to list instead of overriding

2019-12-25 Thread Roy Smith
Roy Smith added the comment: I just got bit by this in Python 3.5.3. I get why it does this. I also get why it's impractical to change the behavior now. But, it really isn't the obvious behavior, so it should be documented at https://docs.python.org/3.5/library/argparse.html?highlight

[issue38462] Typo (nam ing) in import system docs

2019-11-27 Thread Roy Smith
Roy Smith added the comment: Just for the archives: https://bugs.chromium.org/p/chromium/issues/detail?id=1022011 -- ___ Python tracker <https://bugs.python.org/issue38

[issue38462] Typo (nam ing) in import system docs

2019-10-13 Thread Roy Smith
Roy Smith added the comment: Yeah, that's weird. Looks like this may be a Chrome bug. I'm seeing it in Chrome (Version 77.0.3865.90 (Official Build) (64-bit)), but not Safari. This is on MacOS (High Sierra). In the attached screenshot, I narrowed the window a bit. In the second

[issue38462] Typo (nam ing) in import system docs

2019-10-13 Thread Roy Smith
New submission from Roy Smith : In https://docs.python.org/3.5/reference/import.html#importsystem, section "5.2 Packages", second sentence, the word "naming" is broken across two lines. In 3.7.5rc1 as well. Didn't check any others. -- assignee: docs@python compo

Re: Python program to phone?

2019-02-04 Thread Chris Roy-Smith
lowup" NOT "reply" Sorry I can't help you on your initial problem Regards, Chris Roy-Smith -- https://mail.python.org/mailman/listinfo/python-list

Re: What's with all of the Case Solution and Test Bank nonsense posts?

2017-07-09 Thread Chris Roy-Smith
On Sun, 09 Jul 2017 21:47:58 -0500, John Black wrote: > In article <477bde19-0653-4e41-a717-0efe90ac5...@googlegroups.com>, > timetowal...@gmail.com says... >> >> I use https://groups.google.com/forum/#!forum/comp.lang.python to look >> over message posts. >> >> What's with all of the Case

Re: textwrap.wrap() breaks non-breaking spaces

2015-05-21 Thread Roy Smith
In article mjaqqd$t0m$1...@news.albasani.net, Johannes Bauer dfnsonfsdu...@gmx.de wrote: so that textwrap.wrap() breks non-breaking spaces, is this a bug or intended behavior? I opened http://bugs.python.org/issue16623 on this a couple of years ago. Looks like it was being worked

Re: Deep comparison of dicts - cmp() versus ==?

2015-03-20 Thread Roy Smith
In article 550bbfc1$0$13010$c3e8da3$54964...@news.astraweb.com, Steven D'Aprano steve+comp.lang.pyt...@pearwood.info wrote: I cannot remember the details, and I don't have my copy of the Apple Standard Numerics manual here to look it up Amongst the details you don't remember is the correct

Re: Python 2 to 3 conversion - embrace the pain

2015-03-15 Thread Roy Smith
In article am4cga9sn16m74v1952gnfq5u443mkk...@4ax.com, Mario Figueiredo mar...@gmail.com wrote: What makes you think your anedoctal bugs constitute any sort of evidence this programming language isn't ready to be used by the public? There's several levels of ready. I'm sure the core

Re: HELP!! How to ask a girl out with a simple witty Python code??

2015-03-04 Thread Roy Smith
In article 8c09473e-92df-40ac-b083-d2b3a2b75...@googlegroups.com, Xrrific xiaok...@gmail.com wrote: Guys, please Help!!! I am trying to impress a girl who is learning python and want ask her out at the same time. Could you please come up with something witty incorporating a simple

Re: Python Worst Practices

2015-03-01 Thread Roy Smith
In article clhf9mfn89...@mid.individual.net, Gregory Ewing greg.ew...@canterbury.ac.nz wrote: But in documentation, in contexts where it's not critical, I'm more likely to use the spelling I'm most familiar with, which is colour. I can't imagine any English speaker, native or otherwise,

Re: Bug in timsort!?

2015-02-25 Thread Roy Smith
In article mailman.19183.1424872728.18130.python-l...@python.org, Sturla Molden sturla.mol...@gmail.com wrote: On 24/02/15 22:34, Roy Smith wrote: http://envisage-project.eu/proving-android-java-and-python-sorting-algorithm -is-broken-and-how-to-fix-it/ This is awful. It is broken

Bug in timsort!?

2015-02-24 Thread Roy Smith
http://envisage-project.eu/proving-android-java-and-python-sorting-algorithm-is-broken-and-how-to-fix-it/ -- https://mail.python.org/mailman/listinfo/python-list

Re: Flagging classes as not intended for direct initialization

2015-02-16 Thread Roy Smith
In article mpg.2f4beb20faeff072989...@nntp.aioe.org, Mario Figueiredo mar...@gmail.com wrote: It's not been an easy ride trying to decide whether or not to use super. I started learning python from a Mark Lutz book that advised me against it. I'm curious, what were the arguments against

Re: [OT] fortran lib which provide python like data type

2015-02-01 Thread Roy Smith
In article mailman.18388.1422845124.18130.python-l...@python.org, Chris Angelico ros...@gmail.com wrote: On Mon, Feb 2, 2015 at 1:35 PM, Matthew Barnett auxl...@mrabarnett.plus.com wrote: And the plural of virus is viruses, not viri (that's the plural of vir) or virii (that would be the

Re: [OT] fortran lib which provide python like data type

2015-02-01 Thread Roy Smith
In article 54ceda0b$0$12977$c3e8da3$54964...@news.astraweb.com, Steven D'Aprano steve+comp.lang.pyt...@pearwood.info wrote: What is the plural of octopus? It's a trick question. Octopus is already plural. Monopus is singular. -- https://mail.python.org/mailman/listinfo/python-list

Re: Python Sanity Proposal: Type Hinting Solution

2015-01-24 Thread Roy Smith
In article 54c3a0c1$0$13013$c3e8da3$54964...@news.astraweb.com, Steven D'Aprano steve+comp.lang.pyt...@pearwood.info wrote: Tim Chase wrote: On 2015-01-24 17:21, Steven D'Aprano wrote: # Cobra def sqroot(i as int) as float # Python def sqroot(i:int)-float: Cobra's use of

Re: Hello World

2015-01-18 Thread Roy Smith
In article 54bb2c5f$0$12977$c3e8da3$54964...@news.astraweb.com, Steven D'Aprano steve+comp.lang.pyt...@pearwood.info wrote: You know that two-factor authentication doesn't offer any real security against Man In The Middle attacks? The fact that TFA doesn't solve all problems doesn't change

Re: recursive function: use a global or pass a parameter?

2015-01-17 Thread Roy Smith
In article 54ba3654$0$13008$c3e8da3$54964...@news.astraweb.com, Steven D'Aprano steve+comp.lang.pyt...@pearwood.info wrote: Good reasons for using global variables are few and far between. Just about the only good reason for using global variables that I can think of is if you have one or

Re: lambdak: multi-line lambda implementation in native Python

2015-01-17 Thread Roy Smith
In article 54ba39e0$0$13008$c3e8da3$54964...@news.astraweb.com, Steven D'Aprano steve+comp.lang.pyt...@pearwood.info wrote: Every time I think I would like to learn a new language, I quite quickly run into some obvious feature that Python has but the newer language lacks, and I think bugger

Re: lambdak: multi-line lambda implementation in native Python

2015-01-17 Thread Roy Smith
In article mailman.17811.1421497179.18130.python-l...@python.org, Skip Montanaro skip.montan...@gmail.com wrote: On Sat, Jan 17, 2015 at 5:59 AM, Jussi Piitulainen jpiit...@ling.helsinki.fi wrote: How far do you want to go? Is a b + c the same as a(b) + c or the same as a(b + c)? I

Re: lambdak: multi-line lambda implementation in native Python

2015-01-17 Thread Roy Smith
In article 54ba5a25$0$12991$c3e8da3$54964...@news.astraweb.com, Steven D'Aprano steve+comp.lang.pyt...@pearwood.info wrote: Whitespace is significant in nearly all programming languages, and so it should be. Whitespace separates tokens, and lines, and is a natural way of writing (at least for

Re: Hello World

2015-01-17 Thread Roy Smith
In article 54bb1c83$0$12979$c3e8da3$54964...@news.astraweb.com, Steven D'Aprano steve+comp.lang.pyt...@pearwood.info wrote: Even that doesn't protect you, because your security is controlled by websites and banks etc. with stupid security policies. E.g. I am forced to deal with one bank that

Re: lambdak: multi-line lambda implementation in native Python

2015-01-15 Thread Roy Smith
In article 87zj9kb2j0@elektro.pacujo.net, Marko Rauhamaa ma...@pacujo.net wrote: Skip Montanaro skip.montan...@gmail.com: Beautiful is better than ugly. Yes, our job is to increase the Harmony of the Universe. Useful applications are happy side effects. Explicit is better than

Re: lambdak: multi-line lambda implementation in native Python

2015-01-15 Thread Roy Smith
yawar.a...@gmail.com wrote: I have implemented what I believe is a fairly robust, if ugly-looking, native Python module I don't know which zen this is, but Beauty is important. -- https://mail.python.org/mailman/listinfo/python-list

Re: List Comprehensions

2014-12-22 Thread Roy Smith
In article mailman.17109.1419228400.18130.python-l...@python.org, Chris Angelico ros...@gmail.com wrote: On Mon, Dec 22, 2014 at 4:42 PM, Ganesh Pal ganesh1...@gmail.com wrote: (a) I was trying to reduce the below piece of code using List comprehension ? Any suggestion please let me know

Re: Hello World

2014-12-22 Thread Roy Smith
In article 0udf9a1m3n02rt06a5ib58mvifm7sde...@4ax.com, Steve Hayes hayes...@telkomsa.net wrote: On Mon, 22 Dec 2014 09:51:02 +1100, Steven D'Aprano steve+comp.lang.pyt...@pearwood.info wrote: Tony the Tiger wrote: On Sat, 20 Dec 2014 23:57:08 +1100, Steven D'Aprano wrote: I am in

Re: Hello World

2014-12-22 Thread Roy Smith
In article 5497e1d5$0$12978$c3e8da3$54964...@news.astraweb.com, Steven D'Aprano steve+comp.lang.pyt...@pearwood.info wrote: Steve Hayes wrote: Yes, my initial reaction was that's awesome. And my second thought was that it was scary. I ran it. It worked, and printed Hello world. I

Re: Hello World

2014-12-22 Thread Roy Smith
In article 87egrrrf2i@elektro.pacujo.net, Marko Rauhamaa ma...@pacujo.net wrote: Roy Smith r...@panix.com: If I really didn't trust something, I'd go to AWS and spin up one of their free-tier micro instances and run it there :-) Speaking of trust and AWS, Amazon adminsâ

Re: Hello World

2014-12-22 Thread Roy Smith
In article mailman.17133.1419276169.18130.python-l...@python.org, Tim Chase python.l...@tim.thechases.com wrote: On 2014-12-22 19:05, MRAB wrote: On 2014-12-22 18:51, Mark Lawrence wrote: I'm having wonderful thoughts of Michael Palin's favourite Python sketch which involved fish

Re: Hello World

2014-12-21 Thread Roy Smith
In article 54974ed7$0$12986$c3e8da3$54964...@news.astraweb.com, Steven D'Aprano steve+comp.lang.pyt...@pearwood.info wrote: Obviously you don't write obfuscated code like this for production use, except in such cases where you deliberately want to write obfuscated code for production use.

Re: Hello World

2014-12-21 Thread Roy Smith
In article mailman.17098.1419207020.18130.python-l...@python.org, Chris Angelico ros...@gmail.com wrote: On Mon, Dec 22, 2014 at 10:50 AM, Roy Smith r...@panix.com wrote: Heh. I once worked on a C++ project that included its own crypo code (i.e. custom implementations of things like AES

Re: how to delete my file if exits in the remote server with paramiko?

2014-12-14 Thread Roy Smith
In article mailman.16944.1418561416.18130.python-l...@python.org, 1248283...@qq.com wrote: I want to delete the file names.txt if it exits in /home/names.txt in my remote vps server. import paramiko host = vps ip port = 22 transport = paramiko.Transport((host, port)) password = key

Re: Python console rejects an object reference, having made an object with that reference as its name in previous line

2014-12-14 Thread Chris Roy-Smith
On 15/12/14 10:21, Simon Evans wrote: Dear Jussi, and Billy I have changed the input in accordance with your advice, re: -- Python 2.7.6 (default, Nov 10 2013, 19:24:18) [MSC v.1500 32 bit (Intel)] on win here the user

Re: Python Iterables struggling using map() built-in

2014-12-11 Thread Roy Smith
In article mailman.16880.1418342293.18130.python-l...@python.org, Ian Kelly ian.g.ke...@gmail.com wrote: I never said that functions can't be used as namespaces. I said that functions are *bad* namespaces, and I gave reasons why I think this is true. An excellent example of functions acting

Re: Python Iterables struggling using map() built-in

2014-12-09 Thread Roy Smith
In article 54878f8a$0$13010$c3e8da3$54964...@news.astraweb.com, Steven D'Aprano steve+comp.lang.pyt...@pearwood.info wrote: I really think you guys are trying too hard to make this function seem more complicated than it is. If you find it so hard to understand a simple function with four

Re: Python Iterables struggling using map() built-in

2014-12-08 Thread Roy Smith
In article 5485721c$0$2817$c3e8da3$76491...@news.astraweb.com, Steven D'Aprano st...@pearwood.info wrote: On Mon, 08 Dec 2014 11:35:36 +1100, Chris Angelico wrote: On Mon, Dec 8, 2014 at 11:27 AM, Roy Smith r...@panix.com wrote: Although, to be honest, I'm wondering if this is more

Re: Python Iterables struggling using map() built-in

2014-12-07 Thread Roy Smith
Chris Angelico wrote: I'm actually glad PEP 479 will break this kind of code. Gives a good excuse for rewriting it to be more readable. Steven D'Aprano steve+comp.lang.pyt...@pearwood.info wrote: What kind of code is that? Short, simple, Pythonic and elegant? :-) Here's the code again,

Re: Python Iterables struggling using map() built-in

2014-12-07 Thread Roy Smith
In article mailman.16689.1417996247.18130.python-l...@python.org, Chris Angelico ros...@gmail.com wrote: On Mon, Dec 8, 2014 at 10:33 AM, Steven D'Aprano steve+comp.lang.pyt...@pearwood.info wrote: How would we re-write this to work in the future Python 3.7? Unless I have missed something,

Re: Python Iterables struggling using map() built-in

2014-12-07 Thread Roy Smith
In article mailman.16690.1417998873.18130.python-l...@python.org, Chris Angelico ros...@gmail.com wrote: Next problem, what the heck is res? We're not back in the punch-card days. We don't have to abbreviate variable names to save columns. Variable names are supposed to describe what

Proposed new conditional operator: or else

2014-12-02 Thread Roy Smith
In the process of refactoring some code, I serendipitously created what I think is an essential new bit of Python syntax. The “or else” statement. I ended up with: sites_string = args.sites or else self.config['sites'] which, of course, is a syntax error today, but it got me thinking

Re: Proposed new conditional operator: or else

2014-12-02 Thread Roy Smith
In article mailman.16498.1417544472.18130.python-l...@python.org, Chris Angelico ros...@gmail.com wrote: On Wed, Dec 3, 2014 at 4:41 AM, Zachary Ware zachary.ware+pyl...@gmail.com wrote: On Tue, Dec 2, 2014 at 11:18 AM, Roy Smith r...@panix.com wrote: Wouldn’t it be neat to write

Re: Read response XML attributes in django rest framework

2014-12-01 Thread Roy Smith
In article 1248a112-88fd-4346-a733-7716671b8...@googlegroups.com, reetesh nigam nigamreetes...@gmail.com wrote: I need to read xml attributes coming in response data. I am using Django rest framework. requested XML : myTagxyz verified=N product=ABC startDate=02-02-2014//myTag

Re: Comprehension with two variables - explanation needed

2014-11-23 Thread Roy Smith
In article mailman.16191.1416757555.18130.python-l...@python.org, Skip Montanaro skip.montan...@gmail.com wrote: But it breaks all the picture that I've built in my head about comps till now... Note that list comprehensions are little more than syntactic sugar for for loops. If you're

Re: Comprehension with two variables - explanation needed

2014-11-23 Thread Roy Smith
] for key in keys] for line in results] but I'm glad to report that this was merely some third-party code that I imported into our repo. Whew, that was close! On Nov 23, 2014, at 11:45 AM, Skip Montanaro wrote: On Sun, Nov 23, 2014 at 9:57 AM, Roy Smith r...@panix.com wrote

Re: python 2.7 and unicode (one more time)

2014-11-22 Thread Roy Smith
In article 87y4r348uf@elektro.pacujo.net, Marko Rauhamaa ma...@pacujo.net wrote: Steven D'Aprano steve+comp.lang.pyt...@pearwood.info: You haven't given any good reason for objecting to calling Unicode strings by what they are. Maybe you think that it is an implementation detail,

Re: pack circles into a partial annulus

2014-11-20 Thread Roy Smith
In article mailman.16011.1416478357.18130.python-l...@python.org, Robin Becker ro...@reportlab.com wrote: I need to pack circles into a partial annulus ie part of a larger circle bounded by two radii [...] Circle packing is hard so I'm thinking of using some kind of spring/repulsion model

Re: OTish: using short-term TCP connections to send to multiple slaves

2014-11-16 Thread Roy Smith
In article mailman.15887.1416150791.18130.python-l...@python.org, Chris Angelico ros...@gmail.com wrote: UDP for anything more than your network's MTU is inefficient Why do you say it's inefficient? Sure, the UDP datagram will get fragmented and re-assembled at the other end, but it's not

Re: How to fix those errors?

2014-11-16 Thread Roy Smith
In article mailman.15913.1416175276.18130.python-l...@python.org, Chris Angelico ros...@gmail.com wrote: On Mon, Nov 17, 2014 at 8:32 AM, Abdul Abdul abdul.s...@gmail.com wrote: from PIL import Image import os for inputfile in filelist outputfile =

Re: How to fix those errors?

2014-11-16 Thread Roy Smith
In article 54694389$0$13001$c3e8da3$54964...@news.astraweb.com, Steven D'Aprano steve+comp.lang.pyt...@pearwood.info wrote: Chris Angelico wrote: You should be able to use two semicolons, that's equivalent to one colon right? ChrisA (No, it isn't, so don't take this advice.

[issue22880] hmac.new docs show optional args incorrectly

2014-11-15 Thread Roy Smith
New submission from Roy Smith: At https://docs.python.org/2/library/hmac.html, hmac.new() is shown as hmac.new(key[, msg[, digestmod]]) This implies that digestmod can only be given if msg is given. This is incorrect. Either can be given without the other. -- assignee: docs@python

Re: How about some syntactic sugar for __name__ == '__main__' ?

2014-11-13 Thread Roy Smith
In article mailman.15769.1415869145.18130.python-l...@python.org, Chris Angelico ros...@gmail.com wrote: On Thu, Nov 13, 2014 at 7:47 PM, Cameron Simpson c...@zip.com.au wrote: My view is that if there's a main (i.e. the module implements a small app all on its own, however tiny), then the

Re: Communicating with a PHP script (and pretending I'm a browser)

2014-11-13 Thread Roy Smith
In article mailman.15778.1415890500.18130.python-l...@python.org, Lie Ryan lie.1...@gmail.com wrote: On 13/11/14 03:57, Larry Martell wrote: We were all making this much harder than it is. I ended up doing this: wp = urllib.request.urlopen('http://php_page/?' + request.POST.urlencode())

Re: Bad file descriptor

2014-11-13 Thread Roy Smith
In article mailman.15802.1415923204.18130.python-l...@python.org, Ben Finney ben+pyt...@benfinney.id.au wrote: satishmlm...@gmail.com writes: import os os.write(1, b'Hello descriptor world\n') OSError: Bad file descriptor It works fine for me:: import os os.write(1,

Re: Combining lists to dictionary

2014-11-11 Thread Roy Smith
In article m3tscl$f1e$2...@dont-email.me, Denis McMahon denismfmcma...@gmail.com wrote: Hi Given x,y are a lists of keys and value that I wish to combine to a dictionary, such that x[n] is the key for value y[n], which is preferred: z = {a:b for (a,b) in zip(x,y)} z = {x[n]:y[n] for n

Re: Python modules

2014-11-10 Thread Roy Smith
In article i0h06a9pj8h3olo5rnrgc64i7ckpvtv...@4ax.com, Steve Hayes hayes...@telkomsa.net wrote: I have a book on Python that advocates dividing programs into modules, and importing them when needed. Yes, this is a good idea. Breaking your program down into modules, each of which does a

Re: A syntax question

2014-11-10 Thread Roy Smith
In article mailman.15627.1415636743.18130.python-l...@python.org, Chris Angelico ros...@gmail.com wrote: On Tue, Nov 11, 2014 at 3:11 AM, Grant Edwards invalid@invalid.invalid wrote: I know, but in c.l.p, even jokes get nicely pednatic answers. And in c.l.p, odd jokes get even more

Re: I don't read docs and don't know how to use Google. What does the print function do?

2014-11-10 Thread Roy Smith
In article b509998d-c547-4638-8810-0388c0894...@googlegroups.com, sohcahto...@gmail.com wrote: Please help me this assignment is due in an hour. Don't give me hints, just give me the answer because I only want a grade. I'm not actually interested in learning how to program, but I know

Re: Different behaviour in list comps and generator expressions

2014-11-07 Thread Roy Smith
In article 545d76fe$0$12980$c3e8da3$54964...@news.astraweb.com, Steven D'Aprano steve+comp.lang.pyt...@pearwood.info wrote: The following list comprehension and generator expression are almost, but not quite, the same: [expr for x in iterable] list(expr for x in iterable) The

Re: Python Style Question

2014-10-30 Thread Roy Smith
In article 54521c8f$0$12982$c3e8da3$54964...@news.astraweb.com, Steven D'Aprano steve+comp.lang.pyt...@pearwood.info wrote: Anton wrote: Let's say I have an incoming list of values *l*. Every element of *l* can be one of the following options: 1) an integer value 2) a string in form

Re: id == vs is

2014-10-27 Thread Roy Smith
In article mailman.15221.1414379336.18130.python-l...@python.org, Cameron Simpson c...@zip.com.au wrote: The is test is more direct and less subject to iffiness because the longer expression using id() leaves more scope/time for things to change, and of course id itself can be rebound to

Re: Status of side-effecting functions in python

2014-10-27 Thread Roy Smith
In article 544e2cf2$0$13009$c3e8da3$54964...@news.astraweb.com, Steven D'Aprano steve+comp.lang.pyt...@pearwood.info wrote: Roy Smith wrote: Yes and no. If something goes wrong in a .write() method, is not Python supposed to raise an error? (!) Define wrong. It is not an error

Re: Status of side-effecting functions in python

2014-10-26 Thread Roy Smith
In article 683c84d8-d916-4b63-b4b2-92cd2763e...@googlegroups.com, wxjmfa...@gmail.com wrote: Le dimanche 26 octobre 2014 14:41:43 UTC+1, Dan Sommers a écrit : On Sun, 26 Oct 2014 00:45:49 -0700, wxjmfauth wrote: Ditto for fileobj.write(). Why should it return something ? with

Re: while loop - multiple condition

2014-10-12 Thread Roy Smith
In article mailman.14792.1413133694.18130.python-l...@python.org, Shiva shivaji...@yahoo.com wrote: Why is the second part of while condition not being checked? while ans.lower() != 'yes' or ans.lower()[0] != 'y': ans = input('Do you like python?') My intention is if either of the

Re: Practice question

2014-10-05 Thread Roy Smith
In article h2j33adothf9uctcdp5psqk2cclr019...@4ax.com, Seymore4Head Seymore4Head@Hotmail.invalid wrote: For the record, I don't want a hint. I want the answer. 42. -- https://mail.python.org/mailman/listinfo/python-list

Re: Python code in presentations

2014-09-30 Thread Roy Smith
On Tue, Sep 30, 2014 1:50 PM CEST Jean-Michel Pichavant wrote: I'm currently writing a presentation to help my co-workers ramp up on new features of our tool (written in python (2.7)). I have some difficulties presenting code in an efficient way (with some basic syntax highlights). [...]

Re: Is there a canonical way to check whether an iterable is ordered?

2014-09-18 Thread Roy Smith
In article mailman.14101.1411042251.18130.python-l...@python.org, Chris Angelico ros...@gmail.com wrote: On Thu, Sep 18, 2014 at 9:55 PM, cool-RR ram.rac...@gmail.com wrote: My function gets an iterable of an unknown type. I want to check whether it's ordered. I could check whether it's a

Re: Is there a canonical way to check whether an iterable is ordered?

2014-09-18 Thread Roy Smith
In article mailman.14103.1411047208.18130.python-l...@python.org, Chris Angelico ros...@gmail.com wrote: The one thing you can rely on (and therefore must comply with, when you design an iterable) is that iteration will hit every element exactly once. Does it actually say that somewhere?

Re: How to turn a string into a list of integers?

2014-09-07 Thread Roy Smith
In article mailman.13850.1410102277.18130.python-l...@python.org, Chris Angelico ros...@gmail.com wrote: You can't store a list in memory; what you store is a set of bits which represent some metadata and a bunch of pointers. Well, technically, what you store is something which has the

Re: Python is going to be hard

2014-09-04 Thread Roy Smith
In article mailman.13780.1409884245.18130.python-l...@python.org, Chris Angelico ros...@gmail.com wrote: On Fri, Sep 5, 2014 at 12:24 PM, Rustom Mody rustompm...@gmail.com wrote: On Thursday, September 4, 2014 7:38:40 PM UTC+5:30, Chris Angelico wrote: So a fairer comparison is: How many

Re: Editing text with an external editor in Python

2014-09-01 Thread Roy Smith
In article 54049ab7$0$29972$c3e8da3$54964...@news.astraweb.com, Steven D'Aprano steve+comp.lang.pyt...@pearwood.info wrote: import tempfile def edit(editor, content=''): f = tempfile.NamedTemporaryFile(mode='w+') [...] command = editor + + f.name status =

Re: Keeping python code and database in sync

2014-08-29 Thread Roy Smith
In article mailman.13604.1409316126.18130.python-l...@python.org, Frank Millman fr...@chagford.com wrote: The project is inherently database-driven. The python code expects to find certain tables and columns in the database. As I develop new features, I sometimes need to modify the database

Re: suckitude classifications [was Re: Keeping python code and database in sync]

2014-08-29 Thread Roy Smith
In article mailman.13623.1409351910.18130.python-l...@python.org, Chris Angelico ros...@gmail.com wrote: On Sat, Aug 30, 2014 at 5:02 AM, Ethan Furman et...@stoneleaf.us wrote: Speaking of suckitude, we could classify technologies that way: xml: major suckitude rpc: no suckitude

Re: python string, best way to concat

2014-08-28 Thread Roy Smith
In article 63bdccb4-9e34-4e40-b07d-14342e218...@googlegroups.com, peter peter.mos...@talk21.com wrote: I used to struggle with the concept of ''.join(('hello ','world')) - it seemed so convoluted compared with the intuitive 'hello '+'world', and I could never remember the syntax. Also, for

Re: GO vs Python

2014-08-25 Thread Roy Smith
In article d8811b7e-fc37-447c-848d-f3bd314af...@googlegroups.com, Rustom Mody rustompm...@gmail.com wrote: Heh! You make it sound that the character model is the most important thing in choosing a language! There are people using Fortran -- with not intention of finding an alternative.

Re: GO vs Python

2014-08-25 Thread Roy Smith
In article cb2aff1b-c091-48b5-90f5-d82c6060b...@googlegroups.com, Rustom Mody rustompm...@gmail.com wrote: On Monday, August 25, 2014 5:36:25 PM UTC+5:30, Roy Smith wrote: Rustom Mody wrote: Heh! You make it sound that the character model is the most important thing in choosing

Re: redirect stderr to syslog?

2014-08-16 Thread Roy Smith
In article 53eee06a$0$29984$c3e8da3$54964...@news.astraweb.com, Steven D'Aprano steve+comp.lang.pyt...@pearwood.info wrote: Russell E. Owen wrote: I realize the logging module supports this and has a syslog writer, so that's a fallback. But we were hoping to use the syslog module for

Re: string encoding regex problem

2014-08-15 Thread Roy Smith
In article lsm8ic$j90$1...@online.de, Philipp Kraus philipp.kr...@flashpixx.de wrote: found = re.search( a href=\/projects/boost/files/latest/download\?source=files\ title=\/boost/(.*), Utilities.URLReader(http://sourceforge.net/projects/boost/files/boost/;) ) if found == None :

Re: string encoding regex problem

2014-08-15 Thread Roy Smith
In article lsmeej$49n$1...@online.de, Philipp Kraus philipp.kr...@flashpixx.de wrote: The code works till last week correctly, I don't change the pattern. OK, so what did you change? Can you go back to last week's code and compare it to what you have now to see what changed? My question

Re: how to change the time string into number?

2014-08-14 Thread Roy Smith
In article mailman.12994.1408021090.18130.python-l...@python.org, Dennis Lee Bieber wlfr...@ix.netcom.com wrote: On Thu, 14 Aug 2014 17:47:00 +1000, Cameron Simpson c...@zip.com.au declaimed the following: Your Android phone will be running some flavour of Linux I believe. Someone who

Re: how to change the time string into number?

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

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

2014-08-12 Thread Roy Smith
In article a8f10c4f-d4a0-48ed-ae92-2a43e9a09...@googlegroups.com, Simon Evans musicalhack...@yahoo.co.uk wrote: Dear Programmers, I have been looking at the You tube 'Web Scraping Tutorials' of Chris Reeves. I have tried a few of his python programs in the Python27 command prompt, but

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

2014-08-12 Thread Roy Smith
In article 53eaab7d$0$29979$c3e8da3$54964...@news.astraweb.com, Steven D'Aprano steve+comp.lang.pyt...@pearwood.info wrote: By studying how other scraping programs work, and studying how your racing pages store data, you should be able to put the two together and see how to get the data you

Re: how to get the ordinal number in list

2014-08-12 Thread Roy Smith
In article mailman.12903.1407893523.18130.python-l...@python.org, Chris Angelico ros...@gmail.com wrote: I like to look at SQL as a language that specifies an end result without specifying how to get there Well, sure, but sometimes the how to get there is a matter of 10x, or 100x, or 1000x

Re: how to get the ordinal number in list

2014-08-11 Thread Roy Smith
In article b3c69a72-5f0c-4e2a-8ef0-91842e12c...@googlegroups.com, Rustom Mody rustompm...@gmail.com wrote: A C programmer asked to swap variables x and y, typically writes something like t = x; x = y; y = t; Fine, since C cant do better. Sure C can do better. x = x ^ y y = y ^ x x = x

Re: get the min date from a list

2014-08-10 Thread Roy Smith
In article mailman.12816.1407668534.18130.python-l...@python.org, Dave Angel da...@davea.name wrote: Your simplest answer is probably to write a function that converts a string like you have into a datetime object, say call it converter (). Then after testing it, you call min (dates, key

Re: how to get the ordinal number in list

2014-08-10 Thread Roy Smith
In article b5ac5b12-cda7-464e-9c14-63ef184a7...@googlegroups.com, Rustom Mody rustompm...@gmail.com wrote: They haven't figured out yet that the first step to solving a problem is to decide what algorithms you're going to use, and only then can you start translating that into code.

Re: how to get the ordinal number in list

2014-08-10 Thread Roy Smith
In article 154cc342-7f85-4d16-b636-a1a953913...@googlegroups.com, Rustom Mody rustompm...@gmail.com wrote: l= [6,2,9,12,1,4] sorted(l,reverse=True)[:5] [12, 9, 6, 4, 2] No need to know how sorted works nor [:5] Now you (or Steven) can call it abstract. And yet its 1. Actual

Re: how to get the ordinal number in list

2014-08-10 Thread Roy Smith
In article mailman.12827.1407702752.18130.python-l...@python.org, Mark Lawrence breamore...@yahoo.co.uk wrote: On 10/08/2014 19:26, Rustom Mody wrote: Its when we have variables that are assigned in multiple places that we start seeing mathematical abominations like x = x+1 I'm not

Re: how to get the ordinal number in list

2014-08-09 Thread Roy Smith
In article 338e8fb0-c9ec-462a-b560-1c1ff77de...@googlegroups.com, Rustom Mody rustompm...@gmail.com wrote: [To the OP] Yeah I am in the minority at least out here in considering comprehensions simpler than loops. Take your pick When comprehensions first came out, I stubbornly refused to get

[issue22167] iglob() has misleading documentation (does indeed store names internally)

2014-08-08 Thread Roy Smith
Roy Smith added the comment: How about something like this: Note: The current iglob() implementation is optimized for the case of many files distributed in a large directory tree. Internally, it iterates over the directory tree, and stores all the names from each directory at once

  1   2   3   4   5   6   7   8   9   10   >