Re: Python-based monads essay (Re: Assignment versus binding)

2016-10-10 Thread Paul Rubin
Gregory Ewing writes: > Oh, undoubtedly. I just don't think it helps understand how burritos > are used in prog... er, that is, how monads... well, you know what I > mean. How about in math? https://www.cs.cmu.edu/~edmo/silliness/burrito_monads.pdf ;-) -- https://mail.python.org/mailman/lis

Re: Python-based monads essay (Re: Assignment versus binding)

2016-10-10 Thread Paul Rubin
Paul Rubin writes: >https://www.cs.cmu.edu/~edmo/silliness/burrito_monads.pdf Whoops, url changed: http://emorehouse.web.wesleyan.edu/silliness/burrito_monads.pdf -- https://mail.python.org/mailman/listinfo/python-list

Re: Python-based monads essay (Re: Assignment versus binding)

2016-10-11 Thread Paul Rubin
Anuradha Laxminarayan writes: > seq f g x = f (\s1 -> g x s1) > because naming conventions imply that h is function. Also if this operation is what it looks like, it's usually called "bind". seq is something else entirely. -- https://mail.python.org/mailman/listinfo/python-list

Re: [FAQ] "Best" GUI toolkit for python

2016-10-17 Thread Paul Rubin
If you're just getting started and you're not trying to make something super slick, I'd suggest Tkinter. It's easy to learn and use, you can bang stuff together with it pretty fast, it's included with various Python distributions so you avoid download/installation hassles, and it's pretty portable

Python GUI application embedding a web browser - Options?

2016-10-19 Thread Paul Moore
he site I want to access uses CSS/JavaScript). Is there any good option for this, or would I be better looking elsewhere for a solution? I could probably work out how to knock something up using .NET, or a HTA file, for example, I'm just more comfortable coding in Python. Thanks, Paul -- https://mail.python.org/mailman/listinfo/python-list

Re: Python GUI application embedding a web browser - Options?

2016-10-19 Thread Paul Moore
On 19 October 2016 at 12:10, Phil Thompson wrote: > The Chrome-based QWebEngineView (http://doc.qt.io/qt-5/qwebengineview.html) > is fully supported by PyQt. Nice. Thanks for the pointer. Looks like the various bits of advice I found on the web are a little out of date, is all. Cheers

Re: Python GUI application embedding a web browser - Options?

2016-10-19 Thread Paul Moore
t I'll take a closer look - it may be that I'm not clear on what they are doing (pretty certain, I've barely any experience with what's available for Python outside of command line applications). Thanks, Paul -- https://mail.python.org/mailman/listinfo/python-list

Re: Converting the keys of a dictionary from numeric to string

2016-10-19 Thread Paul Rubin
pozz writes: > I have a dictionary where the keys are numbers: ... Python 2.7.5: >>> mydict = { 1: 1000, 2: 1500, 3: 100 } >>> keydict = { 1: "apples", 2: "nuts", 3: "tables" } >>> newdict = dict((keydict[k],v) for k,v in mydict.items()) >>> print newdict {'tables': 100, 'nut

Re: [FAQ] "Best" GUI toolkit for python

2016-10-19 Thread Paul Rubin
pozz writes: > Is there a visual GUI builder for Tkinter? Not that I know of. I haven't felt I needed one. I generally draw my intended UI on paper and then use the Tk grid layout gadget. > Could you explain better what do you mean with "industrial-looking > UI"? Something that doesn't have

Re: Converting the keys of a dictionary from numeric to string

2016-10-20 Thread Paul Rubin
Peter Otten <__pete...@web.de> writes: > assert len(keydict) == len(mydict) assert set(keydict) == set(mydict) -- https://mail.python.org/mailman/listinfo/python-list

Re: Why doesn't Python include non-blocking keyboard input function?

2016-10-25 Thread Paul Rubin
jlada...@itu.edu writes: > ... I find myself asking why Python doesn't include a standard, > non-blocking keyboard input function. I have often wanted one myself. I agree this would be useful. Forth has a standard word KEY to read a key, and I used it in a simple game that I wrote a few months a

Re: Why doesn't Python include non-blocking keyboard input function?

2016-10-26 Thread Paul Rubin
Terry Reedy writes: > Today, ethernet-connected *nix servers have no > keyboard, mouse, or even a directly connected terminal. Usually you ssh into them and connect to a pty which supports the same ioctls that a real terminal would. I use screen editors over ssh all the time, not to mention filt

Re: distributed development methodology

2016-10-29 Thread Paul Rubin
Adam Jensen writes: > So what are some of the more successful distributed. multi-platform, > development models? Use an orchestration program to keep the systems in sync: I use ansible (ansible.com) which is written in Python and fairly simple once you get used to it, but there are lots of other

Re: Need help with coding a function in Python

2016-10-31 Thread Paul Rubin
devers.meetthebadger.ja...@gmail.com writes: > http://imgur.com/a/rfGhK#iVLQKSW ... > So far this is my best shot at it (the problem with it is that the n > that i'm subtracting or adding in the if/else part does not represent > the element's position... Right, so can you figure out the element's

Re: Pre-pep discussion material: in-place equivalents to map and filter

2016-11-03 Thread Paul Rubin
arthurhavli...@gmail.com writes: > I would gladly appreciate your returns on this, regarding: > 1 - Whether a similar proposition has been made > 2 - If you find this of any interest at all > 3 - If you have a suggestion for improving the proposal Bleccch. Might be ok as a behind-the-scenes optim

Fwd: About Installation.

2016-11-06 Thread Avijit Paul
-- Forwarded message -- From: Avijit Paul Date: Mon, Nov 7, 2016 at 1:27 AM Subject: About Installation. To: python-list@python.org Hello, I installed python-3.6.0b2-amd64 on my Windows PC. Which is running on 64-bit system of Windows 8.1. The installation was successful. After

Re: N-grams

2016-11-09 Thread Paul Rubin
This can probably be cleaned up some: from itertools import islice from collections import deque def ngram(n, seq): it = iter(seq) d = deque(islice(it, n)) if len(d) != n: return for s in it: yield tuple(d) d.popleft(

Re: N-grams

2016-11-09 Thread Paul Rubin
Ian Kelly writes: > I'd use the maxlen argument to deque here. Oh that's cool, it's a Python 3 thing though. > Better to move the extra yield above the loop and reorder the loop > body so that the yielded tuple includes the element just read. Thanks, I'll give that a try. >> if len(d)

Re: Numpy slow at vector cross product?

2016-11-21 Thread Paul Rubin
Steven D'Aprano writes: > if we knew we should be doing it, and if we could be bothered to run > multiple trials and gather statistics and keep a close eye on the > deviation between measurements. But who wants to do that by hand? You might like this, for Haskell: http://www.serpentine.com/cr

Re: Question about working with html entities in python 2 to use them as filenames

2016-11-22 Thread Paul Rubin
Steven Truppe writes: > # here i would like to create a directory named after the content of > # the title... I allways get this error: > UnicodeDecodeError: 'ascii' codec can't decode byte 0xc3 in position 2 The title has a à (capital A with tilde) character in it, and there is no corresponding

Re: The Case Against Python 3

2016-11-28 Thread Paul Rubin
Gregory Ewing writes: > I agree that f-strings are not to blame here. If we really want to > avoid breaking anyone's ill-conceived attempts at sandboxing eval, > we'd better not add anything more to the language, ever, because > nobody can foresee all the possible consequences. I'm surprised eval

Re: Asyncio -- delayed calculation

2016-11-28 Thread Paul Rubin
Chris Angelico writes: > Asynchronous I/O is something to get your head around I'd much > rather work with generator-based async functions... I haven't gotten my head around Python asyncio and have been wanting to read this: http://lucumr.pocoo.org/2016/10/30/i-dont-understand-asyncio/

Python while loop

2016-11-29 Thread paul . garcia2345
Write a program which prints the sum of numbers from 1 to 101 ( 1 and 101 are included) that are divisible by 5 (Use while loop) This is the code: x=0 count=0 while x<=100: if x%5==0: count=count+x x=x+1 print(count) Question: How does python know what count means ? I

Re: Request Help With Byte/String Problem

2016-11-29 Thread Paul Rubin
Wildman writes: > names = array.array("B", '\0' * bytes) > TypeError: cannot use a str to initialize an array with typecode 'B' In Python 2, str is a byte string and you can do that. In Python 3, str is a unicode string, and if you want a byte string you have to specify that explicitly, like

Re: The Case Against Python 3

2016-12-01 Thread Paul Moore
s DANGER are NAME tokens that aren't "n". That seems pretty permissive... While I agree that f-strings are more dangerous than people will immediately realise (the mere fact that we call them f-*strings* when they definitely aren't strings is an example of that), the problem

Re: python 2.7.12 on Linux behaving differently than on Windows

2016-12-05 Thread Paul Moore
or users who are really uncomfortable with the command line) via a GUI program and a dialog box. But criticising the (entirely valid, simply different) choices of another OS vendor as "dumb" isn't acceptable, nor is it a way to get to a solution to your issue. Paul -- https://mail.python.org/mailman/listinfo/python-list

Re: python 2.7.12 on Linux behaving differently than on Windows

2016-12-05 Thread Paul Moore
but *radically* different to bash) Windows shell, try Powershell. You'll probably hate it, but not because it's limited in capabilities :-) Paul PS Apparently, powershell is now open source and available for Linux and OSX. See https://github.com/PowerShell/PowerShell - although I do

Re: python 2.7.12 on Linux behaving differently than on Windows

2016-12-05 Thread Paul Moore
chnically, it has to do some nasty internal juggling to preserve the argv, but you don't need to care about that). The program always gets a list of arguments. What *provides* that list to it (the Unix shell, the C/Python runtime, or the caller of Popen) varies. And you need (in more complex cases) to understand how the calling environment constructs that list of arguments if you want to reason about behaviour. Paul -- https://mail.python.org/mailman/listinfo/python-list

Re: python 2.7.12 on Linux behaving differently than on Windows

2016-12-06 Thread Paul Moore
*need* to quote. It's a trade-off. Unix makes shells do globbing, so programs don't have to, but as a consequence they have no means of seeing whether globbing occurred, or switching it off for particular argument positions. Windows chooses to make the trade-off a different way. Paul -- https://mail.python.org/mailman/listinfo/python-list

Re: python 2.7.12 on Linux behaving differently than on Windows

2016-12-06 Thread Paul Moore
a C/application feature). There's also an OS API to do cmdline->argv conversion, for programs that don't want to rely on the C runtime capability. The result is the same, though - in Windows, applications (or the language runtime) handle globbing, but in Unix the shell does. Paul -- https://mail.python.org/mailman/listinfo/python-list

Re: python 2.7.12 on Linux behaving differently than on Windows

2016-12-06 Thread Paul Moore
ause the rules for text in an email are different from those for text in a shell. But you seem to be arguing that the rules should be the same everywhere, so maybe in your world, yes it should be. Most other people understand the concept of context, though. Paul -- https://mail.python.org/mailman/listinfo/python-list

Re: python 2.7.12 on Linux behaving differently than on Windows

2016-12-07 Thread Paul Moore
On Tuesday, 6 December 2016 16:34:10 UTC, Michael Torrie wrote: > On 12/06/2016 06:52 AM, BartC wrote: > > Then you don't get utterly ridiculous and dangerous behaviour such as > > the cp example Paul Moore came up with (that trumps most of mine actually): > > It'

Re: python 2.7.12 on Linux behaving differently than on Windows

2016-12-07 Thread Paul Moore
nt isn't as true as you'd expect). But claiming that special syntax is an issue because people who are unfamiliar with it, are unfamiliar with it, is silly at best, and deliberate trolling at worst. Paul -- https://mail.python.org/mailman/listinfo/python-list

Re: python 2.7.12 on Linux behaving differently than on Windows

2016-12-07 Thread Paul Moore
s here, so no possibility of "automatic expansion", so this is bound to be completely safe[1]. Can you not see that danger is unrelated to the existence of globbing? Danger is a result of people not knowing what the commands they type do. Paul [1] To anyone following along who isn

Re: calling a program from Python batch file

2016-12-08 Thread Paul Moore
e standard in pipe is sufficient. Agreed. Paul -- https://mail.python.org/mailman/listinfo/python-list

Re: Is there a replement for bsddb in python3?

2016-12-09 Thread Paul Rubin
clvanwall writes: > I found that bsddb module was removed from Python3. Is there a > replacement for it? Try "dbm" which has a few options for the underlying engine. Alternatively, try sqlite3. -- https://mail.python.org/mailman/listinfo/python-list

Re: pySerial raw data

2016-12-11 Thread Paul Rubin
Wanderer writes: > I also have a 433Mhz USB serial port jig from a TI development > tool The TI USB port registers as a COM port that I can access > with pySerial. If the TI jig has 433 mhz (LORA?) at one end and serial at the other, you have to find the port parameters in the docs for the TI

Re: OT - "Soft" ESC key on the new MacBook Pro

2016-12-13 Thread Paul Rubin
Skip Montanaro writes: > Does the lack of a physical ESC key create problems for people, especially > Emacs users? Not a Mac user and I rarely use ESC instead of ALT while editing with Emacs on a local computer, but when editing remotely I do have to use ESC because the Gnome terminal emulator st

Parsing a potentially corrupted file

2016-12-14 Thread Paul Moore
n a case where this gets truncated) and then treating each entry as a record and parsing it individually. But the resulting code isn't exactly maintainable, and I'm looking for something cleaner. Does anyone have any suggestions for a good way to parse this data? Thanks, Paul -- https://mail.python.org/mailman/listinfo/python-list

Re: Parsing a potentially corrupted file

2016-12-14 Thread Paul Moore
ee text). I'm OK with ignoring the possibility that the free text contains something that looks like a timestamp. The only problem with this approach is that I have more data than I'd really like to read into memory all at once, so I'd need to do some sort of streamed match/spli

Re: Parsing a potentially corrupted file

2016-12-14 Thread Paul Rubin
Paul Moore writes: > I'm looking for a reasonably "clean" way to parse a log file that > potentially has incomplete records in it. Basically trial and error. Code something reasonable, run your program til it crashes on a record that it doesn't know what to do with,

Re: python list index - an easy question

2016-12-18 Thread Paul Götze
Hi John, there is a nice short article by E. W. Dijkstra about why it makes sense to start numbering at zero (and exclude the upper given bound) while slicing a list. Might give a bit of additional understanding. http://www.cs.utexas.edu/users/EWD/ewd08xx/EWD831.PDF - paul http

Re: Pyvenv puts both Python 2 and Python 3 in the same environment. Shocked!

2016-12-20 Thread Paul Rudin
Malik Rumi writes: > I just created a new venv using pyvenv from a 2.7 install. Now I am shocked to > see that I can get both 2.7 and 3.4 in this same venv: > > (memory) malikarumi@Tetuoan2:~/Projects/cannon/New2.7Projects/memory$ python > Python 2.7.12 (default, Nov 19 2016, 06:48:10) > [GCC 5.

Re: Another security question

2016-12-23 Thread Paul Rubin
> "Salted hashing (or just hashing) with BLAKE2 or any other > general-purpose cryptographic hash function, such as SHA-256, is not > suitable for hashing passwords. See BLAKE2 FAQ for more information." > > I propose to ignore this warning. I feel that, for my purposes, the > above procedure is ad

Re: Another security question

2016-12-23 Thread Paul Rubin
Chris Angelico writes: > Solution: Don't use dictionary-attackable passwords. If you allow people to choose their own passwords, they'll too-often pick dictionary-attackable ones; or even if they choose difficult ones, they'll use them in more than one place, and eventually the weakest of those

Re: Another security question

2016-12-24 Thread Paul Rubin
Steve D'Aprano writes: > You say that as if two-factor auth was a panacea. Of course it's not a panacea, but it helps quite a lot. > That's the sort of thinking that leads to: ... Beyond that, web browsers are the new Microsoft Windows with all of its security holes and bloat and upgrade treadm

Re: Another security question

2016-12-24 Thread Paul Rubin
Chris Angelico writes: > Correct. However, weak passwords are ultimately the user's > responsibility, where the hashing is the server's responsibility. No, really, the users are part of the system and therefore the system designer must take the expected behavior of actual users into account. The

Re: Another security question

2016-12-24 Thread Paul Rubin
Chris Angelico writes: > as a sysadmin, I have lots of control over the hashing, and very > little on passwords. I could enforce a minimum password length, but I > can't prevent password reuse, and I can't do much about the other > forms of weak passwords. Right, 2FA helps with re-use, and diffic

Re: I need a lot of help...

2016-12-24 Thread Paul Rubin
Peter Pearson writes: > I don't know any definition of "matrix range" that fits this description. > Is it possible that someone means "rank"? Yes, the rank is the dimension of the range unless I'm mistaken. I think rank is what was meant. To find the rank with Gaussian elimination, I guess you

Re: Simulating int arithmetic with wrap-around

2017-01-03 Thread Paul Rubin
Steve D'Aprano writes: > Again, assume both operands are in range for an N-bit signed integer. What's > a good way to efficiently, or at least not too inefficiently, do the > calculations in Python? My first thought is towards the struct module, especially if you want to handle a bunch of such in

Re: Cleaning up conditionals

2017-01-03 Thread Paul Rubin
"Deborah Swanson" writes: > I'm still wondering if these 4 lines can be collapsed to one or two > lines. In the trade that's what we call a "code smell", a sign that code (even if it works) should probably be re-thought after taking a step back to understand what it is really trying to do. What

Re: Choosing a Python IDE. what is your Pythonish recommendation? I do not know what to choose.

2017-01-04 Thread Paul Rudin
Tim Johnson writes: > * Antonio Caminero Garcia [170102 20:56]: >> Guys really thank you for your answers. Basically now I am more >> emphasizing in learning in depth a tool and get stick to it so I >> can get a fast workflow. Eventually I will learn Vim and its >> python developing setup, I kno

Re: Clickable hyperlinks

2017-01-04 Thread Paul Rudin
"Deborah Swanson" writes: > > I didn't try printing them before, but I just did. Got: > print([Example](http://www.example.com) > > SyntaxError: invalid syntax (arrow pointing at the colon) > With respect, if you typed that at python then it's probably a good idea to take a step b

Re: Cleaning up conditionals

2017-01-05 Thread Paul Rubin
"Deborah Swanson" writes: > I'm still wondering if these 4 lines can be collapsed to one or two > lines. In the trade that's what we call a "code smell", a sign that code (even if it works) should probably be re-thought after taking a step back to understand what it is really trying to do. Wha

Re: Simulating int arithmetic with wrap-around

2017-01-05 Thread Paul Rubin
Steve D'Aprano writes: > Again, assume both operands are in range for an N-bit signed integer. What's > a good way to efficiently, or at least not too inefficiently, do the > calculations in Python? My first thought is towards the struct module, especially if you want to handle a bunch of such i

Re: Choosing a Python IDE. what is your Pythonish recommendation? I do

2017-01-06 Thread Paul Rudin
Tim Johnson writes: > * Antonio Caminero Garcia [170102 20:56]: >> Guys really thank you for your answers. Basically now I am more >> emphasizing in learning in depth a tool and get stick to it so I >> can get a fast workflow. Eventually I will learn Vim and its >> python developing setup, I kno

Re: Clickable hyperlinks

2017-01-06 Thread Paul Rudin
"Deborah Swanson" writes: > > I didn't try printing them before, but I just did. Got: > print([Example](http://www.example.com) > > SyntaxError: invalid syntax (arrow pointing at the colon) > With respect, if you typed that at python then it's probably a good idea to take a step back and

Re: Choosing a Python IDE. what is your Pythonish recommendation? I do

2017-01-06 Thread Paul Rudin
Tim Johnson writes: > * Antonio Caminero Garcia [170102 20:56]: >> Guys really thank you for your answers. Basically now I am more >> emphasizing in learning in depth a tool and get stick to it so I >> can get a fast workflow. Eventually I will learn Vim and its >> python developing setup, I kno

Re: Search a sequence for its minimum and stop as soon as the lowest possible value is found

2017-01-06 Thread Paul Rubin
Peter Otten <__pete...@web.de> writes: > How would you implement stopmin()? Use itertools.takewhile -- https://mail.python.org/mailman/listinfo/python-list

Re: Search a sequence for its minimum and stop as soon as the lowest possible value is found

2017-01-07 Thread Paul Rubin
Jussi Piitulainen writes: >> Use itertools.takewhile > How? It consumes the crucial stop element: Oh yucch, you're right, it takes it from both sides. How about this: from itertools import takewhile, islice def minabs(xs): a = iter(xs) m = min(map(abs,takewhile(lambda x:

Re: Search a sequence for its minimum and stop as soon as the lowest possible value is found

2017-01-08 Thread Paul Rubin
Jussi Piitulainen writes: > That would return 0 even when there is no 0 in xs at all. Doesn't look that way to me: >>> minabs([5,3,1,2,4]) 1 -- https://mail.python.org/mailman/listinfo/python-list

Re: Search a sequence for its minimum and stop as soon as the lowest possible value is found

2017-01-08 Thread Paul Rubin
Paul Rubin writes: > seems to work, but is ugly. Maybe there's something better. def minabs2(xs): def z(): for x in xs: yield abs(x), x if x==0: break return min(z())[1] is the same thing but a little bit nicer. -

Re: Search a sequence for its minimum and stop as soon as the lowest possible value is found

2017-01-08 Thread Paul Rubin
Paul Rubin writes: > Doesn't look that way to me: > >>> minabs([5,3,1,2,4]) > 1 There's a different problem though: >>> minabs([1,2,3,0]) 1 I think Python's version of iterators is actually buggy and at least the first element of th

Re: Using namedtuples field names for column indices in a list of lists

2017-01-08 Thread Paul Rudin
"Deborah Swanson" writes: > Peter Otten wrote, on January 08, 2017 3:01 AM >> >> columnA = [record.A for record in records] > > This is very neat. Something like a list comprehension for named tuples? Not something like - this *is* a list comprehension - it creates a list of named tuples. The

Re: Search a sequence for its minimum and stop as soon as the lowest possible value is found

2017-01-08 Thread Paul Rubin
Peter Otten <__pete...@web.de> writes: > return min(take_until(), key=firstitem)[1] Actually, key=abs should work. I realized that after posting. -- https://mail.python.org/mailman/listinfo/python-list

Re: Search a sequence for its minimum and stop as soon as the lowest possible value is found

2017-01-08 Thread Paul Rubin
Jussi Piitulainen writes: > It could still be added as an option, to both takewhile and iter(_, _). That's too messy, it really should be pervasive in iterators. -- https://mail.python.org/mailman/listinfo/python-list

Re: Temporary variables in list comprehensions

2017-01-09 Thread Paul Rubin
Steven D'Aprano writes: > [(expensive_calculation(x), expensive_calculation(x) + 1) for x in data] def memoize(f): cache = {} def m(x): if x in cache: return cache[x] a = f(x) cache[x] = a r

Re: Temporary variables in list comprehensions

2017-01-09 Thread Paul Rubin
Serhiy Storchaka writes: > gen = (expensive_calculation(x) for x in data) > result = [(tmp, tmp + 1) for tmp in gen] result = [(tmp, tmp+1) for tmp in map(expensive_calculation, data)] -- https://mail.python.org/mailman/listinfo/python-list

Re: Temporary variables in list comprehensions

2017-01-09 Thread Paul Rubin
Tim Chase writes: >> result = [(tmp, tmp+1) for tmp in map(expensive_calculation, data)] > > As charmingly expressive as map() is, the wildly different behavior in > py3 (it's a generator that evaluates lazily) vs py2 (it consumes the > entire iterable in one go) leads me to avoid it in general,

Re: Temporary variables in list comprehensions

2017-01-09 Thread Paul Rubin
Ben Bacarisse writes: > [(lambda tmp: (tmp, tmp+1))(expensive_calculation(x)) for x in data] Nice. The Haskell "let" expression is implemented as syntax sugar for that, I believe. -- https://mail.python.org/mailman/listinfo/python-list

Re: Enum with only a single member

2017-01-10 Thread Paul Rubin
Steven D'Aprano writes: > Is it silly to create an enumeration with only a single member? No. > That is, a singleton enum? Why stop there? You can make empty ones too. (Zerotons?) > The reason I ask is that I have two functions that take an enum > argument. Sounds like a good reason. >

Re: Temporary variables in list comprehensions

2017-01-10 Thread Paul Moore
ly my preferences would be the explicit loop, then the intermediate_tuple function, in that order. Paul -- https://mail.python.org/mailman/listinfo/python-list

Re: The hardest problem in computer science...

2017-01-10 Thread Paul Moore
ith the stdlib enum? But rather that it's specific to your aenum module? I don't see any documentation for the "init" parameter in either version, so I'm a little puzzled. The capability seems neat, although (as is probably obvious) the way you declare it seems a little confusing to me. Paul -- https://mail.python.org/mailman/listinfo/python-list

Re: The hardest problem in computer science...

2017-01-10 Thread Paul Moore
On Tuesday, 10 January 2017 15:47:20 UTC, Paul Moore wrote: > On Saturday, 7 January 2017 19:14:43 UTC, Ethan Furman wrote: > > Ya know, that looks an /awful/ lot like a collection! Maybe even an Enum? > > ;) > > > > -- 8< --

Re: A detailed description on virtualenv's packaging dependecies? (pip, easy_install, wheel, setuptools, distlib, etc.)

2017-01-16 Thread Paul Moore
pt the limitation, and it's possible to somehow determine from the OS what it allows, then getting virtualenv to warn if you use a "too long" pathname might be an alternative solution. Paul -- https://mail.python.org/mailman/listinfo/python-list

Re: Running Virtualenv with a custom distlib?

2017-01-16 Thread Paul Moore
urces to ensure I remembered that right. Also your pip wheel would need to be a higher version than the embedded one, or it would get ignored). Paul -- https://mail.python.org/mailman/listinfo/python-list

Re: PEP 393 vs UTF-8 Everywhere

2017-01-20 Thread Paul Rubin
Chris Angelico writes: > decoding JSON... the scanner, which steps through the string and > does the actual parsing. ... > The only way for it to be fast enough would be to have some sort of > retainable string iterator, which means exposing an opaque "position > marker" that serves no purpose oth

Re: PEP 393 vs UTF-8 Everywhere

2017-01-21 Thread Paul Rubin
Chris Angelico writes: > You can't do a look-ahead with a vanilla string iterator. That's > necessary for a lot of parsers. For JSON? For other parsers you usually have a tokenizer that reads characters with maybe 1 char of lookahead. > Yes, which gives a two-level indexing (first find the stra

Re: Python

2017-01-25 Thread Paul Rudin
Joaquin Alzola writes: > This email is confidential and may be subject to privilege. If you are not the > intended recipient, please do not copy or disclose its content but contact the > sender immediately upon receipt. Probably best not to send it to a publicly accessible mailing list then :/ -

Re: Is shutil.get_terminal_size useless?

2017-01-30 Thread Paul Moore
the behaviour or not), so I don't think there's much benefit to proposing changes to the docs alone. Paul -- https://mail.python.org/mailman/listinfo/python-list

command line micro wiki written in Python

2017-01-31 Thread Paul Wolf
I've created a command line utility for managing text files. It's written in Python: https://github.com/paul-wolf/yewdoc-client It makes heavy use of the fantastic Click module by Armin Ronacher: http://click.pocoo.org/5/ This can be thought of in different ways: * A micro-wiki

Re: command line micro wiki written in Python

2017-02-02 Thread paul . wolf
On Tuesday, 31 January 2017 23:39:41 UTC, Ben Finney wrote: > The Python community has a stronger (?) preference for reStructuredText > format. Can that be the default? > > That is, I want my text files to be named ‘foo’ (no suffix) or ‘foo.txt’ > (because they're primarily text), and have the d

Re: I found strange thing while studying through idle

2018-03-09 Thread Paul Moore
fairly common for backing up and rewriting a progress line in simple console programs: for i in range(100): print(f"\r \rCompleted: {i}%", end='') sleep(0.5) Paul -- https://mail.python.org/mailman/listinfo/python-list

Re: Enumerating all 3-tuples

2018-03-10 Thread Paul Moore
> def triples(): > for total in itertools.count(1): > for i in range(1, total): > for j in range(1, total - i): > yield i, j, total - (i + j) Mathematically, that's the usual generalisation of Cantor's diagonal argument. Paul -- https://mail.python.org/mailman/listinfo/python-list

Re: __import__ fails randomly due to missing file

2018-03-12 Thread Paul Moore
tat information, so it's possible that if you're creating the file and then relatively quickly doing the import, there may be some cache effect going on (granularity of file modification timestamps?) I don't know the details, but it might be worth looking in that area... Paul -- https://mail.python.org/mailman/listinfo/python-list

Re: Enumerating all 3-tuples

2018-03-13 Thread Paul Moore
On 13 March 2018 at 11:01, Steven D'Aprano wrote: > On Sat, 10 Mar 2018 11:15:49 +0000, Paul Moore wrote: > >> On 10 March 2018 at 02:18, MRAB wrote: > [...] >>> This might help, although the order they come out might not be what you >>> want: >&

Re: Restore via pip to new OS

2018-03-14 Thread Paul Moore
Use pip freeze rather than pip list. That will give you the information in "requirements file" format that pip install -r can read. Paul On 14 March 2018 at 23:20, Tim Johnson wrote: > I'm currently running both python and python3 on ubuntu 14.04. > Plan is to do a complete

Re: Writing a C extension - borrowed references

2018-03-20 Thread Paul Moore
only worthwhile if you're in an extremely tight loop. So while it's OK to use a borrowed reference, the reality is that if you don't fully understand why you want to, and all the trade-offs, it's probably not worth the risk. Or, to put it another way, "if you need to ask, you can't afford to". Paul -- https://mail.python.org/mailman/listinfo/python-list

Re: Reg python regexp

2018-03-21 Thread Paul Moore
Hi, You don't need a regexp for this, the "replace" method on a string will do what you want: >>> s = 'this is a [string' >>> print(s.replace('[', '\\[')) this is a \[string Paul On 21 March 2018 at 10:44, wrote: > Hi, > &g

Re: Putting Unicode characters in JSON

2018-03-23 Thread Paul Moore
lues are conceptually text and which are conceptually bytes. In my view one of the easiest ways of doing this is to try writing the code you want in Python 3, and watch how it breaks (as you've demonstrated above, it will!) Then, if you need your code to work in Python 2, apply the knowledge yo

Re: Using object as a class

2018-03-26 Thread Paul Moore
bj' object has no attribute 'x' See https://docs.python.org/3.6/reference/datamodel.html#slots IIRC, most built in objects (of which object is one) behave as if they have __slots__ set (they don't actually, because they are written in C, but the effect is the same). Paul On 26 March 2018 at

Re: please test the new PyPI (now in beta)

2018-03-27 Thread Paul Moore
/warehouse/issues if you think it's worth changing. (Same is true of your comment about the site design, although I suspect it's a bit late for that to be changed in the immediate future - the site design has been basically unchanged since very early in the redesign. Personally, I agree it&#

Re: please test the new PyPI (now in beta)

2018-03-27 Thread Paul Moore
On 27 March 2018 at 10:48, Paul Moore wrote: > Same is true of your comment about the site design, > although I suspect it's a bit late for that to be changed in the > immediate future - the site design has been basically unchanged since > very early in the redesign. Personall

Re: Pep8 for long pattern

2018-03-27 Thread Paul Moore
Use re.X - see https://docs.python.org/3.6/library/re.html#re.X for details. On 27 March 2018 at 15:17, Ganesh Pal wrote: > Hello Python friends, > > How do I split the below regex , so that it fits within the character > limit of 79 words > > > pattern = [ > r'(?P([0-9a-fA-F]+:[0-9a-fA-F]+:[0-

Re: Calling Matlab (2016a) function from Python(3.6)

2018-03-28 Thread Paul Moore
statement on python: >>>h.Execute ("run('H:\rishika\MATLAB\filewrite.m')") uses unescaped backslashes, so \r is getting seen as Carriage Return in the string being sent to Matlab. The \f will also be seen as a form feed. I imagine that would confuse Matlab. You should either double the backslashes >>>h.Execute ("run('H:\\rishika\\MATLAB\\filewrite.m')") or use raw strings >>>h.Execute ("run(r'H:\rishika\MATLAB\filewrite.m')") Paul -- https://mail.python.org/mailman/listinfo/python-list

Re: Distributing Python virtual environments

2018-03-29 Thread Paul Moore
s file (if you don't already have one), then "pip wheel -r " to get a complete set of wheels for your virtualenv. Then ship those wheels to the target machine (caveats about exactly the same architecture still apply, as the wheels you build may be architecture-specific), and build a n

Re: please test the new PyPI (now in beta)

2018-03-30 Thread Paul Moore
page cluttered with category filters, if I need then I'll go to the dedicated browse page. Just my 2p worth... Paul -- https://mail.python.org/mailman/listinfo/python-list

Re: Python Developer Survey: Python 3 usage overtakes Python 2 usage

2018-03-30 Thread Paul Moore
On 30 March 2018 at 16:45, Terry Reedy wrote: > https://www.jetbrains.com/research/python-developers-survey-2017/ > “Which version of Python do you use the most?” > 2014 80% 2.x, 20% 3.x > 2016 60% 2.x, 40% 3.x > 2017 25% 2.x, 75% 3.x > > This is a bigger jump than I anticipated. Nice! -- https:

Beta release of pip version 10

2018-03-31 Thread Paul Moore
ly grateful to everyone in the community for their contributions. Thanks, Paul -- https://mail.python.org/mailman/listinfo/python-list

Re: Beta release of pip version 10

2018-04-01 Thread Paul Moore
ot;) > > and run: > py a.py > a.txt > > I get some gibberish in the file. > So it is probably a global issue. Nothing works in this life :) That actually sounds more like a redirection issue. Redirecting in the cmd shell uses the OEM codepage, I believe, and Python outputs to a pipe using the ANSI codepage, IIRC (I'd have to check to be certain). Paul -- https://mail.python.org/mailman/listinfo/python-list

<    3   4   5   6   7   8   9   10   11   12   >