Re: Make a unique filesystem path, without creating the file

2016-02-25 Thread Random832
On Tue, Feb 23, 2016, at 03:22, Paul Rubin wrote: > Thanks. It would be nice if those were gatewayed to usenet like this > group is. I can't bring myself to subscribe to mailing lists. Have you tried gmane? -- https://mail.python.org/mailman/listinfo/python-list

Re: Dynamic object attribute creation

2016-02-29 Thread Random832
On Mon, Feb 29, 2016, at 10:36, ast wrote: > but why doesn't it work with built-in classes int, float, list ? > > L = [1, 8, 0] > L.test = 'its a list !' > > (however lists are mutable, int, float ... are not) Because those classes do not have attribute dictionaries, in order to save space.

Re: yield in try/finally case

2016-03-03 Thread Random832
On Thu, Mar 3, 2016, at 06:52, 刘琦帆 wrote: > I have just saw PEP 255, and it says that > > "A yield statement is not allowed in the try clause of a try/finally > construct. The difficulty is that there's no guarantee the generator > will ever be resumed, hence no guarantee that the finally block

Re: yield in try/finally case

2016-03-03 Thread Random832
On Thu, Mar 3, 2016, at 08:47, Peter Otten wrote: > This is because the last generator uf = upperfile(...) is not garbage- > collected and wasn't explicitly closed either. But the program hasn't ended yet when you run your assertion. import sys _open = open files = [] def myclose(self): pri

Re: A mistake which almost went me mad

2016-03-07 Thread Random832
On Mon, Mar 7, 2016, at 11:19, Ian Kelly wrote: > Relative imports only work inside packages. You can't use a relative > import to import one top-level module from another. > > Besides, the relative import doesn't help to disambiguate in this > case. The absolute path of the stdlib email module is

Re: Question

2016-03-07 Thread Random832
On Mon, Mar 7, 2016, at 13:09, Jon Ribbens wrote: > It only appears to have downloads for 32-bit, or 64-bit AMD processors, > not 64-bit Intel processors. Current 64-bit processors produced by Intel use the "AMD64" architecture, not the Intel IA-64 (Itanium) architecture. -- https://mail.python.o

Re: How to waste computer memory?

2016-03-18 Thread Random832
On Fri, Mar 18, 2016, at 20:55, Chris Angelico wrote: > On Sat, Mar 19, 2016 at 9:03 AM, Marko Rauhamaa wrote: > > Also, special-casing '\0' and '/' is > > lame. Why can't I have "Results 1/2016" as a filename? > > Would you be allowed to have a directory named "Results 1" as well? If I were des

Re: How to waste computer memory?

2016-03-18 Thread Random832
On Fri, Mar 18, 2016, at 03:00, Ian Kelly wrote: > jmf has been asked this before, and as I recall he seems to feel that > UTF-8 should be used for all purposes, ignoring the limitations of > that encoding such as that indexing becomes a O(n) operation. Just to play devil's advocate, here, why is

Re: empty clause of for loops

2016-03-18 Thread Random832
On Wed, Mar 16, 2016, at 11:17, Sven R. Kunze wrote: > I can imagine that. Could you describe the general use-case? From what I > know, "else" is executed when you don't "break" the loop. When is this > useful? for item in collection: if good(item): thing = item break else: th

Re: Bash-like pipes in Python

2016-03-19 Thread Random832
On Thu, Mar 17, 2016, at 10:36, Chris Angelico wrote: > This object has a generator/list duality, but if you observe it, it > collapses to a list. When used interactively, it'd be pretty much the > same as calling list() as the last step, but in a script, they'd > operate lazily. > > Quantum com

Re: Bash-like pipes in Python

2016-03-19 Thread Random832
On Wed, Mar 16, 2016, at 11:09, Joel Goldstick wrote: > > This is interesting, but the part I'm missing is the use of the Pipe > symbol '|' in python. Can you elaborate His "Filter", "Map", and "Reduce" are classes which define __ror__ methods, obviously. -- https://mail.python.org/mailman/listi

Re: How to waste computer memory?

2016-03-19 Thread Random832
On Fri, Mar 18, 2016, at 10:59, Michael Torrie wrote: > This seems to me to be a leaky abstraction. Julia's approach is > interesting, but it strikes me as somewhat broken as it pretends to do > O(1) indexing, but in reality it's still O(n) because you still have to > iterate through the bytes unt

Re: How to waste computer memory?

2016-03-19 Thread Random832
On Fri, Mar 18, 2016, at 12:44, Steven D'Aprano wrote: > And I don't understand this meme that indexing strings is not important. > Have people never (say) taken a slice of a string, or a look-ahead, or > something similar? > > i = mystring.find(":") find is already O(N). > next_char = mystring[

Re: Bash-like pipes in Python

2016-03-19 Thread Random832
On Wed, Mar 16, 2016, at 10:57, Steven D'Aprano wrote: > For instance, we can take a string, extract all the digits, convert them > to > ints, and finally multiply the digits to give a final result: > > py> from operator import mul > py> "abcd12345xyz" | Filter(str.isdigit) | Map(int) | Reduce(m

Usenet Message-ID (was Re: How to waste computer memory?)

2016-03-19 Thread Random832
On Fri, Mar 18, 2016, at 15:46, Tim Golden wrote: > Speaking for a moment as the list owner. Posts by this OP are usually > blatant provocation and I usually filter them out before they hit the > list. (They'll still appear if you're reading via Usenet). In this case > I approved a post thinking

Re: empty clause of for loops

2016-03-19 Thread Random832
On Wed, Mar 16, 2016, at 13:01, Sven R. Kunze wrote: > On 16.03.2016 17:56, Sven R. Kunze wrote: > > On 16.03.2016 17:37, Random832 wrote: > >> for item in collection: > >> if good(item): > >>thing = item > >>break > >>

Re: How to waste computer memory?

2016-03-19 Thread Random832
On Fri, Mar 18, 2016, at 11:17, Ian Kelly wrote: > > Just to play devil's advocate, here, why is it so bad for indexing to be > > O(n)? Some simple caching is all that's needed to prevent it from making > > iteration O(n^2), if that's what you're worried about. > > What kind of caching do you ha

Re: Bash-like pipes in Python

2016-03-20 Thread Random832
On Wed, Mar 16, 2016, at 11:20, Random832 wrote: > How about: > > from functools import partial, reduce > from operator import mul > def rcall(arg, func): return func(arg) > def fpipe(*args): return reduce(rcall, args) It occurs to me that this suggests a further refinement:

Re: How to waste computer memory?

2016-03-20 Thread Random832
On Sun, Mar 20, 2016, at 10:55, Ben Bacarisse wrote: > It's 21. The reason being (or at least part of the reason being) that > 21 bits can be UTF-8 encoded in 4 bytes: 0xxx 10xx 10xx > 10xx (3 + 3*6). The reason is the UTF-16 limit. Prior to that, UTF-8 had no such limit (it could

Re: The Cost of Dynamism (was Re: Pyhon 2.x or 3.x, which is faster?)

2016-03-21 Thread Random832
On Mon, Mar 21, 2016, at 09:48, Steven D'Aprano wrote: > Pardon me, do I understand you correctly? You're saying that the C parser > is > Unicode-aware and allows you to use Unicode in C source code? Er, "the" C parser? In the C standard, the source character set is implementation-defined, and is

Re: os.rename on Windows

2016-03-23 Thread Random832
On Wed, Mar 23, 2016, at 08:17, Steven D'Aprano wrote: > Any Windows users here? > > print(e.winerror) # Windows only > print(e.errno) > print(repr(e)) 183 17 FileExistsError(17, 'Cannot create a file when that file already exists') Python 3.5.1. -- https://mail.python.org/mailman/l

Re: [Not actually OT] Trouble in node.js land

2016-03-23 Thread Random832
On Wed, Mar 23, 2016, at 05:03, Steven D'Aprano wrote: > https://medium.com/@azerbike/i-ve-just-liberated-my-modules-9045c06be67c > > Of course, moving his allegedly infringing package "kik" to github isn't > going to fix the problem. It's still allegedly infringing. I think the issue, and it is

Re: [Not actually OT] Trouble in node.js land

2016-03-23 Thread Random832
On Wed, Mar 23, 2016, at 10:52, Steven D'Aprano wrote: > - He didn't bother to check to see whether the name was in use when he > picked it. Someone not making a commercial product shouldn't have to worry about a name collision with something they've never heard of. > - The lawyers were polite bu

Re: The Cost of Dynamism (was Re: Pyhon 2.x or 3.x, which is faster?)

2016-03-23 Thread Random832
On Wed, Mar 23, 2016, at 12:08, Mark Lawrence wrote: > > And doing it 'Pythonically' can lead to suggestions such as the > > following the other day: > > > > c, psource = psource[0], psource[1:] > > > > (where psource is a very long string), which even I could tell, from > > knowing what goes o

Re: The Cost of Dynamism (was Re: Pyhon 2.x or 3.x, which is faster?)

2016-03-23 Thread Random832
On Wed, Mar 23, 2016, at 19:55, Steven D'Aprano wrote: > while psource: > c, psource = psource[0], psource[1:] > lxsymbol = disptable[min(ord(c), 256)](c, psource) > > > But one positive: this conclusively proves that "Pythonic" is in the eye > of > the beh

Re: netrc and password containing whitespace

2016-03-24 Thread Random832
On Thu, Mar 24, 2016, at 06:14, Lele Gaifax wrote: > I tried to insert an entry in my ~/.netrc for an account having a > password that contains a space, something like: > > machine my-host-name login myname password "My Password" > > The standard library netrc module does not seem able to parse i

Re: The Cost of Dynamism (was Re: Pyhon 2.x or 3.x, which is faster?)

2016-03-24 Thread Random832
On Thu, Mar 24, 2016, at 10:49, BartC wrote: > On 24/03/2016 14:34, Jussi Piitulainen wrote: > > You understand correctly, but it may be more natural in practice to > > write it this way: > > > > for k, item in enumerate(them): > > them[k] = f(item) > > > > I _think_ I might write i

Re: The Cost of Dynamism (was Re: Pyhon 2.x or 3.x, which is faster?)

2016-03-24 Thread Random832
On Thu, Mar 24, 2016, at 11:18, BartC wrote: > On 24/03/2016 15:03, Jon Ribbens wrote: > > No it isn't, it's replacing the elements in-place, > > Replace them with what, if not an entirely new list built from > '[0]*len(L)'? Well, the *contents* of such a list, obviously. But the original list's

Re: Tkinter --> Why multiple windows

2016-03-24 Thread Random832
On Thu, Mar 24, 2016, at 16:24, kevind0...@gmail.com wrote: > Hello: > > newbie Tkinter question > > If I run the code below two windows appear. > One empty and one with the text box and button. The empty one is the root window. -- https://mail.python.org/mailman/listinfo/python-list

Re: Undefined behaviour in C [was Re: The Cost of Dynamism]

2016-03-25 Thread Random832
On Fri, Mar 25, 2016, at 22:46, Steven D'Aprano wrote: > Culturally, C compiler writers have a preference for using undefined > behaviour to allow optimizations, even if it means changing the semantics > of your code. The C compiler is allowed to ignore your code, move it > around > so that things

Re: Threading is foobared?

2016-03-26 Thread Random832
On Sat, Mar 26, 2016, at 23:18, Ben Finney wrote: > What you've demonstrated is that at least one host is violating > communication standards by altering existing reference fields on > messages in transit. The usenet gateway relays posts that originated on the mailing list to usenet with their *Me

Re: repeat items in a list

2016-03-28 Thread Random832
On Mon, Mar 28, 2016, at 07:36, larudwer wrote: > in case you want to mainain order: > > ["a","b"]*3 > ['a', 'b', 'a', 'b', 'a', 'b'] > > is completely suffincient. I think you've completely missed the point of what order he's talking about. How do you turn ['a', 'c', 'b'] into ['a', 'a',

Re: Truthiness

2014-10-23 Thread random832
On Thu, Oct 23, 2014, at 10:56, Simon Kennedy wrote: > Thanks everyone. That's a thorough enough explanation for me. You should know, though, that numeric values equal to 1 (and 0 for False) _are_ == True. This works for dictionary keys, array indexes, etc. The bool type is actually a subclass of

Re: locale.getlocale() in cmd.exe vs. Idle

2014-11-11 Thread random832
; > > > > (None, None) > > > > C:\Users\Terry>python -c "import locale; > > locale.setlocale(locale.LC_CTYPE, ''); print(locale.getlocale())" > > ('English_United States', '1252') > > What is the differen

Re: locale.getlocale() in cmd.exe vs. Idle

2014-11-11 Thread random832
e, None) > > > > C:\Users\Terry>python -c "import locale; > > locale.setlocale(locale.LC_CTYPE, ''); print(locale.getlocale())" > > ('English_United States', '1252') > > What is the difference between getlocale and getdefaultlocale anyway? The > docstrings are even partially the same. The notatation of getlocale > appears to be OS-specific ("English_United States" in Windows) and not > Unix-like (cf. getdefaultlocale: en_US) > > regards, > Albert-Jan > -- > https://mail.python.org/mailman/listinfo/python-list -- Random832 -- https://mail.python.org/mailman/listinfo/python-list

Re: python 2.7 and unicode (one more time)

2014-11-20 Thread random832
On Thu, Nov 20, 2014, at 07:35, Peter Otten wrote: > >>> "%s nötig %s" % (u"üblich", u"ähnlich") > Traceback (most recent call last): > File "", line 1, in > UnicodeDecodeError: 'ascii' codec can't decode byte 0xc3 in position 4: > ordinal not in range(128) This is surprising to me - why is it

Re: python 2.7 and unicode (one more time)

2014-11-20 Thread random832
On Thu, Nov 20, 2014, at 09:59, Chris Angelico wrote: > On Fri, Nov 21, 2014 at 12:59 AM, wrote: > > On Thu, Nov 20, 2014, at 07:35, Peter Otten wrote: > >> >>> "%s nötig %s" % (u"üblich", u"ähnlich") > >> Traceback (most recent call last): > >> File "", line 1, in > >> UnicodeDecodeError: 'as

Re: python 2.7 and unicode (one more time)

2014-11-20 Thread random832
On Thu, Nov 20, 2014, at 16:29, Ethan Furman wrote: > If your unicode string happens to contain a base64 encoded .png, then you > could decode that into bytes. ;) Bytes of the PNG, or of the raw pixels? -- https://mail.python.org/mailman/listinfo/python-list

Re: python 2.7 and unicode (one more time)

2014-11-20 Thread random832
se combining accents, in a way unfortunately incompatible with unicode normalization if naively translated, whereas VISCII sacrifices a handful of C0 control characters in addition to fully packing the high half with letters. -- Random832 -- https://mail.python.org/mailman/listinfo/python-list

Re: Using Python for date calculations

2014-11-21 Thread random832
On Fri, Nov 21, 2014, at 05:33, alister wrote: > the problem with input is code-injection which is very similar to sql > injection (httpd://xkcd.com/327). > > the data entered by the user is processed as if it was python code, this > means the user could enter a command (or sequence of commands)

Re: Using Python for date calculations

2014-11-21 Thread random832
On Fri, Nov 21, 2014, at 05:47, Chris Angelico wrote: > Now, maybe you want it to eval. There are times when I conceptually > want "enter an integer", but it makes good sense to be able to type > "1+2" and have it act as if I typed "3". That's fine... but if you > want eval, write eval into your co

Re: Infinitely nested containers

2014-11-21 Thread random832
On Fri, Nov 21, 2014, at 02:00, Marko Rauhamaa wrote: > Gill Shen : > > > How is this [nesting] behavior implemented under the hood? > > Pointers. > > > And why is this allowed at all? > > There's no reason not to. There's no reason not to allow it with tuples, but you can't do it. Mainly beca

Re: Infinitely nested containers

2014-11-21 Thread random832
On Fri, Nov 21, 2014, at 12:47, Chris Angelico wrote: > You can do it in C, I believe - PyTuple_New() followed by > PyTuple_SetItem(x, 0, x) should do it. Yeah, that's how I did it. I think python 2 crashed and python 3 didn't... or maybe it was the interactive interpreter that crashed and calling

Re: python 2.7 and unicode (one more time)

2014-11-22 Thread random832
On Fri, Nov 21, 2014, at 23:38, Steven D'Aprano wrote: > I really don't understand what bothers you about this. In Python, we have > Unicode strings and byte strings. In computing in general, strings can > consist of Unicode characters, ASCII characters, Tron characters, EBCDID > characters, ISO-88

Re: python 2.7 and unicode (one more time)

2014-11-22 Thread random832
On Sat, Nov 22, 2014, at 18:38, Mark Lawrence wrote: > ... > That is a standard Windows build. He is again conflating problems with > using the Windows command line for a given code page with the FSR. The thing is, with a truetype font selected, a correctly written win32 console problem should be

Re: I have no class

2014-11-22 Thread random832
On Sat, Nov 22, 2014, at 21:47, Seymore4Head wrote: > What do I need to do to make a and b have different values? > import random > class RPS: > throw=random.randrange(3) > a=RPS > b=RPS > > print ("a ",a.throw) > print ("b ",b.throw) > if a.throw == b.throw: > print("Tie") > elif (a.thr

Re: python 2.7 and unicode (one more time)

2014-11-22 Thread random832
On Sat, Nov 22, 2014, at 21:11, Chris Angelico wrote: > Is that true? Does WriteConsoleW support every Unicode character? It's > not obvious from the docs whether it uses UCS-2 or UTF-16 (or maybe > something else). I was defining "every unicode character" loosely. There are certainly display prob

Re: Infinitely nested containers

2014-11-22 Thread random832
On Sun, Nov 23, 2014, at 00:59, Steven D'Aprano wrote: > >> It works fine now (Python 3.3). > >> > >> py> L = [] > >> py> t = (L, None) > >> py> L.append(L) > >> py> L.append(t) # For good measure. > >> py> print(t) > >> ([[...], (...)], None) > > > > This is a tuple in a list in a tuple, not

Re: python 2.7 and unicode (one more time)

2014-11-23 Thread random832
On Sun, Nov 23, 2014, at 11:33, Dennis Lee Bieber wrote: > Why would that be possible? Many truetype fonts only supply glyphs for > single-byte encodings (ISO-Latin-1, for example -- pop up the Windows > character map utility and see what some of the font files contain. With a bitmap font se

Re: python 2.7 and unicode (one more time)

2014-11-23 Thread random832
On Sun, Nov 23, 2014, at 15:31, Dave Angel wrote: > I didn't realize Windows shell (DOS box) had that bug. Course I don't > use Windows much the last few years. > > it's one thing to not display it properly. It's quite another to supply > faulty data to the clipboard. Especially since the Win

Re: bug or feature in enum34 py2.7 backport?

2014-11-26 Thread random832
On Wed, Nov 26, 2014, at 06:29, Mark Summerfield wrote: > TypeError: type() argument 1 must be string, not unicode If this is a bug, maybe it is one in type() itself - I get the same error with type('X', (object,), dict(a=1)) -- https://mail.python.org/mailman/listinfo/python-list

Re: Quotation Ugliness

2014-11-26 Thread random832
On Wed, Nov 26, 2014, at 01:04, Tim Daneliuk wrote: > In this case, I am not trying to write a fullblown language or recover > from syntax errors. Here's a usecase - I want to know whether I need > to use a sudo password when the user passes a command on the command line > of a program: > > some

Re: Quotation Ugliness

2014-11-26 Thread random832
On Wed, Nov 26, 2014, at 10:02, Tim Daneliuk wrote: >someprog.py "uname && sudo cat /etc/sudoers" > > vs. > >someprog.py 'uname && echo "sudo cat /etc/suoders"' I think it would be better to provide a general way for the user to provide an input script as an option, rather than to spec

Re: bug or feature in enum34 py2.7 backport?

2014-11-26 Thread random832
On Wed, Nov 26, 2014, at 09:40, Chris Angelico wrote: > I'd say that's a limitation, not a bug. A lot of stuff in Python 2 > depends on identifiers being ASCII-only byte strings, including - > apparently - parts of the core code. But why shouldn't the type constructor do the conversion (and any va

Re: Quotation Ugliness

2014-11-26 Thread random832
On Wed, Nov 26, 2014, at 10:36, Tim Daneliuk wrote: > The more I think about this, the more I think I am just going to look for > the > string 'sudo' anywhere in the argument. This merely will force the user > to > enter their sudo password if detected. If it turns out to be a false > positive, >

Re: Quotation Ugliness

2014-11-26 Thread random832
On Wed, Nov 26, 2014, at 10:55, Tim Daneliuk wrote: > Nope. Password only exist in memory locally. How does it send it to the remote sudo? -- https://mail.python.org/mailman/listinfo/python-list

Re: Quotation Ugliness

2014-11-26 Thread random832
On Wed, Nov 26, 2014, at 11:02, Tim Daneliuk wrote: > On 11/26/2014 10:00 AM, random...@fastmail.us wrote: > > On Wed, Nov 26, 2014, at 10:55, Tim Daneliuk wrote: > >> Nope. Password only exist in memory locally. > > > > How does it send it to the remote sudo? > > > > Over paramiko transport (ssh

Re: Cherrypy - prevent browser "prefetch"?

2014-12-02 Thread random832
On Mon, Dec 1, 2014, at 15:28, Israel Brewster wrote: > For example, I have a URL on my Cherrypy app that updates some local > caches. It is accessed at http:///admin/updatecaches So if I > start typing http:///a, for example, safari may auto-fill the > "dmin/updatecaches", and trigger a cache refr

Re: Cherrypy - prevent browser "prefetch"?

2014-12-02 Thread random832
On Tue, Dec 2, 2014, at 10:59, Israel Brewster wrote: > Primary because they aren’t forms, they are links. And links are, by > definition, GET’s. That said, as I mentioned in earlier replies, if using > a form for a simple link is the Right Way to do things like this, then I > can change it. As I

Re: How is max supposed to work, especially key.

2014-12-04 Thread random832
On Thu, Dec 4, 2014, at 05:09, Albert van der Horst wrote: > So in that case max doesn't return the maximum (True), but instead > something else. If you want to find the "largest" item in a list of of strings, sorted case-insensitively, you might use str.lower or locale.strxfrm as the key function

Re: time.monotonic() roll over

2014-12-04 Thread random832
On Thu, Dec 4, 2014, at 10:50, Marko Rauhamaa wrote: > That is, the internal integer wrap is not guarded against between the > calls to time.monotonic(), maybe. Looking at the code, it looks like it does guard against the rollover, though if you let your program run for 49.7 days _without_ calling

Re: When do default parameters get their values set?

2014-12-09 Thread random832
On Tue, Dec 9, 2014, at 16:18, Duncan Booth wrote: > The default parameters are actually evaluated when the 'def' statement is > executed and the function object is created from the default arguments > and > the previously compiled code block. Which means that if you execute the def statement [o

Re: When do default parameters get their values set?

2014-12-10 Thread random832
On Tue, Dec 9, 2014, at 21:44, Rustom Mody wrote: > Nice example -- thanks. > Elaborates the why of this gotcha -- a def(inition) is imperative. > From a semantic pov very clean. > From an expectation pov always surprising. Of course, I used a lambda for this. The equivalent without would be: def

Re: When do default parameters get their values set?

2014-12-11 Thread random832
On Wed, Dec 10, 2014, at 21:18, Rustom Mody wrote: > But I have a different question -- can this be demonstrated without the > 'is'? Er, yeah. You can, for example, add an item to one of the dictionaries and observe that it's not present in the other. -- https://mail.python.org/mailman/listinfo/p

Re: Bug? Feature? setattr(foo, '3', 4) works!

2014-12-19 Thread random832
On Fri, Dec 19, 2014, at 07:23, Ben Finney wrote: > Cem Karan writes: > > I'd like to suggest that getattr(), setattr(), and hasattr() all be > > modified so that syntactically invalid statements raise SyntaxErrors. > > What syntactically invalid statements? The only syntactically invalid > state

Re: is pathlib Path.resolve working as intended?

2014-12-24 Thread random832
On Wed, Dec 24, 2014, at 09:09, Chris Cioffi wrote: > PS: For those who are curious, the 2 issues that seemed to hold things > up the most are non-Unix systems (Windows) and how to handle when there > is no home directory. Posix only says that the results are undefined. What did they end up do

Re: How can i use a dictionnary

2015-01-13 Thread random832
On Tue, Jan 13, 2015, at 04:03, brice DORA wrote: > i consume a web service that return a element whose the type is > "instance". but this element seem be a dictionary but when i want to use > it like a dictionary, i got some errors. so this is the element and > please someone can tell me how can i

Re: Python is DOOMED! Again!

2015-01-22 Thread random832
On Thu, Jan 22, 2015, at 13:28, Mark Lawrence wrote: > Evidence in completely the opposite direction if I'm reading this > correctly https://www.python.org/dev/peps/pep-0484/#usage-patterns > > "The main use case of type hinting is static analysis using an external > tool without executing the a

Re: Python is DOOMED! Again!

2015-01-26 Thread random832
On Thu, Jan 22, 2015, at 23:23, Steven D'Aprano wrote: > Rick Johnson wrote: > > > The solution is move the type > > hinting syntax completely out of the source file and into > > another file -- think of it as a "Python Type Hinting Header > > File". > > The 1970s called, they want their bad idea

Re: unicode question

2015-01-27 Thread random832
On Tue, Jan 27, 2015, at 00:17, Rehab Habeeb wrote: > Hi there python staff > does python support arabic language for texts ? and what to do if it > support it? > i wrote hello in Arabic using codeskulptor and the powershell just for > testing and the same error appeared( a sytanx error in unicode)

Re: Python is DOOMED! Again!

2015-01-27 Thread random832
On Tue, Jan 27, 2015, at 01:36, Steven D'Aprano wrote: > I consider return type to be part of the function signature. The > signature > of a function is the parameters it accepts and the result it returns. It's part of it, but not the whole of it, and early C compilers had no information about th

Re: Python is DOOMED! Again!

2015-01-27 Thread random832
On Mon, Jan 26, 2015, at 19:11, Steven D'Aprano wrote: > > (header files in the 1970s didn't even actually include function > > signature information) - which did not even participate in compilation > > at all. > > If C compilers didn't use the header files, what were they for? My sentence may ha

Re: Python is DOOMED! Again!

2015-01-27 Thread random832
On Mon, Jan 26, 2015, at 19:11, Steven D'Aprano wrote: > random...@fastmail.us wrote: > - lexical analysis has to look for twice as many files (it has to > hit the hard drive for a stub file before looking at the source), > and we know from importing that file system access is a > significa

Re: unicode question

2015-01-27 Thread random832
On Tue, Jan 27, 2015, at 12:25, Mark Lawrence wrote: > People might find this http://bugs.python.org/issue1602 and hence this > https://github.com/Drekin/win-unicode-console useful. The latter is > available on pypi. However, Arabic is one of those scripts that runs up against the real limitati

Re: Is there a more elegant way to spell this?

2015-01-27 Thread random832
On Tue, Jan 27, 2015, at 13:05, Mario Figueiredo wrote: > In article , > jpiit...@ling.helsinki.fi says... > > > > If you mean literally some_predicate, then perhaps this. > > > > if some_predicate: > >for x in seq: > > handle(x) > > > > Careful. See Chris Warrick answer for the corr

Re: An object is an instance (or not)?

2015-01-27 Thread random832
On Tue, Jan 27, 2015, at 16:06, Mario Figueiredo wrote: > That error message has me start that thread arguing that the error is > misleading because the Sub object does have the __bases__ attribute. > It's the Sub instance object that does not have it. What do you think "Sub object" means? Sub

Re: An object is an instance (or not)?

2015-01-27 Thread random832
On Tue, Jan 27, 2015, at 23:47, alex23 wrote: > On 28/01/2015 10:24 AM, Mario Figueiredo wrote: > > In other words, the object know as "Sub class" is not an instance > > object. True, it is an instance of the object 'type'. > > >>> class Foo: > ... pass > ... > >>> isinstan

Re: An object is an instance (or not)?

2015-01-27 Thread random832
On Wed, Jan 28, 2015, at 00:43, Devin Jeanpierre wrote: > On Tue, Jan 27, 2015 at 9:37 PM, wrote: > > Sub itself is not a Sub object, it is a type object. "instance" is > > implicit in the phrase "foo object". > > Yes. Unfortunately, it's still not really completely clear. "Sub > instance" would

Re: An object is an instance (or not)?

2015-01-28 Thread random832
On Wed, Jan 28, 2015, at 01:59, Ben Finney wrote: > You have no justification to claim that, and it's hostile and dismissive > to claim it so assertively. Sorry about that - I was tired and had just read through the whole thread at once. > I'll freely admit to finding “'Foo' object” ambiguous. It

Re: Python is DOOMED! Again!

2015-01-29 Thread random832
On Wed, Jan 28, 2015, at 13:16, Mark Lawrence wrote: > C and C++ are weakly and statically typed languages. "strong typing" has no meaning at all, and "weak typing" means "anything I don't like". The fact that you can add an int and a float, or that you can use any object as a boolean, would make

Re: Python is DOOMED! Again!

2015-01-29 Thread random832
On Thu, Jan 29, 2015, at 10:56, Steven D'Aprano wrote: > Bar language, on the other hand, tries extremely hard to ensure that > every > type is automatically able to be coerced into every other type. The > coercion might not do what you expect, but it will do *something*: See, this is where the co

Re: Newbie question about text encoding

2015-02-24 Thread random832
On Tue, Feb 24, 2015, at 10:10, Chris Angelico wrote: > Ah, okay. :) But even with that level of confidence, you still have to > pick between Latin-1 and CP-1252, which you can't tell based on this > one snippet. Welcome to untagged encodings. Or Latin-9 (ISO 8859-15) That was popular on Linux sys

Re: Can global variable be passed into Python function?

2014-02-24 Thread random832
On Mon, Feb 24, 2014, at 13:05, j.e.ha...@gmail.com wrote: > typedef struct { > int value; > } Number; > > Number *o; > o = malloc(sizeof(*o)); > o->value=3; > printf("o<%p>, o->value<%p>\n", o, &o->value); > > o<0x9fe5008>, o->value<0x9fe5008> > > Is the compiler borked? That's cheat

Re: [OT] Can global variable be passed into Python function?

2014-02-24 Thread random832
On Mon, Feb 24, 2014, at 13:19, Michael Torrie wrote: > Why would you think that? The address of the start of your malloc'ed > structure is the same as the address of the first element. Surely this > is logical? And of course all this is quite off topic. That's not helpful - the problem, in cont

Re: Python 3.5, bytes, and %-interpolation (aka PEP 461)

2014-02-24 Thread random832
On Mon, Feb 24, 2014, at 15:46, Marko Rauhamaa wrote: > That is: > > 1. ineffient (encode/decode shuffle) > > 2. unnatural (strings usually have no place in protocols) That's not at all clear. Why _aren't_ these protocols considered text protocols? Why can't you add a string directly to header

Re: DB API question - where is a stored procedure's return value?

2014-03-13 Thread random832
On Thu, Mar 13, 2014, at 13:01, Chris Angelico wrote: > On Fri, Mar 14, 2014 at 1:43 AM, John Gordon wrote: > >> select foo() as value from dual > > > > That will get the return value into an SQL variable, but the OP wanted > > to know how to fetch it from python code. > > In theory, that should

Re: Deep vs. shallow copy?

2014-03-13 Thread random832
On Thu, Mar 13, 2014, at 11:28, Rustom Mody wrote: > Heh! I was hesitating to put that line at all: For one thing its a > hackneyed truth in the non-FP community. For another, in practical > Haskell, use of frank recursion is regarded as as sign of programming > immaturity: And IIRC Lisp and Schem

Re: unicode as valid naming symbols

2014-03-28 Thread random832
On Thu, Mar 27, 2014, at 11:10, Rustom Mody wrote: > Just out of curiosity how do/did you type that? > When I see an exotic denizen from the unicode-universe I paste it into > emacs and ask "Who are you?" > > But with your 'def' my emacs is going a bit crazy! Your emacs probably is using UCS-2 or

Re: Unicode Chars in Windows Path

2014-04-03 Thread random832
On Thu, Apr 3, 2014, at 5:00, Marko Rauhamaa wrote: > In fact, proper dealing with punctuation in pathnames is one of the main > reasons to migrate to Python from bash. Even if it is often possible to > write bash scripts that handle arbitrary pathnames correctly, few script > writers are pedantic

Re: Default mutable parameters in functions

2014-04-04 Thread random832
On Thu, Apr 3, 2014, at 20:38, Mark Lawrence wrote: > I just wish I had a quid for every time somebody expects something out > of Python, that way I'd have retired years ago. At least here it's not > accompanied by "as that's how it works in ". I can't imagine a language that would work that wa

Re: Unicode in Python

2014-05-01 Thread random832
On Mon, Apr 28, 2014, at 4:57, wxjmfa...@gmail.com wrote: > Python 3: > - It missed the unicode shift. > - Covering the whole unicode range will not make > Python a unicode compliant product. Please cite exactly what portion of the unicode standard requires operations with all characters to be han

Re: Python3 Multiprocessing

2013-08-09 Thread random832
On Fri, Aug 9, 2013, at 16:43, Devyn Collier Johnson wrote: > Thanks MRAB! That is easy. I always (incorrectly) thought the join() > command got two threads and made them one. I did not know it made the > script wait for the threads. What you're missing is the fact that the main thread [i.e. the

Re: back with more issues

2013-08-12 Thread random832
On Mon, Aug 12, 2013, at 10:56, Rotwang wrote: > No! A function should have *four* well-defined pieces: what are its > parameters, what does it do, what are its side-effects, what does it > return, and an almost fanatical devotion to the Pope [etc.] To be fair, I can't think of what "what does i

Re: .split() Qeustion

2013-08-14 Thread random832
On Wed, Aug 14, 2013, at 10:32, wxjmfa...@gmail.com wrote: > I'm always and still be suprised by the number of hard coded > '\n' one can find in Python code when the portable (here > win) > > >>> os.linesep > '\r\n' > > exists. Because high-level code isn't supposed to use the os module directly

Re: How to I do this in Python ?

2013-08-16 Thread random832
On Fri, Aug 16, 2013, at 7:47, Roy Smith wrote: > There is no need to shell out to dd just to do this. All dd is doing > for you is seeking to the offset you specify and closing the file. You > can do that entirely in Python code. > > http://docs.python.org/2.7/library/stdtypes.html#file.seek

Re: Encapsulation unpythonic?

2013-08-21 Thread random832
to be notified when its name changes, and so have a name property. The subclass may want to use a variable called _name for some other purpose. (maybe "name" isn't the best example). Examples often look pathological when you simplify out the bit that makes them make sense. -- Random8

Re: PEPs should be included with the documentation download

2013-08-21 Thread random832
On Wed, Aug 21, 2013, at 13:32, Chris Angelico wrote: > On Wed, Aug 21, 2013 at 3:14 PM, Aseem Bansal > wrote: > > Currently the documentation download includes a lot of things but PEPs are > > not its part. I wanted to suggest that PEPs should be included in the > > download. They are very much

Re: PEPs should be included with the documentation download

2013-08-21 Thread random832
On Wed, Aug 21, 2013, at 14:15, Jerry Hill wrote: > Personally, the only PEPs I've used as reference material as PEP 8 > (the Python Style Guide), and PEP 249 (the Python Database API > Specification v2.0). If I recall correctly, one of the database > adapters I used basically said that they were

Re: Raw_input with readline in a daemon thread makes terminal text disappear

2013-08-21 Thread random832
On Wed, Aug 21, 2013, at 12:42, David M. Welch wrote: > Hi all, > > This is an old thread, but I'm having the same behavior in my terminal > when > I run some code but kill the process in the terminal (Ctrl-C). The code > has > two prime suspects (from a simple google search): > 1. Creates ssh p

Re: Basic Python Query

2013-08-22 Thread random832
On Thu, Aug 22, 2013, at 9:45, Ned Batchelder wrote: > So that I understand what's going on, what's the bad thing that happens > with a multi-part message? I would have thought that mail readers would > choose the preferred part, or is it something to do with the message > quoting? The bad thi

<    1   2   3   4   5   6   7   8   >