. What command did you use and
what was the result?
[Maybe you tried to include images in your post/mail but they did not come
through. Just copy/paste the text.]
--
Piet van Oostrum
WWW: http://pietvanoostrum.com/
PGP key: [8DAE142BE17999C4]
--
https://mail.python.org/mailman/listinfo/python-list
__
> python-committers mailing list
> python-committ...@python.org
> https://mail.python.org/mailman/listinfo/python-committers
> Code of Conduct: https://www.python.org/psf/codeofconduct/
--
--Guido van Rossum (python.org/~guido)
--
https://mail.python.org/mailman/listinfo/python-list
n be simplified to just:
if errors:
This is quite usual in Python, but some people prefer the more elaborate form,
or something like:
if len(errors) == 0:
--
Piet van Oostrum
WWW: http://pietvanoostrum.com/
PGP key: [8DAE142BE17999C4]
--
https://mail.python.org/mailman/listinfo/python-list
On 09/23/2016 05:02 PM, Lawrence D’Oliveiro wrote:
On Thursday, September 22, 2016 at 8:34:20 AM UTC+12, Emile wrote:
Hmm, then I'll have to wait longer to experience the unreliability as
the handful of automated gui tools I'm running has only been up 10 to 12
years or so.
You sound like you h
On 09/28/2016 02:52 PM, Lawrence D’Oliveiro wrote:
On Thursday, September 29, 2016 at 4:57:10 AM UTC+13, Emile van Sebille wrote:
My point was that it is possible to automate windows reliably as long as the
programming is robust.
Sounds like circular reasoning.
Which worked for me! You
On 10/05/2016 01:06 PM, Michael Felt wrote:
On 02-Oct-16 19:50, Michael Felt wrote:
I am trying to understand the documentation re: ctypes and interfacing
with existing libraries.
I am reading the documentation, and also other sites that have largely
just copied the documentation - as well as
On 10/10/2016 09:25 AM, Nuen9 wrote:
Hi!
Could it be, "Nuen9", that you would like to find a split where the
split sums are close to each other? In other words, you define the
number of splits (in your example: 3) and the algortihm should test all
possible combinations and select the split where
On 11/21/2016 11:27 AM, subhabangal...@gmail.com wrote:
I have a python script where I am trying to read from a list of files in a
folder and trying to process something.
As I try to take out the output I am presently appending to a list.
But I am trying to write the result of individual files
.org/mailman/listinfo/python-dev
> > Unsubscribe: https://mail.python.org/mailman/options/python-dev/tritium-
> > list%40sdamon.com
>
> ___
> Python-Dev mailing list
> python-...@python.org
> https://mail.python.org/mailman/listinfo/python-dev
> Unsubscribe: https://mail.python.org/mailman/options/python-dev/
> guido%40python.org
>
--
--Guido van Rossum (python.org/~guido)
--
https://mail.python.org/mailman/listinfo/python-list
Thank you for taking the lead and good luck with the project!
On Wed, Jul 18, 2018 at 11:57 PM Abdur-Rahmaan Janhangeer <
arj.pyt...@gmail.com> wrote:
> Greetings everybody,
>
> i take this opportunity to announce to the python community that Arabic
> translations for the docs have started at
>
>
`
> After migrating from python 3.4.1 to python 3.6.6
> while Executing my project, I'm facing this issue and not able to
> resolve it. Can i get any solution for this issue?
Could it be that your PYTHONPATH environment variable is set to a directory i
I found (mostly fairly old stuff) some questions and a lot of (apparently often
not working) Python code.
1. does TKinter offer such thing out of the box?
2. or is there another way using TKinter?
3. or do I need another GUI tool (e.g. QT) for this?
TIA
--
https://mail.python.org/mailman/listin
ande Vyvre:
> Le 2/01/19 à 15:17, Arie van Wingerden a écrit :
> > I found (mostly fairly old stuff) some questions and a lot of (apparently
> > often not working) Python code.
> >
> > 1. does TKinter offer such thing out of the box?
> > 2. or is there another way
('testcsv.csv', newline='') as csvfile:
reader = csv.reader(csvfile, delimiter='\t')
for row in reader:
for i in range(2, 5):
row[i] = float(row[i])
print(row)
You could convert the first two columns to datetime format if you wish.
--
Piet van Oostrum
WWW: http://piet.vanoostrum.org/
PGP key: [8DAE142BE17999C4]
--
https://mail.python.org/mailman/listinfo/python-list
ndroid
JPG-images as the 'Exif.GPSInfo.GPSTimeStamp' and
'Exif.GPSInfo.GPSDateStamp' are missing.
Why I get this unrespected results?
Kind regards,
Jaap.
--
Jaap van Wingerde
e-mail: 1234567...@vanwingerde.nl
--
https://mail.python.org/mailman/listinfo/python-list
int(est_dt.strftime(fmt) + ' / ' + edt_dt.strftime(fmt))
> 2002-10-27 01:30:00 EDT-0400 / 2002-10-27 01:30:00 EST-0500
>
>
> Browse through their examples and see if you can find something
> similar that works for you.
>
>
> -Original Message-
> From
; f( x; y )
>
> (the actual call still would use a comma there).
>
What are you talking about? What documentation? It seems to me you are talking
about a completely different programming language, not python.
--
Piet van Oostrum
WWW: http://piet.vanoostrum.org/
PGP key: [8DAE142BE17999C4]
--
https://mail.python.org/mailman/listinfo/python-list
ce.
>
> Christian
Even simpler:
>>> help(len)
help(len)
Help on built-in function len in module builtins:
len(obj, /)
Return the number of items in a container.
both in python 3.6 and 3.7.
This is weird.
--
Piet van Oostrum
WWW: http://piet.vanoostrum.org/
PGP key: [8DAE142BE17999C4]
--
https://mail.python.org/mailman/listinfo/python-list
o to get the names?!
python3
>>> x = '\xce\x86\xce\xba\xce\xb7\xcf\x82
>>> \xce\xa4\xcf\x83\xce\xb9\xce\xac\xce\xbc\xce\xb7\xcf\x82'
>>> b = bytes(ord(c) for c in x)
>>> b.decode('utf-8')
'Άκης Τσιάμης'
>>>
--
Piet van Oostrum
WWW: http://piet.vanoostrum.org/
PGP key: [8DAE142BE17999C4]
--
https://mail.python.org/mailman/listinfo/python-list
ainer.find('div', attrs={'class':'item-branding'})
> price = container.find('div', attrs={'class':'item-action'})
> records.append((brand, price))
>
When I put this in a python file, and run it under python3.7, it work
t(int)
The value of int is the class int, which is the class of 5, so type(5) is also
that same class int.
--
Piet van Oostrum
WWW: http://piet.vanoostrum.org/
PGP key: [8DAE142BE17999C4]
--
https://mail.python.org/mailman/listinfo/python-list
hat
model.py wasn't found in classes, i.e. it was the same error as Peter got.
So to get this working you must make sure 'classes' is inside a directory that
is in sys.path, for example by adding:
sys.path.insert(0, '..')
--
Piet van Oostrum
WWW: http://piet.vanoostrum.org/
PGP key: [8DAE142BE17999C4]
--
https://mail.python.org/mailman/listinfo/python-list
the y is basically part of an expression. But starred expressions are not
allowed in expressions, except within explicit parentheses.
--
Piet van Oostrum
WWW: http://piet.vanoostrum.org/
PGP key: [8DAE142BE17999C4]
--
https://mail.python.org/mailman/listinfo/python-list
27;New Team')]
And than it should work.
Except that the str.replace is wrong for what you want. It just replaces the
literal string "s/+" with an empty string instead of white space. This was
wrong in the stackoverflow post.
To replace whitespace it should be str.replace(
Piet van Oostrum writes:
> So the correct way to do this is to make df1 a copy rather than a view.
>
> df1 = df.loc[:, ('UID','Name','New Leader','Current Team', 'New Team')]
Or maybe even make an explicit copy:
df1 = df[['UID
oc['New Team'].str.lower().str.strip()
>
> But on both occasions I receive this error.
>
> # KeyError: 'the label [Current Team] is not in the [index]'
>
> if I test df1 before trying to create the new column it works just fine.
>
> Sayth
What
t there is no guarantee. It depends on
garbage collection.
In your case the file will not be closed as long as there is still a reference
to it (as in f). When f disappears and all copies of it as well, the file COULD
be closed similarly.
On the other hand, the with statement guarantees that
at 'Current Team' is spelled differently in the assignment
than in the construction of df1? For example a difference in spaces, like a
triling space or a breaking vs. non-breaking space? Please check that both are
exactly the same.
--
Piet van Oostrum
WWW: http://piet.vanoostrum.org/
;)
False
In [3]: if var is not None:
...: print('True')
...: else:
...: print('False')
True
--
Piet van Oostrum
WWW: http://piet.vanoostrum.org/
PGP key: [8DAE142BE17999C4]
--
https://mail.python.org/mailman/listinfo/python-list
I couldn’d find the IDLE shell
> with them.
Well, on MacOS 10.13.6 (High Sierra) tensorflow 1.14.0 does install on Python
3.7.4, and it also runs. It does give some warnings about deprecations, however.
There is also a version 2.0RC which installs and runs without warnings.
--
Piet van
grab all columns 13 when I requested 5.
> UID Name FTE Agent ID Current Leader New Leader Current Team New
> Team Current Site New Site Unnamed: 10 Unnamed: 11 Unnamed: 12
>
> How do I misunderstand iloc?
>
That would select ROWS 0,1,5,6,7, not columns.
To select columns 0,1,5,6
Piet van Oostrum writes:
> That would select ROWS 0,1,5,6,7, not columns.
> To select columns 0,1,5,6,7, use two-dimensional indexes
>
> df1 = df.iloc[:, [0,1,5,6,7]]
>
> : selects all rows.
And that also solves your original problem.
This statement:
df1['Difference
actually treated this as a CSV file.
2) As I said above, if you choose ',' as separator, these will disappear.
Similarly, if you choose TAB as seperator, the TABs will disappear. As the
format is a strange mixture of the two, you can use either one. But if it would
be read with a real
')
> 27
> ---> 28 my_data_3 = int(my_data_2)
> 29
> 30 my_data_4 = my_data_3.astype(np.float)
> TypeError: only length-1 arrays can be converted to Python scalars
> #
>>> my_data_2 = numpy.array(['0a
print(add_vat(101, 'low'))
>
> Outcome:
>
> 122.21
> 110.09
>
> Thanks!
You could use a dictionary to connect the words to the values.
As this is homework you have to do it yourself. Learn about dictionaries.
Otherwise just use 'if'.
--
Piet van
gt; Confused
>
> Sayth
df1['Difference'] = df1['Current Team'].str.lower().str.strip() ==
df1['New Team'].str.lower().str.strip()
works on whole columns, not only on an individual row.
xls = pd.ExcelFile("Melbourne.xlsx")
df = xls.par
gt; |>>> re.search( pattern, '1234' ).group( 1 )
> |IndexError: no such group
> |>>> re.search( pattern2, '1234' ).group( 1 )
> |>>>
>
The second pattern has parentheses, hence a group. The first doesn't.
--
Piet van Oostrum
WWW: http://piet.vanoostrum.org/
PGP key: [8DAE142BE17999C4]
--
https://mail.python.org/mailman/listinfo/python-list
acility. When a compound statement is entered interactively, it must be
followed by a blank line to indicate completion (since the parser cannot guess
when you have typed the last line). Note that each line within a basic block
must be indented by the same amount.
--
Piet van Oostrum
WWW: http://piet
code the error is on line 15
1) What is line 15?
2) Always copy/paste the complete error message with your question.
3) Your with body is not indented:
with fits.open(fits_filename) as data:
df=pd.DataFrame(data[1].data)
df.columns=[c.lower() for c in df.columns]
print(&
cation in dataframe before extracting the numeric fields to the
> array.
>
> Please, any comments or tip?
data = pd.read_csv ('table.csv', sep = ',', skiprows = 1, decimal=b',',
skipinitialspace=True)
--
Piet van Oostrum
WWW: http://piet.vanoostrum.org/
PGP key: [8DAE142BE17999C4]
--
https://mail.python.org/mailman/listinfo/python-list
; I found that it also works without the letter b.
>
I added the b because the default in the definition of read_csv is b'.', but
you are right, it works with just ','.
--
Piet van Oostrum
WWW: http://piet.vanoostrum.org/
PGP key: [8DAE142BE17999C4]
--
https://mail.python.org/mailman/listinfo/python-list
here is some working code:
def PReader(csvfile):
import re
for line in csvfile:
line = re.sub(r'\(.*?\)', '"\g<0>"', line)
yield line
import csv
with open('testcsv.csv') as csvfile:
reader = csv.reader(PReader(csvfile), quot
about (5,7), (5,8) and (6,8)?
--
Piet van Oostrum
WWW: http://piet.vanoostrum.org/
PGP key: [8DAE142BE17999C4]
--
https://mail.python.org/mailman/listinfo/python-list
d probably want to generate a PDF file and send that to the
printer, possibly with the use of LaTeX.
--
Piet van Oostrum
WWW: http://piet.vanoostrum.org/
PGP key: [8DAE142BE17999C4]
--
https://mail.python.org/mailman/listinfo/python-list
at's going on?
>>> Foo.__abstractmethods__
Traceback (most recent call last):
File "", line 1, in
AttributeError: __abstractmethods__
--
Piet van Oostrum
WWW: http://piet.vanoostrum.org/
PGP key: [8DAE142BE17999C4]
--
https://mail.python.org/mailman/listinfo/python-list
you prefer that.
You can leave out the c.LatexExporter.template_file line if you don't want the
LaTeX exporter to generate A4.
--
Piet van Oostrum
WWW: http://piet.vanoostrum.org/
PGP key: [8DAE142BE17999C4]
--
https://mail.python.org/mailman/listinfo/python-list
Martin Schöön writes:
> Den 2019-10-13 skrev Piet van Oostrum :
>> Martin Schöön writes:
>>
>>> Is there a way to do "Download as PDF" and get A4 pages instead
>>> of Letter? Yes, I know I can do "Download as LaTeX" and edit the
>>
>
hat is called IDLE. It is simpler than Pycharm, but it can
do the job. So you can try that. If that also gives an error you could try to
reinstall Python.
If you are familiar with the command line, then that is also a possibility.
--
Piet van Oostrum
WWW: http://piet.vanoostrum.org/
PGP key: [8D
n making hasty subdivisions.
In this context that means attributes (that can be None) rather than subclasses.
--
Piet van Oostrum
WWW: http://piet.vanoostrum.org/
PGP key: [8DAE142BE17999C4]
--
https://mail.python.org/mailman/listinfo/python-list
Martin Schöön writes:
> Den 2019-10-15 skrev Piet van Oostrum :
>>
>> What does this report? Compare if there is a difference between home and
>> work.
>>
>> from jupyter_core.paths import jupyter_path
>> print(jupyter_path('notebook','
doganad...@gmail.com writes:
>
> In the meanwhile I have checked Scala , and it's more limited then Python.
> As an example:
> 0.0001
> 1.0E-4: Double
>
Why do you think this means Scala is more limited than Python?
--
Piet van Oostrum
WWW: http://piet.vanoostrum.org/
PGP
rs of the language, not
characteristics of the language itself.
--
Pieter van Oostrum
WWW: http://piet.vanoostrum.org/
PGP key: [8DAE142BE17999C4]
--
https://mail.python.org/mailman/listinfo/python-list
Piet van Oostrum writes:
> doganad...@gmail.com writes:
>
>> I dont know much about scala actually. I have just have tried to give
>> 0.0001 and it returned a presentation with an 'e' .whereas python takes
>> 0.0001 and gives 0.0001 . it made me think python is
Outlook voor Android downloaden<https://aka.ms/ghei36>
________
Van: Francois van Lieshout
Verstuurd: maandag 4 november 2019 18:19
Aan: python-list@python.org
Onderwerp: permission denied using python 3.8
Hi, i installed python 3.8 the latest version but it d
In [8]: class MA(type):
...: def __instancecheck__(cls, inst):
...: print ("MA", cls, inst)
...:
...: class AM(list, metaclass = MA): pass
...: class AM2(AM): pass
...:
...: am = AM2()
In [9]: isinstance(am, AM)
MA []
Out[9]: False
--
Pieter van Oostrum
WW
fication (:...). {i=} is not a correct
expression. When you remove the »f«, it becomes a normal string, where
the {} don't have a special meaning.
--
Pieter van Oostrum
WWW: http://pieter.vanoostrum.org/
PGP key: [8DAE142BE17999C4]
--
https://mail.python.org/mailman/listinfo/python-list
t is called from Func2, it uses MyVar from Func2?
If that is what you mean, that would be dynamic scope.
--
Pieter van Oostrum
WWW: http://pieter.vanoostrum.org/
PGP key: [8DAE142BE17999C4]
--
https://mail.python.org/mailman/listinfo/python-list
al characters " ' () [ and $ must be escaped for the shell,
and [ and $ also for the regexp.
Then it comes down to
sed -e s=\"\(\\[^/]+\)\\$\"=\'\(\[^/]+\)\$\'= file
--
Pieter van Oostrum
WWW: http://pieter.vanoostrum.org/
PGP key: [8DAE142BE17999C4]
--
https://mail.python.org/mailman/listinfo/python-list
Pieter van Oostrum writes:
> It isn't that difficult with sed, only you have to chose a different
> character than / in the substitute command, one that is not present in
> both texts, e.g instead of s/a/b/ use s=a=b=.
>
> And then the special characters " ' () [
Hongyi Zhao writes:
> On Sun, 17 Nov 2019 20:28:55 +0100, Pieter van Oostrum wrote:
>
>> To be honest, I myself would use Emacs, with rgrep and wgrep to do this.
>
> Are these tools superior to grep?
They are based on grep. But rgrep does a grep through a whole directory tre
; testfunc()
>>> globvar
Traceback (most recent call last):
File "", line 1, in
NameError: name 'globvar' is not defined
>>> def testfunc():
... global globvar
... globvar = 1
...
>>> globvar
Traceback (most recent call last):
File
#x27;], shell=True)
>
> I get
>
> Test.py: 1: Test.py: ./: Permission denied
>
Why would you do that, splitting './Test.py' in two parts? That doesn't work.
> Is there a simple way to use subprocess in this usecase?
>
subprocess.call(['./Test.py'])
--
Pieter van Oostrum
www: http://pieter.vanoostrum.org/
PGP key: [8DAE142BE17999C4]
--
https://mail.python.org/mailman/listinfo/python-list
p.family)```
Please next time, supply a properly indented Python source, with only normal
ASCII spaces, not no-break spaces, i.e. exactly like in your Python source code.
>
> The Username class also needs to call super(). In general, super() is
> intended to be used with all classes that
>
> user@USERnoMacBook-Air LibraBrowser %
Could it be that your pip3 belongs to a different Python than the one above
(for example a Python 3.8 or 3.6)? What is the output of 'pip3 --version'
(without quotes)?
--
Pieter van Oostrum
www: http://pieter.vanoostrum.org/
PGP key: [8D
character, Unicode 0xF3,
LATIN SMALL LETTER O WITH ACUTE.
In (a) it is composed of the letter o and the accent "́" (Unicode 0x301).
So you would have to do Unicode normalisation before comparing.
For example:
In [16]: from unicodedata import normalize
In [17]: a == b
Out[17]: False
gt; --
> Python-announce-list mailing list -- python-announce-l...@python.org
> To unsubscribe send an email to python-announce-list-le...@python.org
> https://mail.python.org/mailman3/lists/python-announce-list.python.org/
>
> Support the Python Software Foundation:
> h
he name sys is used in the imported module, that module has to import sys.
Importing it in the calling code doesn't help.
So I would say this is a bug in the module.
You should report the bug to its author. In the meantime you can correct your
own copy at
~/opt/miniconda3/envs/py3/
alon.naj...@gmail.com writes:
> hi
> looking for git with a solution - merge many pdfs to 1 pdf (no matter what
> language)
There is a clone of pdftk on github: https://github.com/ericmason/pdftk
Another possibility is mupdf: http://git.ghostscript.com/?p=mupdf.git
--
Pieter van Oo
anyone have any suggestions?
>
> chris
https://github.com/eea/odfpy
--
Pieter van Oostrum
www: http://pieter.vanoostrum.org/
PGP key: [8DAE142BE17999C4]
--
https://mail.python.org/mailman/listinfo/python-list
the import system.
Are you running python 3.6?
I tried this on python 3.7 and it worked, but the file is called
_rtmidi.cpython-37m-darwin.so there (37 for python3.7, and the d is missing, I
don't know what that indicates).
--
Pieter van Oostrum
www: http://pieter.vanoostrum.org/
PGP key: [8DAE142BE17999C4]
--
https://mail.python.org/mailman/listinfo/python-list
n the database. Of course this
only works if that stored hash has been calculated in the same way from the
same key.
On Python 2 (which you shouldn't use) you can leave out the "key = bytes(key,
'ascii')" part.
You can of course make it more sophisticated, for example by
kiran chawan writes:
> Whenever Iam trying to run this 'New latest version python software 3.8.4
> python ' but it doesn't show any install option and it say ' modify set up
> ' So tell what to do sir plz help me out.
There is no Python 3.8.4
er file name
with open(secretfile, 'rb') as fd:
secret = fd.read()
key = 'goldQ3T8-1QRD-5QBI-9F22'
bkey = key.encode('ascii')
h = hmac.new(secret, bkey, hashlib.sha256)
print('hd (hex): ', h.hexdigest())
--
Pieter van Oostrum
www: http://piet
for x in range( 0,10 ):
stars = ""
count = 0
while count < x:
stars += "x"
count += 1
print( stars )
x
xx
xxx
x
xx
xxx
x
You've got already an "x" placed in your variable stars that's why.
-O
t; 'ÿ'.encode('utf-16-le')
>>> > b'\xff\x00'
>>> >>>> 'ÿ'.encode('utf-32-le')
>>> > b'\xff\x00\x00\x00'
>>
>>> That all looks as expected.
>> Yes
>>
>>>Is there somet
'
else:
yield from reclist(item)
else:
yield item
for i in reclist(aList):
print(i, end=',')
This gives you an extra comma at the end, unfortunately.
But it is the pattern for other types of processing.
Or use it like this:
print (','.join(str(i) for i in reclist(aList)))
--
Pieter van Oostrum
www: http://pieter.vanoostrum.org/
PGP key: [8DAE142BE17999C4]
--
https://mail.python.org/mailman/listinfo/python-list
'
else:
yield from reclist(item)
else:
yield item
for i in reclist(aList):
print(i, end=',')
This gives you an extra comma at the end, unfortunately. But it is the pattern
for other types of processing.
Or use it like this:
print (','.join(str(i) for i in reclist(aList)))
--
Pieter van Oostrum
www: http://pieter.vanoostrum.org/
PGP key: [8DAE142BE17999C4]
--
https://mail.python.org/mailman/listinfo/python-list
'Ä¿'.encode('utf-16-le')
>>> > b'\xff\x00'
>>> >>>> 'Ä¿'.encode('utf-32-le')
>>> > b'\xff\x00\x00\x00'
>>
>>> That all looks as expected.
>> Yes
>>
>>>Is there some
t;Is there something about the output that puzzles you?
>> No
>>
>>>Did you have a question?
>> No, only a comment
>>
>> This buggy language is very amusing.
>
> What's the bug, or source of amusement?
The bug is in the mental world of the OP.
--
Pieter van Oostrum
www: http://pieter.vanoostrum.org/
PGP key: [8DAE142BE17999C4]
--
https://mail.python.org/mailman/listinfo/python-list
'
else:
yield from reclist(item)
else:
yield item
for i in reclist(aList):
print(i, end=',')
This gives you an extra comma at the end, unfortunately. But it is the pattern
for other types of processing.
Or use it like this:
print (','.join(str(i) for i in reclist(aList)))
--
Pieter van Oostrum
www: http://pieter.vanoostrum.org/
PGP key: [8DAE142BE17999C4]
--
https://mail.python.org/mailman/listinfo/python-list
'
else:
yield from reclist(item)
else:
yield item
for i in reclist(aList):
print(i, end=',')
This gives you an extra comma at the end, unfortunately. But it is the pattern
for other types of processing.
Or use it like this:
print (','.join(str(i) for i in reclist(aList)))
--
Pieter van Oostrum
www: http://pieter.vanoostrum.org/
PGP key: [8DAE142BE17999C4]
--
https://mail.python.org/mailman/listinfo/python-list
econd way can be used in Python 3.
--
Pieter van Oostrum
www: http://pieter.vanoostrum.org/
PGP key: [8DAE142BE17999C4]
--
https://mail.python.org/mailman/listinfo/python-list
not something you
provide yourself. Your arguments are bez, ge, ins.
class PKW(Fahrzeug):
def __init__(self, bez, ge, ins):
--
Pieter van Oostrum
www: http://pieter.vanoostrum.org/
PGP key: [8DAE142BE17999C4]
--
https://mail.python.org/mailman/listinfo/python-list
you write y = x, then they are not the same variable, but they point to (the
proper Python language is they are bound to) the same object.
Now if you say x.age = 20, then y.age will also be 20 (it's the same object).
--
Pieter van Oostrum
www: http://pieter.vanoostrum.org/
PGP key: [8DAE142
Pieter van Oostrum writes:
> Joseph Nail writes:
>
>> Hello,
>> I have one problem. Somehow in my function when I wrote y=x, they are the
>> same variable and then it also changes age or height (which were x) in the
>> main program. See more in attached file.
x27;t print anything,
because the print statement is not part of the class __init__ code.
In [28]: first.second()
>From second
That's expected.
In [29]: first.second()
>From second
Again.
--
Pieter van Oostrum
www: http://pieter.vanoostrum.org/
PGP key: [8DAE142BE17999C4]
--
https://mail.python.org/mailman/listinfo/python-list
this so?
'From first' is the result of the class definition. 'from second' is the result
of first.second().
And first() doesn't produce any output.
Your problem is probably that you think that the call first() executes all the
statements in the class definition. It doesn
... 'last_name': 'Allen',
... 'email': 'fal...@ibm.com'
... })
In [37]: d
Out[37]: {'first_name': 'Frances', 'last_name': 'Allen', 'email':
'fal...@ibm.com'}
In [3
rror appears.
--
Pieter van Oostrum
www: http://pieter.vanoostrum.org/
PGP key: [8DAE142BE17999C4]
--
https://mail.python.org/mailman/listinfo/python-list
file __pycache__ in the directory p1.
To remove it use rmtree(path.join(P1,'__pycache__'))
Then the second import will succeed.
--
Pieter van Oostrum
www: http://pieter.vanoostrum.org/
PGP key: [8DAE142BE17999C4]
--
https://mail.python.org/mailman/listinfo/python-list
Pieter van Oostrum writes:
>
> The first import creates a file __pycache__ in the directory p1.
That should be 'a directory __pycache__'
> To remove it use rmtree(path.join(P1,'__pycache__'))
> Then the second import will succeed.
> --
> Pieter van Oostr
break
if is_prime:
print(a)
a = a + 2
Further optimizations are possible, for example use range(2,a/2) or even range
(2, sqrt(a)).
--
Pieter van Oostrum
www: http://pieter.vanoostrum.org/
PGP key: [8DAE142BE17999C4]
--
https://mail.python.org/mailman/listinfo/python-list
t you can give a function as metaclass. But that seems to
be part of the specification. The function result is what the 'class' becomes.
You can even have it return something else. Then the 'class' wouldn't really be
a class.
In [65]: def meta(cls, *args): return 1
In [66]: class A(metaclass=meta): pass
In [67]: A
Out[67]: 1
--
Pieter van Oostrum
www: http://pieter.vanoostrum.org/
PGP key: [8DAE142BE17999C4]
--
https://mail.python.org/mailman/listinfo/python-list
Pieter van Oostrum writes:
> Your Pardon is not a class, it is a function. Class A is created by
> type(cls, *args), so 'type' is the metaclass of A, and therefore also of
> B.
> Creation of B does not call Pardon.
With a class it *does* work:
In [74]: class Pardon(t
rably something that is displayed
immediately after installation of in some other way is prominently
displayed. I am not on Windows myself, so I am afraid I will not be of
much help in this respect.
--
Pieter van Oostrum
www: http://pieter.vanoostrum.org/
PGP key: [8DAE142BE17999C4]
--
https://mail.python.org/mailman/listinfo/python-list
L page describing the first steps to start
using Python. It could mention the command line (py) to be used with a
text editor (some recommendations) and IDLE. And how not to double click
.py files :)
--
Pieter van Oostrum
www: http://pieter.vanoostrum.org/
PGP key: [8DAE142BE17999C4]
--
https://mail.python.org/mailman/listinfo/python-list
the 0.4 followed by 6 more digits.
> Anything further is, in effect, up for grabs.
>
Most Python implementations use 64-bit doubles (53 bits of precision). See
https://docs.python.org/3.8/tutorial/floatingpoint.html
--
Pieter van Oostrum
www: http://pieter.vanoostrum.org/
PGP key: [8DAE142BE17999C4]
--
https://mail.python.org/mailman/listinfo/python-list
2 + 11 + 1 == 64.
> Yep, floating point is fun.
>
> That assumed top 1 bit is always there, except when it isn't. Because
> denormal numbers are a thing. They don't have that implied 1 bit.
Yes, for subnormal numbers the implicit bit *is* stored. They are characterized
by
list [","] | comprehension] ")"
comprehension ::= expression comp_for
The last part is the inner part (i.e. without the parentheses) of
generator_expression.
--
Pieter van Oostrum
www: http://pieter.vanoostrum.org/
PGP key: [8DAE142BE17999C4]
--
https://mail.python.org/mailman/listinfo/python-list
;head"
("Injection-Info: news.bbs.nz" -1002 nil s))
i.e. each message that contains "news.bbs.nz" in the "Injection-Info"
header will be made invisible.
This solved the problem for me.
--
Pieter van Oostrum
www: http://pieter.vanoostrum.org/
PGP key: [8DAE142BE17999C4]
--
https://mail.python.org/mailman/listinfo/python-list
201 - 300 of 3254 matches
Mail list logo